diff --git a/build/scripts/inject-kubesolo.sh b/build/scripts/inject-kubesolo.sh index 3aa8550..ce30071 100755 --- a/build/scripts/inject-kubesolo.sh +++ b/build/scripts/inject-kubesolo.sh @@ -55,14 +55,14 @@ rm -f "$ROOTFS/sbin/init" cp "$PROJECT_ROOT/init/init.sh" "$ROOTFS/sbin/init" chmod +x "$ROOTFS/sbin/init" -# Remove piCore/TC's /init at the rootfs root. The kernel's init search order -# is /init -> /sbin/init -> ..., so leaving piCore's /init in place causes the -# kernel to run that instead of ours, which then segfaults (it tries to do -# piCore-specific TCE handling on a host that doesn't have it). -if [ -e "$ROOTFS/init" ]; then - rm -f "$ROOTFS/init" - echo " Removed upstream /init (kernel will fall through to /sbin/init)" -fi +# Replace the upstream /init at the rootfs root with our staged init. +# The kernel ALWAYS runs /init when booting from an initramfs (legacy root-mount +# fallback otherwise). piCore/TC ship their own /init; ours has to take its +# place so the kernel runs our staged boot, not piCore's TCE handler. +rm -f "$ROOTFS/init" +cp "$PROJECT_ROOT/init/init.sh" "$ROOTFS/init" +chmod +x "$ROOTFS/init" +echo " Installed staged init at /init and /sbin/init" # Init stages mkdir -p "$ROOTFS/usr/lib/kubesolo-os/init.d"