diff --git a/test/README b/test/README index 701faaf22fa9..e2f76b08301b 100644 --- a/test/README +++ b/test/README @@ -1,3 +1,8 @@ +To get a Stage 1 shell: + +Add "debug1" to the kernel command line. + + Switching to maintenance mode: $ shutdown now diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh index 3e93571ebdaf..3d115760e06b 100644 --- a/test/boot-stage-1-init.sh +++ b/test/boot-stage-1-init.sh @@ -32,6 +32,25 @@ mkdir /sys mount -t sysfs none /sys +# Process the kernel command line. +stage2Init=@stage2Init@ +for o in $(cat /proc/cmdline); do + case $o in + init=*) + set -- $(IFS==; echo $o) + stage2Init=$2 + ;; + debugtrace) + # Show each command. + set -x + ;; + debug1) + fail + ;; + esac +done + + # Create device nodes in /dev. source @makeDevices@ @@ -85,6 +104,7 @@ else fi + # Start stage 2. # !!! Note: we can't use pivot_root here (the kernel gods have # decreed), but we could use run-init from klibc, which deletes all @@ -94,6 +114,10 @@ mount --move . / umount /proc # cleanup umount /sys -exec chroot . @stage2Init@ +echo "INIT = $stage2Init" + +if test -z "$stage2Init"; then fail; fi + +exec chroot . $stage2Init fail diff --git a/test/system-configuration.nix b/test/system-configuration.nix index 8675cf5d71b3..b357683f4464 100644 --- a/test/system-configuration.nix +++ b/test/system-configuration.nix @@ -11,7 +11,7 @@ let bootEnv = import ./boot-environment.nix { autoDetectRootDevice = false; inherit rootDevice; - stage2Init = "/init"; # !!! should be bootEnv.bootStage2; + stage2Init = ""; # Passed on the command line via Grub. readOnlyRoot = false; }; diff --git a/test/system-configuration.sh b/test/system-configuration.sh index 653774cc5ccc..4a803d81e4bd 100644 --- a/test/system-configuration.sh +++ b/test/system-configuration.sh @@ -6,9 +6,8 @@ ln -s $kernel $out/kernel ln -s $grub $out/grub cat > $out/menu.lst << GRUBEND -title NixOS - kernel $kernel selinux=0 apm=on acpi=on - initrd $initrd +kernel $kernel selinux=0 apm=on acpi=on init=$bootStage2 +initrd $initrd GRUBEND ensureDir $out/bin @@ -20,7 +19,6 @@ export PATH=$coreutils/bin:$gnused/bin:$gnugrep/bin:$diffutils/bin if test -n "$grubDevice"; then $grubMenuBuilder $out $grub/sbin/grub-install "$grubDevice" --no-floppy --recheck - ln -sf $bootStage2 /init # !!! fix? fi EOF