about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2021-06-25 22:52:07 +0200
committerGitHub <noreply@github.com>2021-06-25 22:52:07 +0200
commit6845a74d4c85e0a392ee82a829d7fc8c9ecf4f08 (patch)
tree6af963c1803cc2ffb9e33c90b61ef294ddceb2ca /nixos
parent9de5cbca453657b1b9e52b1e5f081e5afe059b92 (diff)
parent1db54a5522a2d523e406ce8713bfe88bb9e3f657 (diff)
Merge pull request #128082 from flokli/sdcard-firmware-partition-offset
nixos/sdcard: make firmware partition offset configurable
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/installer/sd-card/sd-image.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix
index d0fe79903d345..2a10a77300e85 100644
--- a/nixos/modules/installer/sd-card/sd-image.nix
+++ b/nixos/modules/installer/sd-card/sd-image.nix
@@ -55,6 +55,22 @@ in
       '';
     };
 
+    firmwarePartitionOffset = mkOption {
+      type = types.int;
+      default = 8;
+      description = ''
+        Gap in front of the /boot/firmware partition, in mebibytes (1024×1024
+        bytes).
+        Can be increased to make more space for boards requiring to dd u-boot
+        SPL before actual partitions.
+
+        Unless you are building your own images pre-configured with an
+        installed U-Boot, you can instead opt to delete the existing `FIRMWARE`
+        partition, which is used **only** for the Raspberry Pi family of
+        hardware.
+      '';
+    };
+
     firmwarePartitionID = mkOption {
       type = types.str;
       default = "0x2178694e";
@@ -177,7 +193,7 @@ in
         zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
 
         # Gap in front of the first partition, in MiB
-        gap=8
+        gap=${toString config.sdImage.firmwarePartitionOffset}
 
         # Create the image file sized to fit /boot/firmware and /, plus slack for the gap.
         rootSizeBlocks=$(du -B 512 --apparent-size ./root-fs.img | awk '{ print $1 }')