* Create /run in the initrd and bind-mount it into the target root.

This allows Udev to share its database between stage 1 and 2, which
  in turn is expected by the LVM Udev rules.

svn path=/nixos/trunk/; revision=27926
This commit is contained in:
Eelco Dolstra 2011-07-24 23:36:30 +00:00
parent a9f599154a
commit 1e5bd11a53
3 changed files with 21 additions and 12 deletions

View File

@ -54,6 +54,8 @@ mount -t proc none /proc
mkdir -p /sys
mount -t sysfs none /sys
mount -t tmpfs -o "mode=0755,size=@devSize@" none /dev
mkdir -p /run
mount -t tmpfs none /run
# Process the kernel command line.
@ -310,7 +312,10 @@ if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then
fail
fi
mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev
mkdir -m 0755 -p $targetRoot/proc $targetRoot/sys $targetRoot/dev $targetRoot/run
# `switch_root' doesn't move /run yet, so we have to do it ourselves.
mount --bind /run $targetRoot/run
exec switch_root "$targetRoot" "$stage2Init"

View File

@ -98,7 +98,7 @@ mkdir -m 0755 -p /etc/nixos
# Miscellaneous boot time cleanup.
rm -rf /run /var/run /var/lock /var/log/upstart
rm -rf /var/run /var/lock /var/log/upstart
#echo -n "cleaning \`/tmp'..."
#rm -rf --one-file-system /tmp/*
@ -122,9 +122,13 @@ rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots
# Create a tmpfs on /run to hold runtime state for programs such as
# udev.
mkdir -m 0755 -p /run
mount -t tmpfs -o "mode=755" none /run
# udev (if stage 1 hasn't already done so).
if ! mountpoint -q /run; then
rm -rf /run
mkdir -m 0755 -p /run
mount -t tmpfs -o "mode=755" none /run
fi
mkdir -m 0700 -p /run/lock

View File

@ -1,4 +1,4 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
let
@ -36,11 +36,10 @@ let
};
inherit (pkgs) substituteAll writeText coreutils utillinux udev;
kernel = config.boot.kernelPackages.kernel;
activateConfiguration = config.system.activationScripts.script;
bootStage2 = substituteAll {
bootStage2 = pkgs.substituteAll {
src = ./stage-2-init.sh;
isExecutable = true;
inherit kernel;
@ -48,11 +47,12 @@ let
ttyGid = config.ids.gids.tty;
upstart = config.system.build.upstart;
path =
[ coreutils
utillinux
udev
[ pkgs.coreutils
pkgs.utillinux
pkgs.udev
pkgs.sysvtools
];
postBootCommands = writeText "local-cmds"
postBootCommands = pkgs.writeText "local-cmds"
''
${config.boot.postBootCommands}
${config.powerManagement.powerUpCommands}