Author: eelco
Date: Sat Aug 7 14:16:18 2010
New Revision: 23024
URL: https://svn.nixos.org/websvn/nix/?rev=23024&sc=1
Log:
* In the installation CD, pass the label of the CD through the
root=... kernel command line parameter, instead of hard-coding it in
`fileSystems'. This is to allow CD-to-USB converters such as
UNetbootin to rewrite the kernel command line to the label or UUID
of the USB stick.
Modified:
nixos/trunk/modules/installer/cd-dvd/iso-image.nix
nixos/trunk/modules/system/boot/stage-1-init.sh
nixos/trunk/modules/system/boot/stage-1.nix
Modified: nixos/trunk/modules/installer/cd-dvd/iso-image.nix
==============================================================================
--- nixos/trunk/modules/installer/cd-dvd/iso-image.nix Sat Aug 7 12:46:18
2010 (r23023)
+++ nixos/trunk/modules/installer/cd-dvd/iso-image.nix Sat Aug 7 14:16:18
2010 (r23024)
@@ -107,11 +107,22 @@
system.boot.loader.kernelFile = "bzImage";
environment.systemPackages = [ pkgs.grub2 ];
- # In stage 1 of the boot, mount the CD/DVD as the root FS by label
- # so that we don't need to know its device.
+ # In stage 1 of the boot, mount the CD as the root FS by label so
+ # that we don't need to know its device. We pass the label of the
+ # root filesystem on the kernel command line, rather than in
+ # `fileSystems' below. This allows CD-to-USB converters such as
+ # UNetbootin to rewrite the kernel command line to pass the label or
+ # UUID of the USB stick. It would be nicer to write
+ # `root=/dev/disk/by-label/...' here, but UNetbootin doesn't
+ # recognise that.
+ boot.kernelParams = [ "root=LABEL=${config.isoImage.volumeID}" ];
+
+ # Note that /dev/root is a symlink to the actual root device
+ # specified on the kernel command line, created in the stage 1 init
+ # script.
fileSystems =
[ { mountPoint = "/";
- label = config.isoImage.volumeID;
+ device = "/dev/root";
}
{ mountPoint = "/nix/store";
fsType = "squashfs";
Modified: nixos/trunk/modules/system/boot/stage-1-init.sh
==============================================================================
--- nixos/trunk/modules/system/boot/stage-1-init.sh Sat Aug 7 12:46:18
2010 (r23023)
+++ nixos/trunk/modules/system/boot/stage-1-init.sh Sat Aug 7 14:16:18
2010 (r23024)
@@ -80,6 +80,20 @@
stage1panic)
panicOnFail=1
;;
+ root=*)
+ # If a root device is specified on the kernel command
+ # line, make it available through the symlink /dev/root.
+ # Recognise LABEL= and UUID= to support UNetbootin.
+ set -- $(IFS==; echo $o)
+ if [ $2 = "LABEL" ]; then
+ root="/dev/disk/by-label/$3"
+ elif [ $2 = "UUID" ]; then
+ root="/dev/disk/by-uuid/$3"
+ else
+ root=$2
+ fi
+ ln -s "$root" /dev/root
+ ;;
esac
done
Modified: nixos/trunk/modules/system/boot/stage-1.nix
==============================================================================
--- nixos/trunk/modules/system/boot/stage-1.nix Sat Aug 7 12:46:18 2010
(r23023)
+++ nixos/trunk/modules/system/boot/stage-1.nix Sat Aug 7 14:16:18 2010
(r23024)
@@ -130,6 +130,7 @@
cp -v ${pkgs.coreutils}/bin/cat $out/bin
cp -v ${pkgs.coreutils}/bin/chroot $out/bin
cp -v ${pkgs.coreutils}/bin/sleep $out/bin
+ cp -v ${pkgs.coreutils}/bin/ln $out/bin
# Copy e2fsck and friends.
cp -v ${pkgs.e2fsprogs}/sbin/e2fsck $out/bin
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits