From 39796e26b4820197ca54eea2d579d992dd416cc3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 9 Jan 2010 15:13:06 +0000 Subject: [PATCH] * Removed the boot.isLiveCD option. Moved the code for mounting a tmpfs on top of the CD to iso-image.nix. svn path=/nixos/trunk/; revision=19318 --- modules/installer/cd-dvd/iso-image.nix | 21 ++++++++++++++++----- modules/system/boot/stage-1-init.sh | 16 ---------------- modules/system/boot/stage-1.nix | 12 +----------- 3 files changed, 17 insertions(+), 32 deletions(-) diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index e97b3a51cdca..3135fa2cda4c 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -131,11 +131,22 @@ in boot.initrd.availableKernelModules = [ "aufs" "squashfs" "iso9660" ]; boot.initrd.kernelModules = [ "loop" ]; - - # Tell stage 1 of the boot to mount a tmpfs on top of the CD using - # AUFS. !!! It would be nicer to make the stage 1 init pluggable - # and move that bit of code here. - boot.isLiveCD = true; + + # In stage 1, mount a tmpfs on top of / (the ISO image) and + # /nix/store (the squashfs image) to make this a live CD. + boot.initrd.postMountCommands = + '' + mkdir /mnt-root-tmpfs + mount -t tmpfs -o "mode=755" none /mnt-root-tmpfs + mkdir /mnt-root-union + mount -t aufs -o dirs=/mnt-root-tmpfs=rw:$targetRoot=ro none /mnt-root-union + targetRoot=/mnt-root-union + + mkdir /mnt-store-tmpfs + mount -t tmpfs -o "mode=755" none /mnt-store-tmpfs + mkdir -p $targetRoot/nix/store + mount -t aufs -o dirs=/mnt-store-tmpfs=rw:/mnt-root/nix/store=ro none /mnt-root-union/nix/store + ''; # AUFS 2 support (currently unused). /* diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 19478f7c400b..e74e363c83dd 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -272,22 +272,6 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do done -# If this is a live-CD/DVD, then union-mount a tmpfs on top of the -# original root. -if test -n "@isLiveCD@"; then - mkdir /mnt-root-tmpfs - mount -t tmpfs -o "mode=755" none /mnt-root-tmpfs - mkdir /mnt-root-union - mount -t aufs -o dirs=/mnt-root-tmpfs=rw:$targetRoot=ro none /mnt-root-union - targetRoot=/mnt-root-union - - mkdir /mnt-store-tmpfs - mount -t tmpfs -o "mode=755" none /mnt-store-tmpfs - mkdir -p $targetRoot/nix/store - mount -t aufs -o dirs=/mnt-store-tmpfs=rw:/mnt-root/nix/store=ro none /mnt-root-union/nix/store -fi - - @postMountCommands@ diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index a62f79aab155..4f24783b5c6b 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -11,16 +11,6 @@ let options = { - boot.isLiveCD = mkOption { - default = false; - description = " - If set to true, the root device will be mounted read-only and - a ramdisk will be mounted on top of it using unionfs to - provide a writable root. This is used for the NixOS - Live-CD/DVD. - "; - }; - boot.resumeDevice = mkOption { default = ""; example = "0:0"; @@ -277,7 +267,7 @@ let inherit udevConf extraUtils; - inherit (config.boot) isLiveCD resumeDevice; + inherit (config.boot) resumeDevice; inherit (config.boot.initrd) checkJournalingFS postDeviceCommands postMountCommands kernelModules;