[meta-freescale] [meta-fsl-arm][PATCH V2] Add compression method to apply to SDCARD

info info at embexus.com
Mon Dec 1 07:38:56 PST 2014


 Add compression method to apply to SDCARD after it has been created. 
 Supported formats are "gzip", "bzip2" or "xz". The original .sdcard file is kept and a new
 compressed file is created if one of these compression formats is chosen.
 SDCARD_COMPRESSION can be defined in local.conf and only one compression method among the supported formats can be set. 
 If SDCARD_COMPRESSION is set to any other value it is silently ignored.


Signed-off-by: embexus <info at embexus.com>
---
 classes/image_types_fsl.bbclass |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass
index 9533578..1c1a28b 100644
--- a/classes/image_types_fsl.bbclass
+++ b/classes/image_types_fsl.bbclass
@@ -92,6 +92,13 @@ SDCARD_GENERATION_COMMAND_mx5 = "generate_imx_sdcard"
 SDCARD_GENERATION_COMMAND_mx6 = "generate_imx_sdcard"
 SDCARD_GENERATION_COMMAND_vf60 = "generate_imx_sdcard"
 
+# Compression method to apply to SDCARD after it has been created. Supported
+# compression formats are "gzip", "bzip2" or "xz". The original .sdcard file
+# is kept and a new compressed file is created if one of these compression
+# formats is chosen. If SDCARD_COMPRESSION is set to any other value it is
+# silently ignored.
+#SDCARD_COMPRESSION ?= ""
+
 #
 # Create an image that can by written onto a SD card using dd for use
 # with i.MX SoC family
@@ -312,6 +319,19 @@ IMAGE_CMD_sdcard () {
     dd if=/dev/zero of=${SDCARD} bs=1 count=0 seek=$(expr 1024 \* ${SDCARD_SIZE})
 
     ${SDCARD_GENERATION_COMMAND}
+    
+    # Optionally apply compression
+    case "${SDCARD_COMPRESSION}" in
+    "gzip")
+        gzip -k9 "${SDCARD}"
+        ;;
+    "bzip2")
+        bzip2 -k9 "${SDCARD}"
+        ;;
+    "xz")
+        xz -k "${SDCARD}"
+        ;;
+    esac
 }
 
 # The sdcard requires the rootfs filesystem to be built before using
-- 
1.7.9.5


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-freescale/attachments/20141201/e6c516d2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-sdcard-image-compression.patch
Type: application/octet-stream
Size: 2059 bytes
Desc: not available
URL: <http://lists.yoctoproject.org/pipermail/meta-freescale/attachments/20141201/e6c516d2/attachment.obj>


More information about the meta-freescale mailing list