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

Submitted by info on Dec. 1, 2014, 3:38 p.m. | Patch ID: 84157

Details

Message ID 14a0680e6a7.f706589c40636.5548180936500215720@embexus.com
State Rejected, archived
Delegated to: Otavio Salvador
Headers show

Commit Message

info Dec. 1, 2014, 3:38 p.m.
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@embexus.com>
---
 classes/image_types_fsl.bbclass |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch hide | download patch | download mbox

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

Comments

Otavio Salvador Dec. 9, 2014, 6:39 p.m.
On Mon, Dec 1, 2014 at 1:38 PM, info <info@embexus.com> wrote:
>  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@embexus.com>

I was checking this patch but it seems not required.

If we change the 'sdcard' to 'sdcard.bz2' in IMAGE_FSTYPES it just works.

Using:

IMAGE_FSTYPES = "tar.bz2 ext3 sdcard.gz"

I got:

otavio@centrium ~/src/ossystems/yocto/build % ls
tmp/deploy/images/imx6qsabresd -l
total 26544
...
-rw-r--r-- 1 otavio otavio  7438938 Dec  9 16:32
core-image-minimal-imx6qsabresd-20141209182116.rootfs.sdcard.gz
...

So this patch is not required.
Ayoub Zaki Feb. 27, 2015, 4:04 p.m.
hello,

I want also to get a compressed sdcard image out of the Build, following
with you suggestion by setting :

IMAGE_FSTYPES = "tar.bz2 ext3 sdcard.gz"

I get in the fac an *-image.rootfs.sdcard.bz2 but this image is missing the
rootfilesystem and wont' work please check image_types_fsl.bbclass
something should be wrong there.


2014-12-09 19:39 GMT+01:00 Otavio Salvador <otavio@ossystems.com.br>:

> On Mon, Dec 1, 2014 at 1:38 PM, info <info@embexus.com> wrote:
> >  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@embexus.com>
>
> I was checking this patch but it seems not required.
>
> If we change the 'sdcard' to 'sdcard.bz2' in IMAGE_FSTYPES it just works.
>
> Using:
>
> IMAGE_FSTYPES = "tar.bz2 ext3 sdcard.gz"
>
> I got:
>
> otavio@centrium ~/src/ossystems/yocto/build % ls
> tmp/deploy/images/imx6qsabresd -l
> total 26544
> ...
> -rw-r--r-- 1 otavio otavio  7438938 Dec  9 16:32
> core-image-minimal-imx6qsabresd-20141209182116.rootfs.sdcard.gz
> ...
>
> So this patch is not required.
>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
>
>