fix: install our staged init at /init too, not just /sbin/init
The kernel ALWAYS runs /init when booting from an initramfs. If /init doesn't exist, the kernel falls back to the legacy root-mount path (looking for a real root partition via root= cmdline), which we don't want — our system IS the initramfs. Previous fix removed piCore's /init to stop it from being run; that caused the kernel to skip the initramfs entrypoint entirely and panic with 'Cannot open root device' (error -6). Correct fix: replace piCore's /init with a copy of our init.sh. The kernel runs /init -> our staged boot, which is exactly what we want. Keep /sbin/init as well (some boot paths exec it directly, e.g. via init= cmdline override) and the existing init=/sbin/init in grub-arm64.cfg as a belt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -55,14 +55,14 @@ rm -f "$ROOTFS/sbin/init"
|
|||||||
cp "$PROJECT_ROOT/init/init.sh" "$ROOTFS/sbin/init"
|
cp "$PROJECT_ROOT/init/init.sh" "$ROOTFS/sbin/init"
|
||||||
chmod +x "$ROOTFS/sbin/init"
|
chmod +x "$ROOTFS/sbin/init"
|
||||||
|
|
||||||
# Remove piCore/TC's /init at the rootfs root. The kernel's init search order
|
# Replace the upstream /init at the rootfs root with our staged init.
|
||||||
# is /init -> /sbin/init -> ..., so leaving piCore's /init in place causes the
|
# The kernel ALWAYS runs /init when booting from an initramfs (legacy root-mount
|
||||||
# kernel to run that instead of ours, which then segfaults (it tries to do
|
# fallback otherwise). piCore/TC ship their own /init; ours has to take its
|
||||||
# piCore-specific TCE handling on a host that doesn't have it).
|
# place so the kernel runs our staged boot, not piCore's TCE handler.
|
||||||
if [ -e "$ROOTFS/init" ]; then
|
rm -f "$ROOTFS/init"
|
||||||
rm -f "$ROOTFS/init"
|
cp "$PROJECT_ROOT/init/init.sh" "$ROOTFS/init"
|
||||||
echo " Removed upstream /init (kernel will fall through to /sbin/init)"
|
chmod +x "$ROOTFS/init"
|
||||||
fi
|
echo " Installed staged init at /init and /sbin/init"
|
||||||
|
|
||||||
# Init stages
|
# Init stages
|
||||||
mkdir -p "$ROOTFS/usr/lib/kubesolo-os/init.d"
|
mkdir -p "$ROOTFS/usr/lib/kubesolo-os/init.d"
|
||||||
|
|||||||
Reference in New Issue
Block a user