forked from mirrors/nixpkgs
* 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/temproots
|
||||
|
||||
# Create device nodes in /dev.
|
||||
source @makeDevices@
|
||||
|
||||
# Ensure that the module tools can find the kernel modules.
|
||||
export MODULE_DIR=@kernel@/lib/modules/
|
||||
|
||||
# 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
|
||||
# Create device nodes in /dev.
|
||||
#source @makeDevices@
|
||||
|
||||
# Start udev.
|
||||
udevd --daemon
|
||||
|
||||
# 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.
|
||||
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
|
||||
@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.
|
||||
touch /etc/login.defs
|
||||
|
||||
|
@ -59,11 +66,6 @@ touch /etc/login.defs
|
|||
echo "root::0:0:root:/:@shell@" > /etc/passwd
|
||||
echo "root:*:0" > /etc/group
|
||||
|
||||
cat > /etc/profile <<EOF
|
||||
export PATH=$PATH
|
||||
export MODULE_DIR=$MODULE_DIR
|
||||
EOF
|
||||
|
||||
# Set up inittab.
|
||||
for i in $(seq 1 6); do
|
||||
echo "$i:2345:respawn:@mingetty@/sbin/mingetty --noclear tty$i" >> /etc/inittab
|
||||
|
@ -79,6 +81,19 @@ You can log in as \`root'.
|
|||
|
||||
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.
|
||||
#exec @shell@
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ genericSubstituter, shell, coreutils
|
||||
, utillinux, kernel, sysklogd, mingetty
|
||||
{ genericSubstituter, shell, coreutils, findutils
|
||||
, utillinux, kernel, sysklogd, mingetty, udev
|
||||
, module_init_tools
|
||||
, path ? []
|
||||
}:
|
||||
|
||||
|
@ -9,7 +10,10 @@ genericSubstituter {
|
|||
inherit shell kernel sysklogd mingetty;
|
||||
path = [
|
||||
coreutils
|
||||
findutils
|
||||
utillinux
|
||||
udev
|
||||
module_init_tools
|
||||
];
|
||||
extraPath = path;
|
||||
makeDevices = ./make-devices.sh;
|
||||
|
|
|
@ -63,8 +63,8 @@ rec {
|
|||
# The init script of boot stage 2, which is supposed to do
|
||||
# everything else to bring up the system.
|
||||
bootStage2 = import ./boot-stage-2.nix {
|
||||
inherit (pkgs) genericSubstituter coreutils utillinux kernel
|
||||
sysklogd;
|
||||
inherit (pkgs) genericSubstituter coreutils findutils
|
||||
utillinux kernel sysklogd udev module_init_tools;
|
||||
shell = pkgs.bash + "/bin/sh";
|
||||
|
||||
# Additional stuff; add whatever you want here.
|
||||
|
@ -74,7 +74,6 @@ rec {
|
|||
pkgs.cpio
|
||||
pkgs.curl
|
||||
pkgs.e2fsprogs
|
||||
pkgs.findutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
pkgs.gnutar
|
||||
|
@ -82,7 +81,6 @@ rec {
|
|||
pkgs.gzip
|
||||
pkgs.iputils
|
||||
pkgs.less
|
||||
pkgs.module_init_tools
|
||||
pkgs.nano
|
||||
pkgs.netcat
|
||||
pkgs.nettools
|
||||
|
|
Loading…
Reference in a new issue