<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>6330</bug_id>
          
          <creation_ts>2014-05-14 20:06:45 +0000</creation_ts>
          <short_desc>Add support for cpio - &apos;xz&apos; and &apos;gz&apos; and &apos;bz2&apos; compressed u-boot image-types</short_desc>
          <delta_ts>2014-07-15 05:54:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>deployment</component>
          <version>1.7</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.7 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Hongxu Jia">hongxu.jia</assigned_to>
          <cc>hongxu.jia</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>43339</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2014-05-14 20:06:45 +0000</bug_when>
    <thetext>Extend the image_types_uboot class to produce CPIO archives, as well as compressing them with xz (lzma), gz and bz2.

It may make sense to add &apos;xz&apos; generically as well, since that should be replacing the lzma extension.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44442</commentid>
    <comment_count>1</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2014-07-11 05:07:23 +0000</bug_when>
    <thetext>The oe-core has already implemented to support for ext2.lzma.u-boot/
ext3.gz.u-boot/ cpio.lzma.u-boot/ cpio.gz.u-boot and cpio.bz2.u-boot
type compressed uboot rootfs images.

It didn&apos;t support the cpio.xz.u-boot type for now, but use the cpio.lamz.u-boot
to instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44443</commentid>
    <comment_count>2</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2014-07-11 05:08:16 +0000</bug_when>
    <thetext>1. How to config in Yocto
...
MACHINE ?= &quot;beaglebone&quot;
IMAGE_CLASSES ?= &quot;image_types_uboot&quot;
IMAGE_FSTYPES += &quot; cpio.lzma.u-boot cpio.gz.u-boot cpio.bz2.u-boot&quot;
...

2. bitbake core-image-minimal

3. Runtime test on beaglebone borad, load ramdisk cpio.gz.u-boot and boot it

U-Boot# setenv serverip 128.224.162.194;
U-Boot# setenv ipaddr 128.224.163.245;
U-Boot# tftp ${loadaddr} uImage-beaglebone.bin;
U-Boot# tftp ${rdaddr}  core-image-minimal-beaglebone-20140710121908.rootfs.cpio.gz.u-boot;
U-Boot# tftp ${fdtaddr} uImage-am335x-bone.dtb
U-Boot# setenv bootargs &apos;console=ttyO0,115200n8 root=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M&apos;;
U-Boot# bootm ${loadaddr} ${rdaddr} ${fdtaddr};

...
## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   Linux-3.14.5-yocto-standard
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5045408 Bytes = 4.8 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2509178 Bytes = 2.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Kernel Image ... OK
   Loading Ramdisk to 8fd9b000, end 8ffff97a ... OK
   Loading Device Tree to 8fd91000, end 8fd9afb3 ... OK
...
The linux system boot up successfully.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44445</commentid>
    <comment_count>3</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2014-07-11 07:34:37 +0000</bug_when>
    <thetext>BTW: We need to config kernel to support gzip/bzip2/LZMA ramdisk decompress: 
...
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
...

How to config in yocto (A tricky way)
1. bitbake linux-yocto -ccleansstate &amp;&amp; bitbake linux-yocto -cmenuconfig

2. On menuconfig
 General setup--&gt;Initial RAM filesystem and RAM disk (initramfs/initrd) support
 --&gt; Support initial ramdisks compressed using gzip/bzip2/LZMA

3. bitbake linux-yocto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44459</commentid>
    <comment_count>4</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2014-07-14 07:50:13 +0000</bug_when>
    <thetext>Currently oe-core has supported for building cpio.lzma.u-boot/
cpio.gz.u-boot/cpio.bz2.u-boot, but it is lacking support for
building *cpio.xz.u-boot* type images.

The reason is u-boot didn&apos;t support xz compress/decompress,
but I found two patches from upstream to support that.
http://lists.denx.de/pipermail/u-boot/2010-December/083155.html
http://lists.denx.de/pipermail/u-boot/2010-December/083154.html

