Author: eelco
Date: Sun Jul 24 23:36:30 2011
New Revision: 27926
URL: https://svn.nixos.org/websvn/nix/?rev=27926&sc=1

Log:
* 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.

Modified:
   nixos/trunk/modules/system/boot/stage-1-init.sh
   nixos/trunk/modules/system/boot/stage-2-init.sh
   nixos/trunk/modules/system/boot/stage-2.nix

Modified: nixos/trunk/modules/system/boot/stage-1-init.sh
==============================================================================
--- nixos/trunk/modules/system/boot/stage-1-init.sh     Sun Jul 24 22:07:58 
2011        (r27925)
+++ nixos/trunk/modules/system/boot/stage-1-init.sh     Sun Jul 24 23:36:30 
2011        (r27926)
@@ -54,6 +54,8 @@
 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 @@
     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"
 

Modified: nixos/trunk/modules/system/boot/stage-2-init.sh
==============================================================================
--- nixos/trunk/modules/system/boot/stage-2-init.sh     Sun Jul 24 22:07:58 
2011        (r27925)
+++ nixos/trunk/modules/system/boot/stage-2-init.sh     Sun Jul 24 23:36:30 
2011        (r27926)
@@ -98,7 +98,7 @@
 
 
 # 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 @@
 
 
 # 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
 
 

Modified: nixos/trunk/modules/system/boot/stage-2.nix
==============================================================================
--- nixos/trunk/modules/system/boot/stage-2.nix Sun Jul 24 22:07:58 2011        
(r27925)
+++ nixos/trunk/modules/system/boot/stage-2.nix Sun Jul 24 23:36:30 2011        
(r27926)
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{ config, pkgs, ... }:
 
 let
 
@@ -36,11 +36,10 @@
 
   };
 
-  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 @@
     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}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to