diff options
author | Richard Marko <srk@48.io> | 2020-08-27 12:56:22 +0200 |
---|---|---|
committer | Richard Marko <srk@48.io> | 2020-08-27 20:18:18 +0200 |
commit | 170e1afd84672502880acd4b3b8e2bd579d6c4e2 (patch) | |
tree | 5dc1f86333cef174cb5a0f9967ac8fbe34806d07 /nixos/modules/installer/cd-dvd/sd-image.nix | |
parent | c557ea5cae7b7c4d85627212bfca3504b45f4948 (diff) |
nixos/sdImage: add postBuildCommands
This allows to perform `dd if= of=$img` after the image is built
which is handy to add e.g. uBoot SPL to the built image.
Instructions for some ARM boards sometimes contain this step
that needs to be performed manually, with this patch it can be
part of the nix file used to built the image.
Diffstat (limited to 'nixos/modules/installer/cd-dvd/sd-image.nix')
-rw-r--r-- | nixos/modules/installer/cd-dvd/sd-image.nix | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/modules/installer/cd-dvd/sd-image.nix b/nixos/modules/installer/cd-dvd/sd-image.nix index ddad1116c94a..231c7bf0a6c2 100644 --- a/nixos/modules/installer/cd-dvd/sd-image.nix +++ b/nixos/modules/installer/cd-dvd/sd-image.nix @@ -108,6 +108,15 @@ in ''; }; + postBuildCommands = mkOption { + example = literalExample "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''"; + default = ""; + description = '' + Shell commands to run after the image is built. + Can be used for boards requiring to dd u-boot SPL before actual partitions. + ''; + }; + compressImage = mkOption { type = types.bool; default = true; @@ -197,6 +206,9 @@ in # Verify the FAT partition before copying it. fsck.vfat -vn firmware_part.img dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS + + ${config.sdImage.postBuildCommands} + if test -n "$compressImage"; then zstd -T$NIX_BUILD_CORES --rm $img fi |