Author: eelco
Date: Mon Sep 13 22:10:25 2010
New Revision: 23775
URL: https://svn.nixos.org/websvn/nix/?rev=23775&sc=1
Log:
* Substitute the path of the system derivation directly in the stage 2
init script. This removes the need for the `systemConfig' boot
parameter; `init=<stage-2-init>' is enough. However, the GRUB menu
builder still needs to add `systemConfig' to the kernel command line
for compatibility with old configurations.
Modified:
nixos/trunk/modules/installer/cd-dvd/iso-image.nix
nixos/trunk/modules/installer/cd-dvd/system-tarball.nix
nixos/trunk/modules/system/activation/top-level.nix
nixos/trunk/modules/system/boot/stage-2-init.sh
nixos/trunk/modules/virtualisation/qemu-vm.nix
Modified: nixos/trunk/modules/installer/cd-dvd/iso-image.nix
==============================================================================
--- nixos/trunk/modules/installer/cd-dvd/iso-image.nix Mon Sep 13 21:16:10
2010 (r23774)
+++ nixos/trunk/modules/installer/cd-dvd/iso-image.nix Mon Sep 13 22:10:25
2010 (r23775)
@@ -174,11 +174,9 @@
# Closures to be copied to the Nix store on the CD, namely the init
# script and the top-level system configuration directory.
isoImage.storeContents =
- [ config.system.build.bootStage2
- config.system.build.toplevel
- ] ++
- (optional config.isoImage.includeSystemBuildDependencies
- config.system.build.toplevel.drvPath);
+ [ config.system.build.toplevel ] ++
+ optional config.isoImage.includeSystemBuildDependencies
+ config.system.build.toplevel.drvPath;
# Create the squashfs image that contains the Nix store.
system.build.squashfsStore = import ../../../lib/make-squashfs.nix {
@@ -220,7 +218,7 @@
boot.loader.grub.extraEntries =
''
menuentry "NixOS Installer / Rescue" {
- linux /boot/bzImage init=${config.system.build.bootStage2}
systemConfig=${config.system.build.toplevel} ${toString
config.boot.kernelParams}
+ linux /boot/bzImage init=${config.system.build.toplevel}/init
${toString config.boot.kernelParams}
initrd /boot/initrd
}
Modified: nixos/trunk/modules/installer/cd-dvd/system-tarball.nix
==============================================================================
--- nixos/trunk/modules/installer/cd-dvd/system-tarball.nix Mon Sep 13
21:16:10 2010 (r23774)
+++ nixos/trunk/modules/installer/cd-dvd/system-tarball.nix Mon Sep 13
22:10:25 2010 (r23775)
@@ -34,8 +34,7 @@
# A clue for the uboot loading
ubootKernelParams = pkgs.writeText "uboot-kernel-params.txt" ''
Kernel Parameters:
- init=${config.system.build.bootStage2}
- systemConfig=${config.system.build.toplevel}
+ init=${config.system.build.toplevel}/init
${toString config.boot.kernelParams}
'';
@@ -70,12 +69,7 @@
# Closures to be copied to the Nix store on the CD, namely the init
# script and the top-level system configuration directory.
tarball.storeContents =
- [ {
- object = config.system.build.bootStage2;
- symlink = "none";
- }
- {
- object = config.system.build.toplevel;
+ [ { object = config.system.build.toplevel;
symlink = "/var/run/current-system";
}
];
Modified: nixos/trunk/modules/system/activation/top-level.nix
==============================================================================
--- nixos/trunk/modules/system/activation/top-level.nix Mon Sep 13 21:16:10
2010 (r23774)
+++ nixos/trunk/modules/system/activation/top-level.nix Mon Sep 13 22:10:25
2010 (r23775)
@@ -103,13 +103,15 @@
ln -s $grub $out/grub
fi
- ln -s ${config.system.build.bootStage2} $out/init
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
echo "$activationScript" > $out/activate
substituteInPlace $out/activate --subst-var out
chmod u+x $out/activate
unset activationScript
+
+ cp ${config.system.build.bootStage2} $out/init
+ substituteInPlace $out/init --subst-var-by systemConfig $out
ln -s ${config.system.build.etc}/etc $out/etc
ln -s ${config.system.path} $out/sw
Modified: nixos/trunk/modules/system/boot/stage-2-init.sh
==============================================================================
--- nixos/trunk/modules/system/boot/stage-2-init.sh Mon Sep 13 21:16:10
2010 (r23774)
+++ nixos/trunk/modules/system/boot/stage-2-init.sh Mon Sep 13 22:10:25
2010 (r23775)
@@ -1,6 +1,6 @@
#! @shell@
-# !!! copied from stage 1; remove duplication
+systemconf...@systemconfig@
# Print a greeting.
@@ -56,11 +56,6 @@
cat /proc/mounts > /etc/mtab
-# If no `systemConfig' parameter is specified on the kernel command
-# line, use a fallback.
-systemConfig=/nix/var/nix/profiles/system
-
-
# Process the kernel command line.
for o in $(cat /proc/cmdline); do
case $o in
@@ -79,10 +74,6 @@
safemode)
safeMode=1
;;
- systemConfig=*)
- set -- $(IFS==; echo $o)
- systemConfig=$2
- ;;
resume=*)
set -- $(IFS==; echo $o)
resumeDevice=$2
@@ -90,8 +81,6 @@
esac
done
-systemConfig="$(readlink -f "$systemConfig")"
-
# More special file systems, initialise required directories.
mkdir -m 0777 /dev/shm
@@ -153,19 +142,16 @@
# Run the script that performs all configuration activation that does
# not have to be done at boot time.
echo "running activation script..."
-"$systemConfig"/activate
+$systemConfig/activate
# Record the boot configuration.
-if test -n "$systemConfig"; then
- ln -sfn "$systemConfig" /var/run/booted-system
+ln -sfn "$systemConfig" /var/run/booted-system
- # Prevent the booted system form being garbage-collected
- # If it weren't a gcroot, if we were running a different kernel,
- # switched system, and garbage collected all, we could not load
- # kernel modules anymore.
- ln -sfn /var/run/booted-system /nix/var/nix/gcroots/booted-system
-fi
+# Prevent the booted system form being garbage-collected If it weren't
+# a gcroot, if we were running a different kernel, switched system,
+# and garbage collected all, we could not load kernel modules anymore.
+ln -sfn /var/run/booted-system /nix/var/nix/gcroots/booted-system
# Ensure that the module tools can find the kernel modules.
Modified: nixos/trunk/modules/virtualisation/qemu-vm.nix
==============================================================================
--- nixos/trunk/modules/virtualisation/qemu-vm.nix Mon Sep 13 21:16:10
2010 (r23774)
+++ nixos/trunk/modules/virtualisation/qemu-vm.nix Mon Sep 13 22:10:25
2010 (r23775)
@@ -167,7 +167,7 @@
-drive
file=$NIX_DISK_IMAGE,if=virtio,boot=on,cache=writeback,werror=report \
-kernel ${config.system.build.toplevel}/kernel \
-initrd ${config.system.build.toplevel}/initrd \
- -append "$(cat ${config.system.build.toplevel}/kernel-params)
init=${config.system.build.bootStage2}
systemConfig=${config.system.build.toplevel} regInfo=${regInfo}
${kernelConsole} $QEMU_KERNEL_PARAMS" \
+ -append "$(cat ${config.system.build.toplevel}/kernel-params)
init=${config.system.build.toplevel}/init regInfo=${regInfo} ${kernelConsole}
$QEMU_KERNEL_PARAMS" \
''} \
${qemuGraphics} \
$QEMU_OPTS \
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits