Files
Your Name d763b8496f kernel-builder-rpm: ship ps5-stage-firmware + ps5-bt-quiet services
The deb and arch packagers already copy /out/staging/{etc,usr/local}
into their packages, but the rpm packager was missing that step, so
Fedora/Bazzite installs never got the firmware-bridge service or
the moal modprobe.d config. Symptom: moal loads on boot, requests
nxp/pcieuartiw620_combo_v1.bin, kernel returns -ENOENT because the
firmware sits at /efi/lib/nxp/ instead of /lib/firmware/nxp/, and
wifi is dead until fix-wifi.sh runs by hand.
2026-07-03 13:43:26 -04:00

64 lines
2.2 KiB
Bash

#!/bin/bash
# Packages pre-built kernel artifacts as an rpm.
# Runs inside Docker as root.
# Expects build artifacts staged in /out/staging by the kernel 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-ps5"
VERSION=${KVER%%-*}
echo "==> Packaging kernel $KVER as rpm"
RPMROOT=$(mktemp -d)
STAGE="$RPMROOT/stage"
# Copy staged boot artifacts
mkdir -p "$STAGE/boot"
cp /out/staging/boot/bzImage "$STAGE/boot/vmlinuz-$KVER"
cp /out/staging/System.map "$STAGE/boot/System.map-$KVER"
cp /out/staging/.config "$STAGE/boot/config-$KVER"
# Copy pre-installed modules (Fedora uses /usr/lib/modules)
mkdir -p "$STAGE/usr/lib/modules"
cp -a "/out/staging/lib/modules/$KVER" "$STAGE/usr/lib/modules/"
# Build headers for out-of-tree module builds. UAPI headers (/usr/include)
# are intentionally excluded — they would conflict with Fedora's
# kernel-headers package.
if [ -d "/out/staging/headers/lib/modules/$KVER/build" ]; then
cp -a "/out/staging/headers/lib/modules/$KVER/build" \
"$STAGE/usr/lib/modules/$KVER/build"
fi
# Userspace bits staged by kernel-builder at /out/staging/{etc,usr/local}:
# ps5-stage-firmware.service + ps5-bt-quiet.service + their /usr/local/sbin
# helpers + /etc/modprobe.d/moal.conf + /etc/modules-load.d/moal. Without
# these, moal loads but request_firmware() returns -2 (firmware still on
# ESP, never staged) and there's no boot-time BT phantom-hci cleanup. The
# .deb and .pkg.tar.zst packagers already copy these; this was the missing
# symmetric step on the rpm side.
for d in etc usr/local; do
if [ -d "/out/staging/$d" ]; then
mkdir -p "$STAGE/$d"
cp -a "/out/staging/$d/." "$STAGE/$d/"
fi
done
rpmbuild -bb \
--define "_topdir $RPMROOT/rpmbuild" \
--define "stagedir $STAGE" \
--define "kver $KVER" \
--define "ver $VERSION" \
/linux-ps5.spec
cp "$RPMROOT/rpmbuild/RPMS/x86_64/${PKGNAME}-${VERSION}-1.x86_64.rpm" /out/
echo "==> Done: /out/${PKGNAME}-${VERSION}-1.x86_64.rpm"