mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 09:53:10 +00:00
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.
This commit is contained in:
parent
c557ea5cae
commit
170e1afd84
@ -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 {
|
compressImage = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
@ -197,6 +206,9 @@ in
|
|||||||
# Verify the FAT partition before copying it.
|
# Verify the FAT partition before copying it.
|
||||||
fsck.vfat -vn firmware_part.img
|
fsck.vfat -vn firmware_part.img
|
||||||
dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS
|
dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS
|
||||||
|
|
||||||
|
${config.sdImage.postBuildCommands}
|
||||||
|
|
||||||
if test -n "$compressImage"; then
|
if test -n "$compressImage"; then
|
||||||
zstd -T$NIX_BUILD_CORES --rm $img
|
zstd -T$NIX_BUILD_CORES --rm $img
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user