about summary refs log tree commit diff
path: root/nixos/modules/installer/cd-dvd
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2019-06-01 21:14:05 -0400
committerSamuel Dionne-Riel <samuel@dionne-riel.com>2019-06-16 17:47:31 -0400
commit53884e1b94efe183ef6d32758a9f7ceee4aa0b19 (patch)
tree278d69d9bca1200cac30c7728d26337b50d13c00 /nixos/modules/installer/cd-dvd
parenta0aff40f6532d1c805e9f66ca5777b51f8a26505 (diff)
downloadnixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.tar
nixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.tar.gz
nixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.tar.bz2
nixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.tar.lz
nixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.tar.xz
nixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.tar.zst
nixlib-53884e1b94efe183ef6d32758a9f7ceee4aa0b19.zip
sd-image: Switch /boot to the ext4 partition
Diffstat (limited to 'nixos/modules/installer/cd-dvd')
-rw-r--r--nixos/modules/installer/cd-dvd/sd-image-aarch64.nix5
-rw-r--r--nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix5
-rw-r--r--nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix5
-rw-r--r--nixos/modules/installer/cd-dvd/sd-image.nix15
4 files changed, 25 insertions, 5 deletions
diff --git a/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix b/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix
index eb0bc9da4099..49008bef834d 100644
--- a/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix
+++ b/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix
@@ -46,7 +46,10 @@ in
         (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
         cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
         cp ${configTxt} firmware/config.txt
-        ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
       '';
+    populateRootCommands = ''
+      mkdir -p ./files/boot
+      ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
+    '';
   };
 }
diff --git a/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix b/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix
index 02587ba4af06..dab092415316 100644
--- a/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix
+++ b/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix
@@ -50,7 +50,10 @@ in
         cp ${pkgs.ubootRaspberryPi2}/u-boot.bin firmware/u-boot-rpi2.bin
         cp ${pkgs.ubootRaspberryPi3_32bit}/u-boot.bin firmware/u-boot-rpi3.bin
         cp ${configTxt} firmware/config.txt
-        ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
       '';
+    populateRootCommands = ''
+      mkdir -p ./files/boot
+      ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
+    '';
   };
 }
diff --git a/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix b/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix
index de3385290d28..cb78bbafecf2 100644
--- a/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix
+++ b/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix
@@ -39,7 +39,10 @@ in
         cp ${pkgs.ubootRaspberryPiZero}/u-boot.bin firmware/u-boot-rpi0.bin
         cp ${pkgs.ubootRaspberryPi}/u-boot.bin firmware/u-boot-rpi1.bin
         cp ${configTxt} firmware/config.txt
-        ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
       '';
+    populateRootCommands = ''
+      mkdir -p ./files/boot
+      ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
+    '';
   };
 }
diff --git a/nixos/modules/installer/cd-dvd/sd-image.nix b/nixos/modules/installer/cd-dvd/sd-image.nix
index 6b5bccfa2e7b..387af9373f44 100644
--- a/nixos/modules/installer/cd-dvd/sd-image.nix
+++ b/nixos/modules/installer/cd-dvd/sd-image.nix
@@ -14,6 +14,7 @@ with lib;
 let
   rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix ({
     inherit (config.sdImage) storePaths;
+    populateImageCommands = config.sdImage.populateRootCommands;
     volumeLabel = "NIXOS_SD";
   } // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
     uuid = config.sdImage.rootPartitionUUID;
@@ -77,6 +78,16 @@ in
         /boot/firmware partition on the SD image.
       '';
     };
+
+    populateRootCommands = mkOption {
+      example = literalExample "''\${extlinux-conf-builder} -t 3 -c \${config.system.build.toplevel} -d ./files/boot''";
+      description = ''
+        Shell commands to populate the ./files directory.
+        All files in that directory are copied to the
+        root (/) partition on the SD image. Use this to
+        populate the ./files/boot (/boot) directory.
+      '';
+    };
   };
 
   config = {
@@ -117,8 +128,8 @@ in
             label: dos
             label-id: ${config.sdImage.firmwarePartitionID}
 
-            start=8M, size=$firmwareSizeBlocks, type=b, bootable
-            start=${toString (8 + config.sdImage.firmwareSize)}M, type=83
+            start=8M, size=$firmwareSizeBlocks, type=b
+            start=${toString (8 + config.sdImage.firmwareSize)}M, type=83, bootable
         EOF
 
         # Copy the rootfs into the SD image