From 604dcbc20f620fab1d2d5eaafa23a8cb654b0dc2 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Tue, 2 Jan 2024 13:44:09 +0100 Subject: [PATCH] ccimx6ul/ccmp1: compress recovery UBIFS image using zlib to reduce its size This compression method has a better compression ratio than the default (lzo), but the (de)compression speed is slower, leading to slower read/write speeds. However, the recovery partition only gets accessed in specific use cases such as software updates and partition encryption, and it contains an initramfs. The UBIFS will only be read at boot time to load its elements, but once the initramfs is loaded in RAM, there are no more read/write operations to the UBIFS during runtime, so the speed penalty is minimal. Take advantage of the improved compression ratio to reduce the size of the recovery image. On the ccimx6ul, the size is reduced by 248 KiB. https://onedigi.atlassian.net/browse/DEL-8819 https://onedigi.atlassian.net/browse/DEL-8825 Signed-off-by: Gabriel Valcazar --- meta-digi-arm/classes/image_types_digi.bbclass | 2 +- meta-digi-arm/conf/machine/ccmp13-dvk.conf | 4 ++++ meta-digi-arm/conf/machine/ccmp15-dvk.conf | 4 ++++ meta-digi-arm/conf/machine/include/ccimx6ul.inc | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index 83212e2a8..db641ac69 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -204,7 +204,7 @@ IMAGE_CMD:recovery.ubifs() { fi # Build UBIFS recovery image out of temp folder - mkfs.ubifs -r ${TMP_RECOVERYDIR} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}.recovery.ubifs ${MKUBIFS_BOOT_ARGS} + mkfs.ubifs -r ${TMP_RECOVERYDIR} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}.recovery.ubifs ${MKUBIFS_RECOVERY_ARGS} # Remove the temporary folder rm -rf ${TMP_RECOVERYDIR} diff --git a/meta-digi-arm/conf/machine/ccmp13-dvk.conf b/meta-digi-arm/conf/machine/ccmp13-dvk.conf index 814f87227..a9ae07f8d 100644 --- a/meta-digi-arm/conf/machine/ccmp13-dvk.conf +++ b/meta-digi-arm/conf/machine/ccmp13-dvk.conf @@ -123,6 +123,10 @@ IMAGE_CLASSES = "image_types_digi image_types-stubi" # Max LEB count (-c 255) calculated for a partition of up to 32 MiB considering 128 KiB erase-block size. MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 255" +# mkfs.ubifs parameters for recovery partition +# Same parameters as the boot partition, but using zlib compression to reduce image size. +MKUBIFS_RECOVERY_ARGS ?= "${MKUBIFS_BOOT_ARGS} -x zlib" + # mkfs.ubifs parameters for rootfs partition # Max LEB count (-c 8191) calculated for a partition of up to 1 GiB considering 128 KiB erase-block size. MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 8191" diff --git a/meta-digi-arm/conf/machine/ccmp15-dvk.conf b/meta-digi-arm/conf/machine/ccmp15-dvk.conf index 53173a2a4..1ea94b144 100644 --- a/meta-digi-arm/conf/machine/ccmp15-dvk.conf +++ b/meta-digi-arm/conf/machine/ccmp15-dvk.conf @@ -132,6 +132,10 @@ IMAGE_CLASSES = "image_types_digi image_types-stubi" # Max LEB count (-c 255) calculated for a partition of up to 32 MiB considering 128 KiB erase-block size. MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 255" +# mkfs.ubifs parameters for recovery partition +# Same parameters as the boot partition, but using zlib compression to reduce image size. +MKUBIFS_RECOVERY_ARGS ?= "${MKUBIFS_BOOT_ARGS} -x zlib" + # mkfs.ubifs parameters for rootfs partition # Max LEB count (-c 8191) calculated for a partition of up to 1 GiB considering 128 KiB erase-block size. MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 8191" diff --git a/meta-digi-arm/conf/machine/include/ccimx6ul.inc b/meta-digi-arm/conf/machine/include/ccimx6ul.inc index d532eae21..f0e66256b 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6ul.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6ul.inc @@ -41,6 +41,10 @@ MACHINE_FEATURES:remove:use-mainline-bsp = "wifi" # Max LEB count (-c 255) calculated for a partition of up to 32 MiB considering 128 KiB erase-block size. MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 255" +# mkfs.ubifs parameters for recovery partition +# Same parameters as the boot partition, but using zlib compression to reduce image size. +MKUBIFS_RECOVERY_ARGS ?= "${MKUBIFS_BOOT_ARGS} -x zlib" + # mkfs.ubifs parameters for rootfs partition # Max LEB count (-c 8191) calculated for a partition of up to 1 GiB considering 128 KiB erase-block size. MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 8191"