diff options
author | Florian Klink <flokli@flokli.de> | 2021-06-25 11:35:25 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2021-06-25 22:33:42 +0200 |
commit | 1db54a5522a2d523e406ce8713bfe88bb9e3f657 (patch) | |
tree | 92277bb9b6b86b0555f91037e50808fe2c6625a8 | |
parent | 3affea2a73621856f825344724a4a9e011a75ff4 (diff) | |
download | nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.tar nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.tar.gz nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.tar.bz2 nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.tar.lz nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.tar.xz nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.tar.zst nixpkgs-1db54a5522a2d523e406ce8713bfe88bb9e3f657.zip |
nixos/sdcard: make firmware partition offset configurable
Different boards using u-boot SPL require to write to different locations. Sometimes, the 8MiB gap isn't sufficient - rk3399 boards write to 0x16384 for example, which is at 8MiB, thus overriding the fat32 partition with the SPL.
-rw-r--r-- | nixos/modules/installer/sd-card/sd-image.nix | 18 |
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 d0fe79903d3..2a10a77300e 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 }') |