This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to port MLO, U-boot, UImage and root file system to ARM335x Nand Flash

Hi,

I am using AM335x with Micron NAND for booting my all the images from nand by default. I am following the below link steps.

i am using 8 bit NAND with 4K page one and modified some changes in U-boot (which is SDK7) and Linux 3.2 version (SDK6) is suing in my board.

As per the steps i have flashed all the MLO, uboot.img, uImage with the below steps:

------------------------------

nand erase.chip;fatload mmc 0 0x81000000 MLO;cp.b 0x81000000 0x81020000 20000;cp.b 0x81000000 0x81040000 20000;cp.b 0x81000000 0x81060000 20000;nand write 0x81000000 0x0 0x80000;fatload mmc 0 0x81000000 u-boot.img;nand write 0x81000000 0xc0000 0x200000;fatload mmc 0 0x81000000 uImage;nand write 0x81000000 0xa00000 0x500000;

------------------------------

After changed the boot pins to NAND mode, it is booting from NAND and till kernel image it was booted up. configured kernel image offset as 0xa00000 then only it is booting. As per this mtd partition how to flash the ubi.img to file system partition. Still some kernel crashes in my boot log.

Please help me what are the boot commands need to give for booting the full system via NAND. Also plz suggest me the kernel mtd changes as well.

Find the log for your reference.

Thanks

