* Use the persistent storage udev rules in the initrd so that we can
use /dev/disk/by-{label,id,...} names for the root FS. * Kill udevd at the end of stage 1. Don't know how it got killed previously... svn path=/nixos/trunk/; revision=12560
This commit is contained in:
parent
1c2d81d93d
commit
b760a4b8d9
@ -92,9 +92,7 @@ echo shutdown > /sys/power/disk
|
|||||||
|
|
||||||
|
|
||||||
# Create device nodes in /dev.
|
# Create device nodes in /dev.
|
||||||
export UDEV_CONFIG_FILE=/udev.conf
|
export UDEV_CONFIG_FILE=@udevConf@
|
||||||
echo 'udev_rules="/rules"' > $UDEV_CONFIG_FILE
|
|
||||||
mkdir /rules
|
|
||||||
udevd --daemon
|
udevd --daemon
|
||||||
udevadm trigger
|
udevadm trigger
|
||||||
udevadm settle
|
udevadm settle
|
||||||
@ -242,6 +240,10 @@ if test -n "@isLiveCD@"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Stop udevd.
|
||||||
|
kill $(minips -C udevd -o pid=)
|
||||||
|
|
||||||
|
|
||||||
if test -n "$debug1mounts"; then fail; fi
|
if test -n "$debug1mounts"; then fail; fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,13 +39,16 @@ rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
udev = pkgsKlibc.udev;
|
||||||
|
|
||||||
|
|
||||||
# Some additional utilities needed in stage 1, notably mount. We
|
# Some additional utilities needed in stage 1, notably mount. We
|
||||||
# don't want to bring in all of util-linux, so we just copy what we
|
# don't want to bring in all of util-linux, so we just copy what we
|
||||||
# need.
|
# need.
|
||||||
extraUtils = pkgs.runCommand "extra-utils"
|
extraUtils = pkgs.runCommand "extra-utils"
|
||||||
{ buildInputs = [pkgs.nukeReferences];
|
{ buildInputs = [pkgs.nukeReferences];
|
||||||
inherit (pkgsStatic) utillinux;
|
inherit (pkgsStatic) utillinux;
|
||||||
inherit (pkgsKlibc) udev;
|
inherit udev;
|
||||||
e2fsprogs = pkgsDiet.e2fsprogs;
|
e2fsprogs = pkgsDiet.e2fsprogs;
|
||||||
devicemapper = if config.boot.initrd.lvm then pkgsStatic.devicemapper else null;
|
devicemapper = if config.boot.initrd.lvm then pkgsStatic.devicemapper else null;
|
||||||
lvm2 = if config.boot.initrd.lvm then pkgsStatic.lvm2 else null;
|
lvm2 = if config.boot.initrd.lvm then pkgsStatic.lvm2 else null;
|
||||||
@ -60,6 +63,7 @@ rec {
|
|||||||
cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin
|
cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin
|
||||||
cp -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin
|
cp -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin
|
||||||
cp $udev/sbin/udevd $udev/sbin/udevadm $out/bin
|
cp $udev/sbin/udevd $udev/sbin/udevadm $out/bin
|
||||||
|
cp $udev/lib/udev/*_id $out/bin
|
||||||
nuke-refs $out/bin/*
|
nuke-refs $out/bin/*
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
@ -71,7 +75,29 @@ rec {
|
|||||||
(fs: fs.mountPoint == "/" || (fs ? neededForBoot && fs.neededForBoot))
|
(fs: fs.mountPoint == "/" || (fs ? neededForBoot && fs.neededForBoot))
|
||||||
config.fileSystems;
|
config.fileSystems;
|
||||||
|
|
||||||
|
|
||||||
|
udevRules = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "udev-rules";
|
||||||
|
buildCommand = ''
|
||||||
|
ensureDir $out
|
||||||
|
cp ${udev}/*/udev/rules.d/60-persistent-storage.rules $out/
|
||||||
|
substituteInPlace $out/60-persistent-storage.rules \
|
||||||
|
--replace ata_id ${extraUtils}/bin/ata_id \
|
||||||
|
--replace usb_id ${extraUtils}/bin/usb_id \
|
||||||
|
--replace scsi_id ${extraUtils}/bin/scsi_id \
|
||||||
|
--replace path_id ${extraUtils}/bin/path_id \
|
||||||
|
--replace vol_id ${extraUtils}/bin/vol_id
|
||||||
|
''; # */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# The udev configuration file for in the initrd.
|
||||||
|
udevConf = pkgs.writeText "udev-initrd.conf" ''
|
||||||
|
udev_rules="${udevRules}"
|
||||||
|
#udev_log="debug"
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
# The init script of boot stage 1 (loading kernel modules for
|
# The init script of boot stage 1 (loading kernel modules for
|
||||||
# mounting the root FS).
|
# mounting the root FS).
|
||||||
bootStage1 = pkgs.substituteAll {
|
bootStage1 = pkgs.substituteAll {
|
||||||
@ -81,7 +107,7 @@ rec {
|
|||||||
|
|
||||||
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
|
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
|
||||||
|
|
||||||
inherit modulesClosure;
|
inherit modulesClosure udevConf;
|
||||||
|
|
||||||
inherit (config.boot) autoDetectRootDevice isLiveCD resumeDevice;
|
inherit (config.boot) autoDetectRootDevice isLiveCD resumeDevice;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ let
|
|||||||
''; # */
|
''; # */
|
||||||
};
|
};
|
||||||
|
|
||||||
# The udev configuration file
|
# The udev configuration file.
|
||||||
conf = writeText "udev.conf" ''
|
conf = writeText "udev.conf" ''
|
||||||
udev_rules="${udevRules}"
|
udev_rules="${udevRules}"
|
||||||
#udev_log="debug"
|
#udev_log="debug"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user