diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh new file mode 100644 index 00000000000..da5d4e56f76 --- /dev/null +++ b/test/boot-stage-1-init.sh @@ -0,0 +1,17 @@ +#! @shell@ + +# Print a greeting. +cat <>> + +EOF + +# Set the PATH. +export PATH=/empty +for i in @path@; do + PATH=$PATH:$i/bin +done + +# Start an interactive shell. +exec @shell@ diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix new file mode 100644 index 00000000000..da053a9e6c9 --- /dev/null +++ b/test/boot-stage-1.nix @@ -0,0 +1,16 @@ +# This Nix expression builds the script that performs the first stage +# of booting the system: it loads the modules necessary to mount the +# root file system, then calls /init in the root file system to start +# the second boot stage. The closure of the result of this expression +# is supposed to be put into an initial RAM disk (initrd). + +{genericSubstituter, shell, staticTools}: + +genericSubstituter { + src = ./boot-stage-1-init.sh; + isExecutable = true; + inherit shell; + path = [ + staticTools + ]; +} diff --git a/test/isolinux.cfg b/test/isolinux.cfg index be947a949f7..ff19e84c098 100644 --- a/test/isolinux.cfg +++ b/test/isolinux.cfg @@ -3,4 +3,4 @@ prompt 1 timeout 60 label linux kernel vmlinuz - append initrd=initrd + append initrd=initrd selinux=0 apm=on acpi=on diff --git a/test/rescue-system.nix b/test/rescue-system.nix index f652e429b77..994723eef1f 100644 --- a/test/rescue-system.nix +++ b/test/rescue-system.nix @@ -2,6 +2,10 @@ rec { pkgs = import ./pkgs/top-level/all-packages.nix {}; + pkgsDiet = import ./pkgs/top-level/all-packages.nix { + bootStdenv = pkgs.useDietLibC pkgs.stdenv; + }; + stdenvLinuxStuff = import ./pkgs/stdenv/linux { system = pkgs.stdenv.system; allPackages = import ./pkgs/top-level/all-packages.nix; @@ -9,16 +13,27 @@ rec { bash = pkgs.bash; + + # The init script of boot stage 1 (loading kernel modules for + # mounting the root FS). + bootStage1 = import ./boot-stage-1.nix { + inherit (pkgs) genericSubstituter; + shell = stdenvLinuxStuff.bootstrapTools.bash; + staticTools = stdenvLinuxStuff.staticTools; + }; + + # The closure of the init script of boot stage 1 is what we put in + # the initial RAM disk. initialRamdisk = import ./make-initrd.nix { inherit (pkgs) stdenv cpio; - packages = [ - stdenvLinuxStuff.staticTools - ]; - init = stdenvLinuxStuff.bootstrapTools.bash; + packages = []; + init = bootStage1; }; - + + # Create an ISO image containing the isolinux boot loader, the + # kernel, and initrd produced above. rescueCD = import ./make-iso9660-image.nix { inherit (pkgs) stdenv cdrtools; isoName = "nixos.iso";