Repartitioning NAND Flash (via Yocto/ Patch)

  • Hello,


    I have built an Kernel image with a bundled initramfs, to show a bootscreen very early using Plymouth. The Kernel image is about 20 MB in size. The default partition size for the Kernel (address $Kernel in U-Boot) is 7 MB in size.


    I have repartitioned the Kernel partition using mkpart in U-Boot, by taking some memory space from the TargetFS. I made sure, the offsets and sizes of all partitions fit. When downloading and installing the Kernel image incl. initramfs to my Kernel partition, I boot into a kernel panic.


    Is there any reason behind this? I asked myself, can I not modify the partitions and its sizes inside a Yocto layer, by e.g., patching the u-boot configuration file (fsimx6.h)?


    Any hint on partitioning and making the bundled kernel image run would be helpful!


    Thank you.

  • The standard load address for the kernel is at 0x11000000 and the load address for the device tree is at 0x12000000. This has space for a kernel of up to 16 MB. If your kernel image is bigger, but you still load the device tree to 0x12000000, then the device tree will overwrite parts of the kernel and/or initramfs image. To avoid this, you have to change variable fdtaddr to 0x13000000 or similar.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

    Edited 2 times, last by fs-support_HK ().

  • Hello,


    thank you for your answer.


    I have setup the partition table accordingly, using the mtdparts env variable:

    Code
    1. mtdparts=mtdparts=gpmi-nand:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,768k(UBoot)ro,256k(UBootEnv)ro,24m(Kernel)ro,1792k(FDT)ro,-(TargetFS)


    and I changed fdtaddr to 0x13000000:



    However, after installing the new Kernel image, and reinstalling FDT and rootfs image, I run into an error:



    It is weird, that it seems to still look for a FDT at 0x12000000:

    Code
    1. ## Flattened Device Tree blob at 12000000


    May this be the issue? I used the command:


    Code
    1. nand write $loadaddr FDT $filesize


    to install the FDT. It seems counterintuitive, since the $loadaddr variable holds the address 0x11000000, but the output of writing to NAND was:


    Code
    1. efusA9r2 # nand write . FDT $filesize
    2. NAND write: device 0 offset 0x1a40000, size 0xbe16
    3. 48662 bytes written: OK


    So, it did write to the correct offset, as it seems.

    Is there any other address I need to change, or maybe I should use the command:


    Code
    1. nand write 0x13000000 FDT $filesize


    Thanks again for your support.

  • I changed


    Code
    1. fdt=nand read 12000000 FDT; bootm 11000000 - 12000000

    to


    Code
    1. fdt=nand read 13000000 FDT; bootm 11000000 - 13000000

    which works.


    I realized, when creating the rootfs on TargetFS partition, the size is not set correctly. A reboot after setting the partitions solved this issue.


    The topic can be regarded as closed,

  • The address where the device tree is loaded in RAM is in variable fdtaddr. To change this address, you have to change the fdtaddr variable and then you need to call run .fdt_nand again so that the fdt variable is also updated correctly.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.