git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #128082 from flokli/sdcard-firmware-partition-offset

nixos/sdcard: make firmware partition offset configurable

commit6845a74d4c85e0a392ee82a829d7fc8c9ecf4f08 authorFlorian Klink <flokli@flokli.de> dateFri 25 Jun 2021, 22:52 (5 years ago) parent9de5cbc1db54a5
1 file changed+17−1
nixos/modules/installer/sd-card/sd-image.nix+17−1
nixos/modules/installer/sd-card/sd-image.nix+17−1
@@ -55,6 +55,22 @@ in
5555 '';
5656 };
5757
58+ firmwarePartitionOffset = mkOption {
59+ type = types.int;
60+ default = 8;
61+ description = ''
62+ Gap in front of the /boot/firmware partition, in mebibytes (1024×1024
63+ bytes).
64+ Can be increased to make more space for boards requiring to dd u-boot
65+ SPL before actual partitions.
66+
67+ Unless you are building your own images pre-configured with an
68+ installed U-Boot, you can instead opt to delete the existing `FIRMWARE`
69+ partition, which is used **only** for the Raspberry Pi family of
70+ hardware.
71+ '';
72+ };
73+
5874 firmwarePartitionID = mkOption {
5975 type = types.str;
6076 default = "0x2178694e";
@@ -177,7 +193,7 @@ in
177193 zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
178194
179195 # Gap in front of the first partition, in MiB
180− gap=8
196+ gap=${toString config.sdImage.firmwarePartitionOffset}
181197
182198 # Create the image file sized to fit /boot/firmware and /, plus slack for the gap.
183199 rootSizeBlocks=$(du -B 512 --apparent-size ./root-fs.img | awk '{ print $1 }')