* Put the PCI module probing in an Upstart task. We now have

more-or-less "asynchronous" booting: the login prompt appears almost
  immediately, before the hardware and the network are started.

svn path=/nixu/trunk/; revision=7082
This commit is contained in:
Eelco Dolstra 2006-11-20 17:28:08 +00:00
parent 962b1df3aa
commit 7bba427e93
6 changed files with 36 additions and 17 deletions

@ -87,9 +87,14 @@ rec {
inherit (pkgs) sysklogd;
})
# Hardware scan; loads modules for PCI devices.
(import ./upstart-jobs/hardware-scan.nix {
inherit (pkgs) kernel module_init_tools;
})
# Network interfaces.
(import ./upstart-jobs/network-interfaces.nix {
inherit (pkgs) nettools kernel;
inherit (pkgs) nettools kernel module_init_tools;
})
# DHCP client.
@ -121,7 +126,7 @@ rec {
# everything else to bring up the system.
bootStage2 = import ./boot-stage-2.nix {
inherit (pkgs) genericSubstituter coreutils findutils
utillinux kernel udev module_init_tools
utillinux kernel udev
upstart;
inherit upstartJobs;
shell = pkgs.bash + "/bin/sh";
@ -140,6 +145,7 @@ rec {
pkgs.gzip
pkgs.iputils
pkgs.less
pkgs.module_init_tools
pkgs.nano
pkgs.netcat
pkgs.nettools

@ -74,14 +74,6 @@ echo "*.* /dev/tty10" > /etc/syslog.conf
echo "syslog 514/udp" > /etc/services # required, even if we don't use it
# Try to load modules for all PCI devices.
for i in /sys/bus/pci/devices/*/modalias; do
echo "Trying to load a module for $(basename $(dirname $i))..."
modprobe $(cat $i)
echo ""
done
# login/su absolutely need this.
test -e /etc/login.defs || touch /etc/login.defs

@ -1,6 +1,5 @@
{ genericSubstituter, shell, coreutils, findutils
, utillinux, kernel, udev
, module_init_tools, upstart
, utillinux, kernel, udev, upstart
, path ? []
, # Whether the root device is root only. If so, we'll mount a
@ -20,7 +19,6 @@ genericSubstituter {
findutils
utillinux
udev
module_init_tools
upstart
];
extraPath = path;

@ -6,7 +6,7 @@
job = "
description \"DHCP client\"
start on network-interfaces
start on network-interfaces/started
stop on network-interfaces/stop
script

@ -0,0 +1,23 @@
# !!! Don't like it that I have to pass the kernel here.
{kernel, module_init_tools}:
{
name = "hardware-scan";
job = "
start on startup
script
export MODULE_DIR=${kernel}/lib/modules/
# Try to load modules for all PCI devices.
for i in /sys/bus/pci/devices/*/modalias; do
echo \"Trying to load a module for $(basename $(dirname $i))...\"
${module_init_tools}/sbin/modprobe $(cat $i) || true
echo \"\"
done
end script
";
}

@ -1,17 +1,17 @@
# !!! Don't like it that I have to pass the kernel here.
{nettools, kernel}:
{nettools, kernel, module_init_tools}:
{
name = "network-interfaces";
job = "
start on startup
start on hardware-scan
stop on shutdown
start script
export MODULE_DIR=${kernel}/lib/modules/
modprobe af_packet
${module_init_tools}/sbin/modprobe af_packet
for i in $(cd /sys/class/net && ls -d *); do
echo \"Bringing up network device $i...\"