From bbdf745661ce4dde540e1c0babab5d716ee63382 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Mon, 21 Jun 2021 17:55:34 +0200 Subject: [PATCH] dey-image-qt: compress .ext4 images by default Since these images are highly compressable, this greatly reduces the amount of space taken up by build artifacts. Modify the code used to generate the .sdcard and .installer.zip files so that they contain the decompressed .ext4 image. https://onedigi.atlassian.net/browse/DEL-7582 Signed-off-by: Gabriel Valcazar --- meta-digi-arm/classes/image_types_digi.bbclass | 8 +++++++- meta-digi-arm/conf/machine/ccimx6qpsbc.conf | 2 +- meta-digi-arm/conf/machine/ccimx6sbc.conf | 2 +- meta-digi-arm/conf/machine/ccimx8mm-dvk.conf | 2 +- meta-digi-arm/conf/machine/ccimx8mn-dvk.conf | 2 +- meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf | 2 +- meta-digi-arm/conf/machine/ccimx8x-sbc-pro.conf | 2 +- meta-digi-dey/classes/dey-image-installer.bbclass | 9 +++++++++ 8 files changed, 22 insertions(+), 7 deletions(-) diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index f30b47b04..38e08b3d4 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -291,11 +291,17 @@ IMAGE_CMD_sdcard() { SDIMG_BOOT="$(readlink -e ${SDIMG_BOOTLOADER})" fi + # Decompress rootfs image + gzip -d -k ${SDIMG_ROOTFS}.gz + # Burn bootloader, boot and rootfs partitions dd if=${SDIMG_BOOT} of=${SDIMG} conv=notrunc,fsync seek=${BOOTLOADER_SEEK} bs=1K dd if=${SDIMG_BOOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024 + ${BOOT_SPACE_ALIGNED} \* 1024) + + # Delete the decompressed rootfs image + rm -f ${SDIMG_ROOTFS} } # The sdcard image requires the boot and rootfs images to be built before -IMAGE_TYPEDEP_sdcard = "${SDIMG_BOOTFS_TYPE} ${SDIMG_ROOTFS_TYPE}" +IMAGE_TYPEDEP_sdcard = "${SDIMG_BOOTFS_TYPE} ${SDIMG_ROOTFS_TYPE}.gz" diff --git a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf index 5895509ae..f169eb2f3 100644 --- a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf @@ -47,4 +47,4 @@ XBEE_TTY ?= "ttymxc4" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" +IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index 9f2cc2818..ba2da795c 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -47,4 +47,4 @@ XBEE_TTY ?= "ttymxc4" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" +IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf b/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf index 2bbfc74cd..fe7e879db 100644 --- a/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf +++ b/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf @@ -44,4 +44,4 @@ XBEE_TTY ?= "ttymxc3" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" +IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf b/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf index fe9e43638..e46efb2de 100644 --- a/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf +++ b/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf @@ -46,4 +46,4 @@ XBEE_TTY ?= "ttymxc3" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" +IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf b/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf index 5aba0390b..c30713074 100644 --- a/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf +++ b/meta-digi-arm/conf/machine/ccimx8x-sbc-express.conf @@ -33,4 +33,4 @@ XBEE_TTY ?= "ttyLP0" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" +IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx8x-sbc-pro.conf b/meta-digi-arm/conf/machine/ccimx8x-sbc-pro.conf index 2c3a9eebf..77f81c01d 100644 --- a/meta-digi-arm/conf/machine/ccimx8x-sbc-pro.conf +++ b/meta-digi-arm/conf/machine/ccimx8x-sbc-pro.conf @@ -46,4 +46,4 @@ BOOT_SCRIPTS = "boot.scr:boot.scr" UBOOT_HAS_FASTBOOT = "true" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" +IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-dey/classes/dey-image-installer.bbclass b/meta-digi-dey/classes/dey-image-installer.bbclass index 17ad6ed7c..bf5908d18 100644 --- a/meta-digi-dey/classes/dey-image-installer.bbclass +++ b/meta-digi-dey/classes/dey-image-installer.bbclass @@ -27,6 +27,10 @@ generate_installer_zip () { if readlink -e "${DEPLOY_DIR_IMAGE}/install_linux_fw_uuu.sh"; then INSTALLER_FILELIST="${INSTALLER_FILELIST} ${DEPLOY_DIR_IMAGE}/install_linux_fw_uuu.sh" fi + # Decompress the ext4.gz image, if any + if readlink -e "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ext4.gz" >/dev/null; then + gzip -d -k -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ext4.gz + fi for ext in ${FSTYPES_WHITELIST}; do if readlink -e "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${ext}" >/dev/null; then INSTALLER_FILELIST="${INSTALLER_FILELIST} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${ext}" @@ -50,6 +54,11 @@ _EOF_ zip -j ${IMGDEPLOYDIR}/${IMAGE_NAME}.installer.zip ${INSTALLER_FILELIST} ${IMGDEPLOYDIR}/README.txt rm -f ${IMGDEPLOYDIR}/README.txt + # Delete the decompressed ext4 image, if any + if readlink -e "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ext4" >/dev/null; then + rm -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ext4 + fi + # Create the symlink if [ -n "${IMAGE_LINK_NAME}" ] && [ -e "${IMGDEPLOYDIR}/${IMAGE_NAME}.installer.zip" ]; then ln -sf ${IMAGE_NAME}.installer.zip ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.installer.zip