But the upstream has rejected it, the reason is LZMA and XZ
overlap on the internal LZMA code (each one has the own
implementation), there is just toolittle time for the
cleanup, so they decide to deprecate LZMA and just support XZ
*in the future*.
http://lists.denx.de/pipermail/u-boot/2010-December/083231.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44473</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2014-07-14 19:49:12 +0000</bug_when>
    <thetext>I haven&apos;t looked at the latest version of the u-boot settings, but we should follow whatever u-boot supports.. They they do not support &apos;XZ&apos; (those emails were from 2010, so I&apos;m curious if things have changed) then we should stick with the supported configurations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44479</commentid>
    <comment_count>6</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2014-07-15 05:53:09 +0000</bug_when>
    <thetext>Got it, and I will do the test to load the u-boot ramdisk image to a beaglebone (arm).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44480</commentid>
    <comment_count>7</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2014-07-15 05:54:41 +0000</bug_when>
    <thetext>Verifie on OE-Core rev: fa325e44f5b429b4038022b31285af9c94672943

Steps:

1. How to config in Yocto
...
MACHINE ?= &quot;beaglebone&quot;
IMAGE_CLASSES ?= &quot;image_types_uboot&quot;
IMAGE_FSTYPES += &quot;ext2.u-boot ext2.gz.u-boot ext2.bz2.u-boot ext2.lzma.u-boot&quot;
IMAGE_FSTYPES += &quot;ext3.u-boot ext3.gz.u-boot ext3.bz2.u-boot ext3.lzma.u-boot&quot;
IMAGE_FSTYPES += &quot;ext4.u-boot ext4.gz.u-boot ext4.bz2.u-boot ext4.lzma.u-boot&quot;
IMAGE_FSTYPES += &quot;cpio.u-boot cpio.gz.u-boot cpio.bz2.u-boot cpio.lzma.u-boot&quot;
...

2. we need to config kernel to support gzip/bzip2/LZMA ramdisk decompress: 
...
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
...

How to config in yocto (A tricky way)
  1) bitbake linux-yocto -ccleansstate &amp;&amp; bitbake linux-yocto -cmenuconfig

  2) while menuconfig
    General setup--&gt;Initial RAM filesystem and RAM disk (initramfs/initrd) support
     --&gt; Support initial ramdisks compressed using gzip/bzip2/LZMA

  3) bitbake linux-yocto

3. bitbake core-image-minimal

4. start a tftp server and config the image download directory

5. Runtime test on beaglebone borad, load ramdisk
    {cpio,ext2,ext3,ext4}.{gz.u-boot,bz2.u-boot,lzma.u-boot,u-boot}
    and boot it

U-Boot# setenv serverip 128.224.162.194;
U-Boot# setenv ipaddr 128.224.163.245;
U-Boot# tftp ${loadaddr} uImage-beaglebone.bin;
U-Boot# tftp ${rdaddr}  core-image-minimal-beaglebone-20140710121908.rootfs.cpio.gz.u-boot;
U-Boot# tftp ${fdtaddr} uImage-am335x-bone.dtb
U-Boot# setenv bootargs &apos;console=ttyO0,115200n8 root=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M&apos;;
U-Boot# bootm ${loadaddr} ${rdaddr} ${fdtaddr};


Testing, Expected Results:
--------------------------
cpio.bz2.u-boot:
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (bzip2 compressed)
   Data Size:    2397852 Bytes = 2.3 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

cpio.gz.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2509434 Bytes = 2.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

cpio.lzma.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (lzma compressed)
   Data Size:    1689519 Bytes = 1.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK

...

cpio.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    5109760 Bytes = 4.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext2.bz2.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (bzip2 compressed)
   Data Size:    2390181 Bytes = 2.3 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext2.gz.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2595868 Bytes = 2.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext2.lzma.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (lzma compressed)
   Data Size:    1707162 Bytes = 1.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext2.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    67108864 Bytes = 64 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext3.bz2.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (bzip2 compressed)
   Data Size:    2400152 Bytes = 2.3 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext3.gz.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2604122 Bytes = 2.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext3.lzma.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (lzma compressed)
   Data Size:    1709109 Bytes = 1.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...



ext3.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    67108864 Bytes = 64 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext4.bz2.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (bzip2 compressed)
   Data Size:    2378577 Bytes = 2.3 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

gz.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2583845 Bytes = 2.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...


ext4.lzma.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (lzma compressed)
   Data Size:    1702801 Bytes = 1.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

ext4.u-boot
...
## Loading init Ramdisk from Legacy Image at 88080000 ...
   Image Name:   core-image-minimal-beaglebone-20
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    67108864 Bytes = 64 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
...

The linux system boot up successfully.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>