From 164e87c29133b58450e218c596ebd3a9d2bace5e Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Mon, 2 Sep 2013 21:11:49 +0100 Subject: sdcard_image-rpi.bbclass: Allow optional compression Image files will typically contain lots of null blocks and should compress well. This will help with distribution of images over slow network links. Change-Id: Icec7454ff61cd81a2872037037a93ce01191ece5 Signed-off-by: Paul Barker --- classes/sdcard_image-rpi.bbclass | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'classes') diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass index a2fcd52..3ee4e94 100644 --- a/classes/sdcard_image-rpi.bbclass +++ b/classes/sdcard_image-rpi.bbclass @@ -50,6 +50,13 @@ IMAGE_DEPENDS_rpi-sdimg = " \ # SD card image name SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg" +# Compression method to apply to SDIMG after it has been created. Supported +# compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg file +# is kept and a new compressed file is created if one of these compression +# formats is chosen. If SDIMG_COMPRESSION is set to any other value it is +# silently ignored. +#SDIMG_COMPRESSION ?= "" + # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. FATPAYLOAD ?= "" @@ -107,6 +114,19 @@ IMAGE_CMD_rpi-sdimg () { else dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync fi + + # Optionally apply compression + case "${SDIMG_COMPRESSION}" in + "gzip") + gzip -k9 "${SDIMG}" + ;; + "bzip2") + bzip2 -k9 "${SDIMG}" + ;; + "xz") + xz -k "${SDIMG}" + ;; + esac } ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " -- cgit v1.2.3-54-g00ecf