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

svn path=/nixos/trunk/; revision=23024
This commit is contained in:
Eelco Dolstra 2010-08-07 14:16:18 +00:00
parent 3cab6d3e1c
commit e8e7ee356c
3 changed files with 29 additions and 3 deletions

View File

@ -107,11 +107,22 @@ in
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";

View File

@ -80,6 +80,20 @@ for o in $(cat /proc/cmdline); do
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

View File

@ -130,6 +130,7 @@ let
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