git.iko.soy/typeable/nixpkgs
on master help sign in
sd-image: Switch /boot to the ext4 partition
commit53884e1b94efe183ef6d32758a9f7ceee4aa0b19 authorSamuel Dionne-Riel <samuel@dionne-riel.com> dateSat 1 Jun 2019, 21:14 (7 years ago) parenta0aff40
4 files changed+25−5
nixos/modules/installer/cd-dvd/sd-image-aarch64.nix+4−1 nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix+4−1 nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix+4−1 nixos/modules/installer/cd-dvd/sd-image.nix+13−2
nixos/modules/installer/cd-dvd/sd-image-aarch64.nix+4−1
@@ -46,7 +46,10 @@ in
4646 (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
4747 cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
4848 cp ${configTxt} firmware/config.txt
49− ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
5049 '';
50+ populateRootCommands = ''
51+ mkdir -p ./files/boot
52+ ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
53+ '';
5154 };
5255}
nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix+4−1
@@ -50,7 +50,10 @@ in
5050 cp ${pkgs.ubootRaspberryPi2}/u-boot.bin firmware/u-boot-rpi2.bin
5151 cp ${pkgs.ubootRaspberryPi3_32bit}/u-boot.bin firmware/u-boot-rpi3.bin
5252 cp ${configTxt} firmware/config.txt
53− ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
5453 '';
54+ populateRootCommands = ''
55+ mkdir -p ./files/boot
56+ ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
57+ '';
5558 };
5659}
nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix+4−1
@@ -39,7 +39,10 @@ in
3939 cp ${pkgs.ubootRaspberryPiZero}/u-boot.bin firmware/u-boot-rpi0.bin
4040 cp ${pkgs.ubootRaspberryPi}/u-boot.bin firmware/u-boot-rpi1.bin
4141 cp ${configTxt} firmware/config.txt
42− ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
4342 '';
43+ populateRootCommands = ''
44+ mkdir -p ./files/boot
45+ ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
46+ '';
4447 };
4548}
nixos/modules/installer/cd-dvd/sd-image.nix+13−2
@@ -14,6 +14,7 @@ with lib;
1414let
1515 rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix ({
1616 inherit (config.sdImage) storePaths;
17+ populateImageCommands = config.sdImage.populateRootCommands;
1718 volumeLabel = "NIXOS_SD";
1819 } // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
1920 uuid = config.sdImage.rootPartitionUUID;
@@ -77,6 +78,16 @@ in
7778 /boot/firmware partition on the SD image.
7879 '';
7980 };
81+
82+ populateRootCommands = mkOption {
83+ example = literalExample "''\${extlinux-conf-builder} -t 3 -c \${config.system.build.toplevel} -d ./files/boot''";
84+ description = ''
85+ Shell commands to populate the ./files directory.
86+ All files in that directory are copied to the
87+ root (/) partition on the SD image. Use this to
88+ populate the ./files/boot (/boot) directory.
89+ '';
90+ };
8091 };
8192
8293 config = {
@@ -117,8 +128,8 @@ in
117128 label: dos
118129 label-id: ${config.sdImage.firmwarePartitionID}
119130
120− start=8M, size=$firmwareSizeBlocks, type=b, bootable
121− start=${toString (8 + config.sdImage.firmwareSize)}M, type=83
131+ start=8M, size=$firmwareSizeBlocks, type=b
132+ start=${toString (8 + config.sdImage.firmwareSize)}M, type=83, bootable
122133 EOF
123134
124135 # Copy the rootfs into the SD image