AnsweredAssumed Answered

Can not start initramfs from MFGTool on imx6

Question asked by Stas Gil on Feb 25, 2019
Latest reply on Feb 26, 2019 by Stas Gil

Hi all ( it's me again....),

 

I am trying to burn the image to eMMC memory on our custom board based off sabreSD using MFGToolV2 4.15-2.0.0 , but i am not able to start the initrd filesystem to start the partitioning process. When i try, i get the following error:

 

Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid

 

I have build u-boot, kernel and initramfs (in cpio.gz.u-boot format) for the mfg tool using bitbake.

( we use imx BSP krogoth 2.0GA , kernel 4.1.15 )

For u-boot:

CONFIG_ENV_IS_NOWHERE

CONFIG_IMAGE_FORMAT_LEGACY

 are defined.

 

I can start u-boot usng the MFGTool, and i can start the kernel if i do

bootz 0x12000000 | -                | 0x18000000

          kernel addr   | skip initrd  | device tree blob addr

And obviously it crashes as it can't find the ramdisk fs.

Below is my ucl.xml for this:

 

 

  <LIST name="RamFS" desc="Test ram fs">
    <CMD state="Bootstrap" type="boot" body="BootStrap" file ="bootstrap/u-boot-mfgtool.imx" ifdev="MX6D">Loading U-boot</CMD>
        
    <CMD state="BootStrap" type="load" file="bootstrap/zImage_mfgtool" address="0x12000000"
        loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev"MX6D">Loading Kernel.</CMD>
        
    <CMD state="BootStrap" type="load" file="bootstrap/mfgtool-initramfs" address="0x12C00000"
        loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6D">Loading Initramfs.</CMD>
        
    <CMD state="BootStrap" type="load" file="bootstrap/imx6dl.dtb" address="0x18000000"
        loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6D">Loading device tree.</CMD>
    
    <CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>

<LIST/>

 

Looking at the code in image.c, it seems that the function that checks the initramdisk magic number fails:

 

https://lxr.missinglinkelectronics.com/uboot/include/image.h#L818static inline int image_check_magic(const image_header_t *hdr) {        return (image_get_magic(hdr) == IH_MAGIC);
}

 

However, when i open my initramdisk binary, the first 4 bytes actually match the expected magic number (which is: )

 

https://lxr.missinglinkelectronics.com/uboot/include/image.h#L309#define IH_MAGIC        0x27051956

And so, i am really confused. Since i can start kernel, the MFGTool seems to load things properly into RAM.

But then again, when i check the 0x12C00000 address with the md tool, it doesn't look like what i would expect.

 

Any pointers ? Thanks....

Outcomes