2006-11-02 22:48:01 +00:00
|
|
|
# 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).
|
|
|
|
|
2006-12-10 22:29:44 +00:00
|
|
|
{ substituteAll, staticShell, staticTools
|
2006-12-19 22:12:44 +00:00
|
|
|
, module_init_tools, extraUtils, modules, modulesDir
|
2006-11-12 18:48:47 +00:00
|
|
|
|
|
|
|
, # Whether to find root device automatically using its label.
|
|
|
|
autoDetectRootDevice
|
|
|
|
|
|
|
|
, # If not scanning, the root must be specified explicitly.
|
|
|
|
rootDevice
|
|
|
|
|
|
|
|
# If scanning, we need a disk label.
|
|
|
|
, rootLabel
|
2006-11-13 11:41:27 +00:00
|
|
|
|
|
|
|
, # The path of the stage 2 init to call once we've mounted the root
|
|
|
|
# device.
|
|
|
|
stage2Init ? "/init"
|
2006-11-03 00:36:08 +00:00
|
|
|
}:
|
2006-11-02 22:48:01 +00:00
|
|
|
|
2006-12-10 22:29:44 +00:00
|
|
|
substituteAll {
|
2006-11-02 22:48:01 +00:00
|
|
|
src = ./boot-stage-1-init.sh;
|
|
|
|
isExecutable = true;
|
2006-12-19 22:12:44 +00:00
|
|
|
inherit staticShell modules modulesDir;
|
2006-12-11 16:10:23 +00:00
|
|
|
inherit autoDetectRootDevice;
|
|
|
|
rootDevice = if !autoDetectRootDevice then rootDevice else "";
|
|
|
|
rootLabel = if autoDetectRootDevice then rootLabel else "";
|
2006-11-02 22:48:01 +00:00
|
|
|
path = [
|
|
|
|
staticTools
|
2006-11-03 00:36:08 +00:00
|
|
|
module_init_tools
|
2006-11-03 13:35:02 +00:00
|
|
|
extraUtils
|
2006-11-02 22:48:01 +00:00
|
|
|
];
|
2006-11-02 23:58:06 +00:00
|
|
|
makeDevices = ./make-devices.sh;
|
2006-11-13 11:41:27 +00:00
|
|
|
|
|
|
|
# We only want the path of the stage 2 init, we don't want it as a
|
|
|
|
# dependency (since then it the stage 2 init would end up in the
|
|
|
|
# initrd).
|
|
|
|
stage2Init = toString stage2Init; # !!! doesn't work
|
2006-11-02 22:48:01 +00:00
|
|
|
}
|