* Use udevtrigger to create device nodes for all known devices.
* Plug and play: load kernel modules for all supported PCI devices automatically. svn path=/nixu/trunk/; revision=6975
This commit is contained in:
parent
8a43fcd57c
commit
da8cec4795
@ -30,19 +30,20 @@ mkdir -p /nix/var/nix/db
|
|||||||
mkdir -p /nix/var/nix/gcroots
|
mkdir -p /nix/var/nix/gcroots
|
||||||
mkdir -p /nix/var/nix/temproots
|
mkdir -p /nix/var/nix/temproots
|
||||||
|
|
||||||
# Create device nodes in /dev.
|
|
||||||
source @makeDevices@
|
|
||||||
|
|
||||||
# Ensure that the module tools can find the kernel modules.
|
# Ensure that the module tools can find the kernel modules.
|
||||||
export MODULE_DIR=@kernel@/lib/modules/
|
export MODULE_DIR=@kernel@/lib/modules/
|
||||||
|
|
||||||
# Additional path for the interactive shell.
|
# Create device nodes in /dev.
|
||||||
for i in @extraPath@; do
|
#source @makeDevices@
|
||||||
PATH=$PATH:$i/bin
|
|
||||||
if test -e $i/sbin; then
|
# Start udev.
|
||||||
PATH=$PATH:$i/sbin
|
udevd --daemon
|
||||||
fi
|
|
||||||
done
|
# Let udev create device nodes for all modules that have already been
|
||||||
|
# loaded into the kernel (or for which support is built into the
|
||||||
|
# kernel).
|
||||||
|
udevtrigger
|
||||||
|
udevsettle # wait for udev to finish
|
||||||
|
|
||||||
# Start syslogd.
|
# Start syslogd.
|
||||||
mkdir -p /var/run
|
mkdir -p /var/run
|
||||||
@ -52,6 +53,12 @@ echo "*.* /dev/tty10" > /etc/syslog.conf
|
|||||||
echo "syslog 514/udp" > /etc/services # required, even if we don't use it
|
echo "syslog 514/udp" > /etc/services # required, even if we don't use it
|
||||||
@sysklogd@/sbin/syslogd &
|
@sysklogd@/sbin/syslogd &
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
done
|
||||||
|
|
||||||
# login/su absolutely need this.
|
# login/su absolutely need this.
|
||||||
touch /etc/login.defs
|
touch /etc/login.defs
|
||||||
|
|
||||||
@ -59,11 +66,6 @@ touch /etc/login.defs
|
|||||||
echo "root::0:0:root:/:@shell@" > /etc/passwd
|
echo "root::0:0:root:/:@shell@" > /etc/passwd
|
||||||
echo "root:*:0" > /etc/group
|
echo "root:*:0" > /etc/group
|
||||||
|
|
||||||
cat > /etc/profile <<EOF
|
|
||||||
export PATH=$PATH
|
|
||||||
export MODULE_DIR=$MODULE_DIR
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Set up inittab.
|
# Set up inittab.
|
||||||
for i in $(seq 1 6); do
|
for i in $(seq 1 6); do
|
||||||
echo "$i:2345:respawn:@mingetty@/sbin/mingetty --noclear tty$i" >> /etc/inittab
|
echo "$i:2345:respawn:@mingetty@/sbin/mingetty --noclear tty$i" >> /etc/inittab
|
||||||
@ -79,6 +81,19 @@ You can log in as \`root'.
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Additional path for the interactive shell.
|
||||||
|
for i in @extraPath@; do
|
||||||
|
PATH=$PATH:$i/bin
|
||||||
|
if test -e $i/sbin; then
|
||||||
|
PATH=$PATH:$i/sbin
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat > /etc/profile <<EOF
|
||||||
|
export PATH=$PATH
|
||||||
|
export MODULE_DIR=$MODULE_DIR
|
||||||
|
EOF
|
||||||
|
|
||||||
# Start an interactive shell.
|
# Start an interactive shell.
|
||||||
#exec @shell@
|
#exec @shell@
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{ genericSubstituter, shell, coreutils
|
{ genericSubstituter, shell, coreutils, findutils
|
||||||
, utillinux, kernel, sysklogd, mingetty
|
, utillinux, kernel, sysklogd, mingetty, udev
|
||||||
|
, module_init_tools
|
||||||
, path ? []
|
, path ? []
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -9,7 +10,10 @@ genericSubstituter {
|
|||||||
inherit shell kernel sysklogd mingetty;
|
inherit shell kernel sysklogd mingetty;
|
||||||
path = [
|
path = [
|
||||||
coreutils
|
coreutils
|
||||||
|
findutils
|
||||||
utillinux
|
utillinux
|
||||||
|
udev
|
||||||
|
module_init_tools
|
||||||
];
|
];
|
||||||
extraPath = path;
|
extraPath = path;
|
||||||
makeDevices = ./make-devices.sh;
|
makeDevices = ./make-devices.sh;
|
||||||
|
@ -63,8 +63,8 @@ rec {
|
|||||||
# The init script of boot stage 2, which is supposed to do
|
# The init script of boot stage 2, which is supposed to do
|
||||||
# everything else to bring up the system.
|
# everything else to bring up the system.
|
||||||
bootStage2 = import ./boot-stage-2.nix {
|
bootStage2 = import ./boot-stage-2.nix {
|
||||||
inherit (pkgs) genericSubstituter coreutils utillinux kernel
|
inherit (pkgs) genericSubstituter coreutils findutils
|
||||||
sysklogd;
|
utillinux kernel sysklogd udev module_init_tools;
|
||||||
shell = pkgs.bash + "/bin/sh";
|
shell = pkgs.bash + "/bin/sh";
|
||||||
|
|
||||||
# Additional stuff; add whatever you want here.
|
# Additional stuff; add whatever you want here.
|
||||||
@ -74,7 +74,6 @@ rec {
|
|||||||
pkgs.cpio
|
pkgs.cpio
|
||||||
pkgs.curl
|
pkgs.curl
|
||||||
pkgs.e2fsprogs
|
pkgs.e2fsprogs
|
||||||
pkgs.findutils
|
|
||||||
pkgs.gnugrep
|
pkgs.gnugrep
|
||||||
pkgs.gnused
|
pkgs.gnused
|
||||||
pkgs.gnutar
|
pkgs.gnutar
|
||||||
@ -82,7 +81,6 @@ rec {
|
|||||||
pkgs.gzip
|
pkgs.gzip
|
||||||
pkgs.iputils
|
pkgs.iputils
|
||||||
pkgs.less
|
pkgs.less
|
||||||
pkgs.module_init_tools
|
|
||||||
pkgs.nano
|
pkgs.nano
|
||||||
pkgs.netcat
|
pkgs.netcat
|
||||||
pkgs.nettools
|
pkgs.nettools
|
||||||
|
Loading…
x
Reference in New Issue
Block a user