5428.nand flash log.txt

  • Hello,

    You could check here:

    http://processors.wiki.ti.com/index.php/AM335x_NAND_Driver's_Guide

    Hope it helps.

    BR
    Margarita

  • Hi Margarita,

    Thanks for your response.

    I have followed the same document and configured my kernel. How to flash the images to NAND please let us know the steps for flashing in to NAND. In my EVM is 256MB and in my customized board is 1GB NAND (8 bit, 4k page size). I need the partition table for my 1GB nand.

    Please suggest me what are the changes required in u-boot.

    Thanks
  • Hi Margarita,

    I have used above settings in my kernel and it is booting from NAND, but still it stuck at the middle ware and some portion of kernel got crash. I have loaded till uImage and how to flash the file system over NAND with steps.

    when i am using NAND boot mode LCD is not working and it is working in SDCARD boot mode. Please find attached log for your reference.

    Thanks,

    8156.nand booing log.txt

  • Hi,
    This kernel panic is due to LCD driver with DMA support.
    Please refer to the following TI E2E post which is similar to yours.

    e2e.ti.com/.../690610
  • Hi Titus,

    I have gone through your patch a nd modified the source in my Linux 3.2.

    When i try to boot from NAND mode still i am facing the same issue. LCD i not working. I have booted the same kernel image from SD-Card it is working. 

    while i am booting the images from NAND it is giving the issue. Aso my memory is showing 16MB instead of 512MB. Please find attached booting log and suggest

    me  the results.

    Thanks,

    2161.nand booing log.txt

  • Hi Titus,

    small change i.e kernel offset made in uboot. now it is booting from NAND and LCD also no issue.

    But still i am unable connect to my file systems. Please find attached log.

    Thanks

    6012.nand booing log.txt

  • How did you flash the filesystem (UBIFS) into NAND flash ?
    From u-boot or Linux ?
  • Hi Titus,

    I have flashed ubifs(ubi.img) via u-boot and followed the below procedure :

    -------------------------------------------------------------------------------------------------------------------
    mmc rescan;nand erase.chip;fatload mmc 0 0x81000000 MLO;cp.b 0x81000000 0x81020000 20000;cp.b 0x81000000 0x81040000 20000;cp.b 0x81000000 0x81060000 20000;fatload mmc 0 0x81080000 u-boot.img;fatload mmc 0 0x81260000 uEnv.txt;fatload mmc 0 0x81280000 uImage;fatload mmc 0 0x81780000 ubi.img;nand write 0x81000000 0x0 0x2000000;

    setenv nandsrcaddr 0x00280000;setenv nandimgsize 0x500000;setenv bootcmd 'nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize};bootm ${loadaddr}';setenv bootargs 'console=ttyO0,115200 root=ubi0:root ubi.mtd=7,2048 rootfstype=ubifs noinitrd mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),128k(SPL.backup3),1920k(u-boot),128k(u-boot-env),5m(kernel),-(root)'

    -------------------------------------------------------------------------------------------------------------------

    Thanks
  • Hi Titus,

    I have tried to load the ubifs from linux, but i am getting the below error.

    -------------------------------------------------------------------------------------------------------------
    root@am335x-evm:~#
    root@am335x-evm:~# flash_erase /dev/mtd7 0 0
    Erasing 128 Kibyte @ 1f860000 -- 100 % complete

    root@am335x-evm:~# mtdinfo
    Count of MTD devices: 8
    Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7
    Sysfs interface supported: yes

    root@am335x-evm:~# ubiformat /dev/mtd7 -s 512 -O 2048
    ubiformat: mtd7 (nand), size 529006592 bytes (504.5 MiB), 4036 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
    libscan: scanning eraseblock 689 -- 17 % complete Error unable to open fifo: No such device or address
    libscan: scanning eraseblock 4035 -- 100 % complete
    ubiformat: 4036 eraseblocks are supposedly empty
    ubiformat: formatting eraseblock 4035 -- 100 % complete
    root@am335x-evm:~# ubiattach /dev/ubi_ctrl -m 7 -O 512
    [ 172.890314] UBI: attaching mtd7 to ubi0
    [ 172.894435] UBI: physical eraseblock size: 131072 bytes (128 KiB)
    [ 172.900972] UBI: logical eraseblock size: 129024 bytes
    [ 172.906607] UBI: smallest flash I/O unit: 2048
    [ 172.911505] UBI: sub-page size: 512
    [ 172.916327] UBI: VID header offset: 512 (aligned 512)
    [ 172.922411] UBI: data offset: 2048
    [ 173.137689] UBI: empty MTD device detected
    [ 173.142030] UBI: max. sequence number: 0
    [ 173.146757] UBI: create volume table (copy #1)
    [ 173.151390] UBI error: ubi_scan_get_free_peb: no free eraseblocks
    ubiattach: error!: cannot attach mtd7
    error 28 (No space left on device)
    -------------------------------------------------------------------------------------------------------------

    any kernel changes required for my customization. Please help me where i am going wrong.

    Thanks,
  • Hi,

    After changed the modification under the kernel ubi - io.c file, then the errors are minimizing and going the complete log

    Please find attached log and suggest me any changes.

    Thanks

    0410.nand booing log.txt

  • Hi,

    Please some on can look at my issue and give your comments.

    Thanks

  • Hi Lofna,

    Is that filesystem created by you or TI SDK's filesystem ?

    I hope, its problem due to UBI file creation from filesystem and PEB calculation.

    Please refer to the following TI wiki to calculate the PEB.

    processors.wiki.ti.com/.../UBIFS_Support
  • Hi Titus,

    I am referreing the same link and tried both the way (with TI ). I have a doubt in my values which i have configured for my 4GB spansion nand. please give me the arguments for my UBIFS creation.

    how to calculate the PB and others with augments. For my nand i have changed in u-boot, please find attached files and give m your suggestions..

    ------------------------------------------------------------------------------------------

    [    3.419618] NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (Spansion S34ML08G2)

    [    3.427590] 8 cmdlinepart partitions found on MTD device omap2-nand.0

    [    3.434330] Creating 8 MTD partitions on "omap2-nand.0":

    [    3.439887] 0x000000000000-0x000000020000 : "SPL"

    [    3.446130] 0x000000020000-0x000000040000 : "SPL.backup1"

    [    3.452916] 0x000000040000-0x000000060000 : "SPL.backup2"

    [    3.459656] 0x000000060000-0x000000080000 : "SPL.backup3"

    [    3.466454] 0x000000080000-0x000000260000 : "u-boot"

    [    3.473493] 0x000000260000-0x000000280000 : "u-boot-env"

    [    3.480144] 0x000000280000-0x000000780000 : "kernel"

    [    3.488471] 0x000000780000-0x000020000000 : "rootfs"

    root@am335x-evm:~# cat /proc/mtd

    dev:    size   erasesize  name

    mtd0: 00020000 00020000 "SPL"

    mtd1: 00020000 00020000 "SPL.backup1"

    mtd2: 00020000 00020000 "SPL.backup2"

    mtd3: 00020000 00020000 "SPL.backup3"

    mtd4: 001e0000 00020000 "U-Boot"

    mtd5: 00020000 00020000 "U-Boot Env"

    mtd6: 00500000 00020000 "Kernel"

    mtd7: 1f880000 00020000 "File System"

    [    3.701696] OneNAND driver initializing

    [    3.706347] UBI: attaching mtd7 to ubi0

    [    3.710364] UBI: physical eraseblock size:           131072 bytes (128 KiB)

    [    3.716943] UBI: logical eraseblock size:               126976 bytes

    [    3.722594] UBI: smallest flash I/O unit:               2048

    [    3.727507] UBI: sub-page size:               512

    [    3.732335] UBI: VID header offset:                       2048 (aligned 2048)

    [    3.738612] UBI: data offset:                                     4096

     

    root@am335x-evm:~# mtdinfo

    Count of MTD devices:           8

    Present MTD devices:            mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7

    Sysfs interface supported:      yes

     

    root@am335x-evm:~# mtdinfo /dev/mtd7

    mtd7

    Name:                                                  File System

    Type:                                                     nand

    Eraseblock size:                131072 bytes, 128.0 KiB

    Amount of eraseblocks:                4036 (529006592 bytes, 504.5 MiB)

    Minimum input/output unit size: 2048 bytes

    Sub-page size:                  512 bytes

    OOB size:                                             128 bytes

    Character device major/minor:   90:14

    Bad blocks are allowed:                 true

    Device is writable:                            true

     

    I am suing u-boot from SDK7 and Linux 3.2 from SDK6. I am unable to boot with my nand flash using SDK6. after ported SDK7 at least it is booting and till kernel image it is fine. It is unable to link to ubifs.

    Thanks

    7282.nand flash datasheet.pdf

  • I have attached my u-boot modified source files (u-boot-2013.10-ti2013.12.01/include/configs/)

    Thanks

    0755.ti_armv7_common.h

    7450.am335x_evm.h

  • Hi Titus,

    Still i am stucking here only, no progress. Is there any method to fix my nand booting issue.

    Thanks
  • Hi Titus,

    Have you found any issue on my side.

    Thanks