* Option boot.doHardwareScan to disable the hardware scan. Also, if
the flag "safemode" is specified on the kernel command line, also disable the hardware scan. * Option boot.kernelModules to specify a set of modules to be loaded in stage 2 (in addition to the initrd modules in boot.initrd.kernelModules). svn path=/nixos/trunk/; revision=7466
This commit is contained in:
parent
75e1652f05
commit
f25ce41c18
@ -59,6 +59,9 @@ for o in $(cat /proc/cmdline); do
|
|||||||
# !!! argh, can't pass a startup event to Upstart yet.
|
# !!! argh, can't pass a startup event to Upstart yet.
|
||||||
exec @shell@
|
exec @shell@
|
||||||
;;
|
;;
|
||||||
|
safemode)
|
||||||
|
safeMode=1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -75,6 +78,10 @@ needWritableDir /root 0700
|
|||||||
# Miscellaneous boot time cleanup.
|
# Miscellaneous boot time cleanup.
|
||||||
rm -rf /var/run
|
rm -rf /var/run
|
||||||
|
|
||||||
|
if test -n "$safeMode"; then
|
||||||
|
touch /var/run/safemode
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Create the minimal device nodes needed before we run udev.
|
# Create the minimal device nodes needed before we run udev.
|
||||||
mknod -m 0666 /dev/null c 1 3
|
mknod -m 0666 /dev/null c 1 3
|
||||||
|
@ -84,6 +84,33 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name = ["boot" "hardwareScan"];
|
||||||
|
default = true;
|
||||||
|
description = "
|
||||||
|
Whether to try to load kernel modules for all detected hardware.
|
||||||
|
Usually this does a good job of providing you with the modules
|
||||||
|
you need, but sometimes it can crash the system or cause other
|
||||||
|
nasty effects. If the hardware scan is turned on, it can be
|
||||||
|
disabled at boot time by adding the <literal>safemode</literal>
|
||||||
|
parameter to the kernel command line.
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name = ["boot" "kernelModules"];
|
||||||
|
default = [];
|
||||||
|
description = "
|
||||||
|
The set of kernel modules to be loaded in the second stage of
|
||||||
|
the boot process. That is, these modules are not included in
|
||||||
|
the initial ramdisk, so they'd better not be required for
|
||||||
|
mounting the root file system. Add them to
|
||||||
|
<option>boot.initrd.extraKernelModules</options> if they are.
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["boot" "initrd" "kernelModules"];
|
name = ["boot" "initrd" "kernelModules"];
|
||||||
default = ["ide-cd" "ide-disk" "ide-generic" "ext3"];
|
default = ["ide-cd" "ide-disk" "ide-generic" "ext3"];
|
||||||
@ -106,7 +133,10 @@
|
|||||||
name = ["boot" "initrd" "extraKernelModules"];
|
name = ["boot" "initrd" "extraKernelModules"];
|
||||||
default = [];
|
default = [];
|
||||||
description = "
|
description = "
|
||||||
Additional kernel modules for the initial ramdisk.
|
Additional kernel modules for the initial ramdisk. These are
|
||||||
|
loaded before the modules listed in
|
||||||
|
<option>boot.initrd.kernelModules</options>, so they take
|
||||||
|
precedence.
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ rec {
|
|||||||
|
|
||||||
|
|
||||||
rootModules =
|
rootModules =
|
||||||
(config.get ["boot" "initrd" "kernelModules"]) ++
|
(config.get ["boot" "initrd" "extraKernelModules"]) ++
|
||||||
(config.get ["boot" "initrd" "extraKernelModules"]);
|
(config.get ["boot" "initrd" "kernelModules"]);
|
||||||
|
|
||||||
|
|
||||||
# Determine the set of modules that we need to mount the root FS.
|
# Determine the set of modules that we need to mount the root FS.
|
||||||
|
@ -29,6 +29,8 @@ import ../upstart-jobs/gather.nix {
|
|||||||
# Hardware scan; loads modules for PCI devices.
|
# Hardware scan; loads modules for PCI devices.
|
||||||
(import ../upstart-jobs/hardware-scan.nix {
|
(import ../upstart-jobs/hardware-scan.nix {
|
||||||
inherit (pkgs) kernel module_init_tools;
|
inherit (pkgs) kernel module_init_tools;
|
||||||
|
doHardwareScan = config.get ["boot" "hardwareScan"];
|
||||||
|
kernelModules = config.get ["boot" "kernelModules"];
|
||||||
})
|
})
|
||||||
|
|
||||||
# Mount file systems.
|
# Mount file systems.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# !!! Don't like it that I have to pass the kernel here.
|
# !!! Don't like it that I have to pass the kernel here.
|
||||||
{kernel, module_init_tools}:
|
{kernel, module_init_tools, doHardwareScan, kernelModules}:
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "hardware-scan";
|
name = "hardware-scan";
|
||||||
@ -10,12 +10,21 @@ start on udev
|
|||||||
script
|
script
|
||||||
export MODULE_DIR=${kernel}/lib/modules/
|
export MODULE_DIR=${kernel}/lib/modules/
|
||||||
|
|
||||||
|
for i in ${toString kernelModules}; do
|
||||||
|
echo \"Loading kernel module $i...\"
|
||||||
|
${module_init_tools}/sbin/modprobe $i || true
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -n \"${toString doHardwareScan}\" -a ! -e /var/run/safemode; then
|
||||||
|
|
||||||
# Try to load modules for all PCI devices.
|
# Try to load modules for all PCI devices.
|
||||||
for i in /sys/bus/pci/devices/*/modalias; do
|
for i in /sys/bus/pci/devices/*/modalias; do
|
||||||
echo \"Trying to load a module for $(basename $(dirname $i))...\"
|
echo \"Trying to load a module for $(basename $(dirname $i))...\"
|
||||||
${module_init_tools}/sbin/modprobe $(cat $i) || true
|
${module_init_tools}/sbin/modprobe $(cat $i) || true
|
||||||
echo \"\"
|
echo \"\"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
end script
|
end script
|
||||||
|
|
||||||
";
|
";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user