mirror of
https://github.com/ps5-linux/ps5-linux-image.git
synced 2026-07-16 01:50:40 +00:00
Initial commit
This commit is contained in:
16
docker/kernel-builder-arch/Dockerfile
Normal file
16
docker/kernel-builder-arch/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM archlinux:latest
|
||||
|
||||
# Only packaging tools needed — kernel is already compiled
|
||||
RUN pacman -Syu --noconfirm && pacman -S --noconfirm \
|
||||
zstd libarchive && \
|
||||
pacman -Scc --noconfirm
|
||||
|
||||
WORKDIR /out/staging
|
||||
|
||||
# Pre-built artifacts are bind-mounted at /out/staging
|
||||
# Output packages go to /out
|
||||
|
||||
COPY docker/kernel-builder-arch/build.sh /build.sh
|
||||
RUN chmod +x /build.sh
|
||||
|
||||
CMD ["/build.sh"]
|
||||
58
docker/kernel-builder-arch/build.sh
Normal file
58
docker/kernel-builder-arch/build.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
# Packages pre-built kernel artifacts as a pacman .pkg.tar.zst.
|
||||
# Runs inside Docker as root; packages manually (makepkg refuses root).
|
||||
# Expects build artifacts staged in /out/staging by the ubuntu build step.
|
||||
set -e
|
||||
|
||||
if [ ! -f /out/staging/boot/bzImage ]; then
|
||||
echo "Error: no staged artifacts in /out/staging — run the kernel build step first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine version from staged modules directory
|
||||
KVER=$(ls /out/staging/lib/modules/)
|
||||
PKGNAME="linux-custom"
|
||||
VERSION=${KVER%%-*}
|
||||
|
||||
echo "==> Packaging kernel $KVER as pacman package"
|
||||
|
||||
STAGING=$(mktemp -d)
|
||||
|
||||
# Copy staged boot artifacts
|
||||
mkdir -p "$STAGING/boot"
|
||||
cp /out/staging/boot/bzImage "$STAGING/boot/vmlinuz-$KVER"
|
||||
cp /out/staging/System.map "$STAGING/boot/System.map-$KVER"
|
||||
cp /out/staging/.config "$STAGING/boot/config-$KVER"
|
||||
|
||||
# Copy pre-installed modules (Arch uses /lib -> /usr/lib)
|
||||
mkdir -p "$STAGING/usr/lib/modules"
|
||||
cp -a "/out/staging/lib/modules/$KVER" "$STAGING/usr/lib/modules/"
|
||||
|
||||
# Create .PKGINFO
|
||||
BUILDDATE=$(date -u +%s)
|
||||
INSTALLED_SIZE=$(du -sb "$STAGING" | awk '{print $1}')
|
||||
cat > "$STAGING/.PKGINFO" << EOF
|
||||
pkgname = $PKGNAME
|
||||
pkgbase = $PKGNAME
|
||||
pkgver = ${VERSION}-1
|
||||
pkgdesc = Custom Linux kernel $KVER for PS5
|
||||
url = https://kernel.org
|
||||
builddate = $BUILDDATE
|
||||
packager = bootstrap_docker
|
||||
size = $INSTALLED_SIZE
|
||||
arch = x86_64
|
||||
license = GPL-2.0-only
|
||||
provides = linux=$VERSION
|
||||
provides = linux-custom=$VERSION
|
||||
EOF
|
||||
|
||||
# Create .MTREE (required by newer pacman)
|
||||
cd "$STAGING"
|
||||
LANG=C bsdtar -czf .MTREE --format=mtree \
|
||||
--options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
|
||||
.PKGINFO *
|
||||
|
||||
# Build the package
|
||||
LANG=C bsdtar -cf - .PKGINFO .MTREE * | zstd -c -T0 > "/out/${PKGNAME}-${VERSION}-1-x86_64.pkg.tar.zst"
|
||||
|
||||
echo "==> Done: /out/${PKGNAME}-${VERSION}-1-x86_64.pkg.tar.zst"
|
||||
Reference in New Issue
Block a user