sdImage: add option to enable bzip2 compression
also make SD image compression the default setup. Fixes issues with output size such as: https://hydra.nixos.org/build/102163603
This commit is contained in:
parent
5afde25a10
commit
6ce605e18d
|
@ -73,7 +73,7 @@
|
|||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para />
|
||||
<para>SD images are now compressed by default using <literal>bzip2</literal>.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
|
|
@ -98,6 +98,16 @@ in
|
|||
populate the ./files/boot (/boot) directory.
|
||||
'';
|
||||
};
|
||||
|
||||
compressImage = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether the SD image should be compressed using
|
||||
<command>bzip2</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
|
@ -118,10 +128,12 @@ in
|
|||
|
||||
sdImage.storePaths = [ config.system.build.toplevel ];
|
||||
|
||||
system.build.sdImage = pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs, mtools, libfaketime, utillinux }: stdenv.mkDerivation {
|
||||
system.build.sdImage = pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs, mtools, libfaketime, utillinux, bzip2 }: stdenv.mkDerivation {
|
||||
name = config.sdImage.imageName;
|
||||
|
||||
nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux ];
|
||||
nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux bzip2 ];
|
||||
|
||||
inherit (config.sdImage) compressImage;
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/nix-support $out/sd-image
|
||||
|
@ -168,6 +180,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
|
||||
if test -n "$compressImage"; then
|
||||
bzip2 $img
|
||||
fi
|
||||
'';
|
||||
}) {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue