* A minimal boot script for stage 1 of the boot (loading kernel

modules).  The closure of the boot script is all we need in the
  initrd.

svn path=/nixu/trunk/; revision=6929
This commit is contained in:
Eelco Dolstra 2006-11-02 22:48:01 +00:00
parent 3336325781
commit 2d31e1b6d6
4 changed files with 54 additions and 6 deletions

17
test/boot-stage-1-init.sh Normal file
View file

@ -0,0 +1,17 @@
#! @shell@
# Print a greeting.
cat <<EOF
<<< NixOS Stage 1 >>>
EOF
# Set the PATH.
export PATH=/empty
for i in @path@; do
PATH=$PATH:$i/bin
done
# Start an interactive shell.
exec @shell@

16
test/boot-stage-1.nix Normal file
View file

@ -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
];
}

View file

@ -3,4 +3,4 @@ prompt 1
timeout 60
label linux
kernel vmlinuz
append initrd=initrd
append initrd=initrd selinux=0 apm=on acpi=on

View file

@ -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";