Merge pull request #69865 from AmineChikhaoui/sd-image-compression
sdImage: add option to enable bzip2 compression
This commit is contained in:
commit
ece3eba422
@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para />
|
<para>SD images are now compressed by default using <literal>bzip2</literal>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
@ -98,6 +98,16 @@ in
|
|||||||
populate the ./files/boot (/boot) directory.
|
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 = {
|
config = {
|
||||||
@ -118,10 +128,12 @@ in
|
|||||||
|
|
||||||
sdImage.storePaths = [ config.system.build.toplevel ];
|
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;
|
name = config.sdImage.imageName;
|
||||||
|
|
||||||
nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux ];
|
nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux bzip2 ];
|
||||||
|
|
||||||
|
inherit (config.sdImage) compressImage;
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/nix-support $out/sd-image
|
mkdir -p $out/nix-support $out/sd-image
|
||||||
@ -168,6 +180,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
|
||||||
|
if test -n "$compressImage"; then
|
||||||
|
bzip2 $img
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
}) {};
|
}) {};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user