emmc-image: faster build

This commit is contained in:
Linus Heckemann 2021-01-06 23:29:02 +01:00
parent d7426d1930
commit 3ccc448bdd

View File

@ -37,13 +37,8 @@
buildCommand = ''
mkdir -p $out/nix-support $out/sd-image
export img=$out/sd-image/${config.sdImage.imageName}
export img=${config.sdImage.imageName}
echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system
if test -n "$compressImage"; then
echo "file sd-image $img.bz2" >> $out/nix-support/hydra-build-products
else
echo "file sd-image $img" >> $out/nix-support/hydra-build-products
fi
echo "Decompressing rootfs image"
zstd -d --no-progress "${rootfsImage}" -o ./root-fs.img
@ -66,19 +61,17 @@
# Copy the rootfs into the SD image
eval $(partx $img -o START,SECTORS --nr 3 --pairs)
dd conv=notrunc if=./root-fs.img of=$img seek=$START count=$SECTORS
dd conv=notrunc if=./root-fs.img of=$img seek=$((START/64)) count=$((SECTORS/64)) bs=$((512*64))
# Copy u-boot into the SD image
eval $(partx $img -o START,SECTORS --nr 2 --pairs)
dd conv=notrunc if=${pkgs.ubootHelios64}/u-boot.itb of=$img seek=$START count=$SECTORS
dd conv=notrunc if=${pkgs.ubootHelios64}/u-boot.itb of=$img seek=$((START/64)) count=$((SECTORS/64)) bs=$((512*64))
# Copy bootloader into the SD image
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
dd conv=notrunc if=${pkgs.ubootHelios64}/idbloader.img of=$img seek=$START count=$SECTORS
dd conv=notrunc if=${pkgs.ubootHelios64}/idbloader.img of=$img seek=$((START/64)) count=$((SECTORS/64)) bs=$((512*64))
if test -n "$compressImage"; then
zstd -v --no-progress $img
fi
zstd -v --no-progress $img -o $out/sd-image/${config.sdImage.imageName}.zstd
'';
}) {};
}