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.

Flashing android-jellybean ubifs filesystem to AM335x NAND

Other Parts Discussed in Thread: TPS65910, DA8XX, TMP275

Hi,

I had been trying to flash the Jellybean filesystem into the NAND memory. To start things off, I think I will tell what I already know (from my past experience, it's better if I ask like this, so please bear with me as I only have little knowledge in working on flashing or board like this):

  • Firstly, I know we need mkfs.ubifs to create the ubifs.img. The thing is I don't know where to get the appropriate mtd-utils in order to use the -F option which is very important for --space-fixup. It's best if you can provide a simple way to setup mtd-utils as I tried sudo apt-get install mtd-utils but that one is version 1.3 where -F is not supported. (I'm using Ubuntu 10.04 as the host)
  • Please do check if the following command is correct.

mkfs.ubifs -q -r <extracted rootfs dir from prebuilt-image> -F -m 2048 -e 129024 -c 2047 -o ubifs.img

  • Secondly, we need ubinize to turn ubifs.img to ubi.img.

ubinize -o ubi.img -m 2048 -p 128KiB -s 2048 ubinize.cfg

  • In case it's important, the following is the ubinize.cfg

[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=256MiB
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize

  • Other than that, I can use tftp to transfer the ubi.img to u-boot and can flash files without problem except one. I seems to have a bad sector on the NAND memory at 0x780000 which is the mtdblock7, can the kernel still get the filesystem if the case is like this or we can flash it at 0x800000 maybe? 
  • Lastly, after we done the flashing, if successfully flashed. How do we configure the environment  in order to boot properly. I know the switch configuration on the AM335x board already, just that I not sure with the parameter in the u-boot such as bootargs

Hope to hear from your side soon. Thank you.

Best regards,

Benz 

  • Hi Benz,

    Regarding the mtd-utils compilation with -F flag support, please refer to this page: http://processors.wiki.ti.com/index.php/MTD_Utilities#MTD-Utils_Compilation

    About the creation of the UBIFS, please check this post, where I have thoroughly explained the process and the calculations needed: http://e2e.ti.com/support/arm/sitara_arm/f/791/p/268305/941327.aspx#941327

    Another useful links on the subject:

    http://processors.wiki.ti.com/index.php/UBIFS_Support#Creating_UBIFS_file_system
    http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mkfubifs

    Benz Kek said:
    Other than that, I can use tftp to transfer the ubi.img to u-boot and can flash files without problem except one. I seems to have a bad sector on the NAND memory at 0x780000 which is the mtdblock7, can the kernel still get the filesystem if the case is like this or we can flash it at 0x800000 maybe? 

    You can change the kernel NAND partition layout inside the board-am335xevm.c file in the kernel sources. This has been explained in the link to my post above: http://e2e.ti.com/support/arm/sitara_arm/f/791/p/268305/941327.aspx#941327
    So basically, YES, you can change the NAND offset of the file system partition. Please note that you will also most probably need to edit the mtdparts U-Boot variable with the appropriate offset (also explained in my linked post).

    Benz Kek said:
    Lastly, after we done the flashing, if successfully flashed. How do we configure the environment  in order to boot properly. I know the switch configuration on the AM335x board already, just that I not sure with the parameter in the u-boot such as bootargs

    The default "nandboot" command should be sufficient:

    nandboot=echo Booting from nand ...; run nandargs; nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; bootm ${loadaddr}

    You just need to save it to the NAND flash with the "saveenv" command and when booting from nand it will automatically be executed.

    Best regards,
    Miroslav

  • Hi Miroslav,

    I tried to do as you said, but I still getting the error with the filesystem. Perhaps have a look on my log can let you understand more on my issues. I also provides my u-boot-env and mtdparts in case you need it. The flashing process I did the same with my first post. 

    >>> mkfs.ubifs -q -r <extracted rootfs dir from prebuilt-image> -F -m 2048 -e 129024 -c 2047 -o ubifs.img

    >>> ubinize -o ubi.img -m 2048 -p 128KiB -s 2048 ubinize.cfg

    [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=256MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_alignment=1
    vol_flags=autoresize

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

    u-boot env:

    arch=arm
    baudrate=115200
    board=am335x
    board_name=A33515BB
    board_rev=1.4A
    bootargs=console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=7,2048 noinitrd root
    fstype=ubifs mem=256M rootwait=1
    bootargs_defaults=setenv bootargs console=${console} ${optargs}
    bootcmd=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmc
    dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run import
    bootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if
    run loaduimagefat; then run mmcboot;elif run loaduimage; then run mmcboot;else e
    cho Could not find ${bootfile} ;fi;else run nandboot;fi;
    bootenv=uEnv.txt
    bootfile=uImage
    console=ttyO0,115200n8
    cpu=armv7
    dfu_alt_info_emmc=rawemmc mmc 0 3751936
    dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw mmc 100 100;u
    -boot.img.raw mmc 300 3C0;u-boot.img fat 0 1;uEnv.txt fat 0 1
    dfu_alt_info_nand=SPL part 0 1;SPL.backup1 part 0 2;SPL.backup2 part 0 3;SPL.bac
    kup3 part 0 4;u-boot part 0 5;kernel part 0 7;rootfs part 0 8
    ethact=cpsw
    ethaddr=00:18:31:ed:d7:c9
    fdt_high=0xffffffff
    fdtaddr=0x80F80000
    findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi;
    if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test
    $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $
    filesize
    ip_method=none
    ipaddr=192.168.0.103
    kloadaddr=0x80007fc0
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
    loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz
    loaduimage=ext2load mmc ${mmcdev}:2 ${kloadaddr} /boot/${bootfile}
    loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}
    mmcargs=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmcroot} rootfs
    type=${mmcrootfstype} ip=${ip_method}
    mmcboot=echo Booting from mmc ...; run mmcargs; bootm ${kloadaddr}
    mmcdev=0
    mmcroot=/dev/mmcblk0p2 ro
    mmcrootfstype=ext3 rootwait
    mtddevname=SPL
    mtddevnum=0
    mtdids=nand0=omap2-nand.0
    mtdparts=mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),128
    k(SPL.backup3),1920k(u-boot),128k(u-boot-env),5248k(kernel),-(rootfs)
    nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfsty
    pe=${nandrootfstype}
    nandboot=echo Booting from nand ...; run nandargs; nand read ${loadaddr} ${nands
    rcaddr} ${nandimgsize}; bootm ${loadaddr}
    nandimgsize=0x500000
    nandroot=ubi0:rootfs rw ubi.mtd=7,2048
    nandrootfstype=ubifs rootwait=1
    nandsrcaddr=0x280000
    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${se
    rverip}:${rootpath},${nfsopts} rw ip=dhcp
    netboot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${loadaddr
    } ${bootfile}; run netargs; bootm ${loadaddr}
    nfsopts=nolock
    partition=nand0,0
    ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype
    =${ramrootfstype}
    ramboot=echo Booting from ramdisk ...; run ramargs; bootm ${loadaddr}
    ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M
    ramrootfstype=ext2
    rdaddr=0x81000000
    rootpath=/export/rootfs
    serverip=192.168.0.102:69
    soc=am33xx
    spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype
    =${spirootfstype}
    spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read
    ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootm ${loadaddr}
    spibusno=0
    spiimgsize=0x362000
    spiroot=/dev/mtdblock4 rw
    spirootfstype=jffs2
    spisrcaddr=0xe0000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial
    vendor=ti
    ver=U-Boot 2013.01.01-00123-g2830d15-dirty (May 28 2014 - 13:45:19)

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

    mtdparts:

    device nand0 <omap2-nand.0>, # parts = 8
    #: name size offset mask_flags
    0: SPL 0x00020000 0x00000000 0
    1: SPL.backup1 0x00020000 0x00020000 0
    2: SPL.backup2 0x00020000 0x00040000 0
    3: SPL.backup3 0x00020000 0x00060000 0
    4: u-boot 0x001e0000 0x00080000 0
    5: u-boot-env 0x00020000 0x00260000 0
    6: kernel 0x00520000 0x00280000 0
    7: rootfs 0x0f860000 0x007a0000 0

    active partition: nand0,0 - (SPL) 0x00020000 @ 0x00000000

    defaults:
    mtdids : nand0=omap2-nand.0
    mtdparts: mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),12
    8k(SPL.backup3),1920k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs)

     

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

    Below is my log after I boot from u-boot:

    U-Boot# boot
    mmc_send_cmd : timeout: No status update
    Card did not respond to voltage select!
    mmc0(part 0) is current device
    mmc_send_cmd : timeout: No status update
    Card did not respond to voltage select!
    Booting from nand ...

    NAND read: device 0 offset 0x280000, size 0x500000
    5242880 bytes read: OK
    ## Booting kernel from Legacy Image at 82000000 ...
    Image Name: Linux-3.2.0
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 4180912 Bytes = 4 MiB
    Load Address: 80008000
    Entry Point: 80008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    [ 0.000000] Linux version 3.2.0 (benz@benz-ubuntu) (gcc version 4.6.x-google
    20120106 (prerelease) (GCC) ) #1 Tue Jun 10 10:23:08 MYT 2014
    [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instructio
    n cache
    [ 0.000000] Machine: am335xevm
    [ 0.000000] Memory policy: ECC disabled, Data cache writeback
    [ 0.000000] AM335X ES1.0 (sgx neon )
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pag
    es: 130048
    [ 0.000000] Kernel command line: console=ttyO0,115200n8 root=ubi0:rootfs rw u
    bi.mtd=7,2048 rootfstype=ubifs rootwait=1
    [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
    [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    [ 0.000000] Memory: 512MB = 512MB total
    [ 0.000000] Memory: 509880k/509880k available, 14408k reserved, 0K highmem
    [ 0.000000] Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
    [ 0.000000] vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
    [ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
    [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
    [ 0.000000] .text : 0xc0008000 - 0xc078a000 (7688 kB)
    [ 0.000000] .init : 0xc078a000 - 0xc07e0000 ( 344 kB)
    [ 0.000000] .data : 0xc07e0000 - 0xc084ba70 ( 431 kB)
    [ 0.000000] .bss : 0xc084ba94 - 0xc09a3890 (1376 kB)
    [ 0.000000] NR_IRQS:396
    [ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrup
    ts
    [ 0.000000] Total of 128 interrupts on 1 active controller
    [ 0.000000] OMAP clockevent source: GPTIMER2 at 24000000 Hz
    [ 0.000000] OMAP clocksource: GPTIMER1 at 32768 Hz
    [ 0.000000] sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 13
    1071999ms
    [ 0.000000] Console: colour dummy device 80x30
    [ 0.000122] Calibrating delay loop... 718.02 BogoMIPS (lpj=3590144)
    [ 0.118957] pid_max: default: 32768 minimum: 301
    [ 0.119079] Security Framework initialized
    [ 0.119171] Mount-cache hash table entries: 512
    [ 0.119598] CPU: Testing write buffer coherency: ok
    [ 0.119659] ftrace: allocating 22068 entries in 65 pages
    [ 0.189300] omap_hwmod: pruss: failed to hardreset
    [ 0.190155] print_constraints: dummy:
    [ 0.190368] NET: Registered protocol family 16
    [ 0.191528] OMAP GPIO hardware version 0.1
    [ 0.192626] omap_mux_init: Add partition: #1: core, flags: 0
    [ 0.193725] omap_i2c.1: alias fck already exists
    [ 0.194244] omap2_mcspi.1: alias fck already exists
    [ 0.194366] omap2_mcspi.2: alias fck already exists
    [ 0.194519] edma.0: alias fck already exists
    [ 0.194549] edma.0: alias fck already exists
    [ 0.194549] edma.0: alias fck already exists
    [ 0.204895] bio: create slab <bio-0> at 0
    [ 0.205902] SCSI subsystem initialized
    [ 0.206787] usbcore: registered new interface driver usbfs
    [ 0.206909] usbcore: registered new interface driver hub
    [ 0.207031] usbcore: registered new device driver usb
    [ 0.207366] registerd cppi-dma Intr @ IRQ 17
    [ 0.207366] Cppi41 Init Done Qmgr-base(e087a000) dma-base(e0878000)
    [ 0.207366] Cppi41 Init Done
    [ 0.207397] musb-ti81xx musb-ti81xx: musb0, board_mode=0x13, plat_mode=0x3
    [ 0.207550] musb-ti81xx musb-ti81xx: musb1, board_mode=0x13, plat_mode=0x1
    [ 0.218963] omap_i2c omap_i2c.1: bus 1 rev2.4.0 at 100 kHz
    [ 0.220214] tps65910 1-002d: JTAGREVNUM 0x0
    [ 0.222412] print_constraints: VRTC:
    [ 0.223754] print_constraints: VIO: at 1800 mV
    [ 0.225982] print_constraints: VDD1: 600 <--> 1500 mV at 1262 mV normal
    [ 0.228179] print_constraints: VDD2: 600 <--> 1500 mV at 1137 mV normal
    [ 0.229095] print_constraints: VDD3: 5000 mV
    [ 0.230407] print_constraints: VDIG1: at 1800 mV
    [ 0.231750] print_constraints: VDIG2: at 1800 mV
    [ 0.233062] print_constraints: VPLL: at 1800 mV
    [ 0.234405] print_constraints: VDAC: at 1800 mV
    [ 0.235748] print_constraints: VAUX1: at 1800 mV
    [ 0.237091] print_constraints: VAUX2: at 3300 mV
    [ 0.238403] print_constraints: VAUX33: at 3300 mV
    [ 0.239746] print_constraints: VMMC: at 3300 mV
    [ 0.240051] tps65910 1-002d: No interrupt support, no core IRQ
    [ 0.240631] Advanced Linux Sound Architecture Driver Version 1.0.24.
    [ 0.241271] Bluetooth: Core ver 2.16
    [ 0.241333] NET: Registered protocol family 31
    [ 0.241333] Bluetooth: HCI device and connection manager initialized
    [ 0.241363] Bluetooth: HCI socket layer initialized
    [ 0.241363] Bluetooth: L2CAP socket layer initialized
    [ 0.241424] Bluetooth: SCO socket layer initialized
    [ 0.241607] Switching to clocksource gp timer
    [ 0.260040] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
    [ 0.260253] musb-hdrc musb-hdrc.0: dma type: dma-cppi41
    [ 0.260467] MUSB0 controller's USBSS revision = 4ea20800
    [ 0.261352] musb-hdrc musb-hdrc.0: USB OTG mode controller at e083c000 using
    DMA, IRQ 18
    [ 0.261596] musb-hdrc musb-hdrc.1: dma type: dma-cppi41
    [ 0.261871] MUSB1 controller's USBSS revision = 4ea20800
    [ 0.262329] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [ 0.262420] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus numbe
    r 1
    [ 0.262573] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [ 0.262573] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=
    1
    [ 0.262603] usb usb1: Product: MUSB HDRC host driver
    [ 0.262603] usb usb1: Manufacturer: Linux 3.2.0 musb-hcd
    [ 0.262603] usb usb1: SerialNumber: musb-hdrc.1
    [ 0.263153] hub 1-0:1.0: USB hub found
    [ 0.263183] hub 1-0:1.0: 1 port detected
    [ 0.263610] musb-hdrc musb-hdrc.1: USB Host mode controller at e083e800 using
    DMA, IRQ 19
    [ 0.263977] NET: Registered protocol family 2
    [ 0.264190] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.264587] TCP established hash table entries: 16384 (order: 5, 131072 bytes
    )
    [ 0.264892] TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
    [ 0.265045] TCP: Hash tables configured (established 16384 bind 16384)
    [ 0.265075] TCP reno registered
    [ 0.265075] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.265106] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.265319] NET: Registered protocol family 1
    [ 0.265625] RPC: Registered named UNIX socket transport module.
    [ 0.265625] RPC: Registered udp transport module.
    [ 0.265655] RPC: Registered tcp transport module.
    [ 0.265655] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.265899] NetWinder Floating Point Emulator V0.97 (double precision)
    [ 0.391693] ashmem: initialized
    [ 0.392059] VFS: Disk quotas dquot_6.5.2
    [ 0.392120] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [ 0.393005] fuse init (API version 7.17)
    [ 0.393280] msgmni has been set to 995
    [ 0.394348] io scheduler noop registered
    [ 0.394378] io scheduler deadline registered
    [ 0.394439] io scheduler cfq registered (default)
    [ 0.397125] omap_uart.0: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
    [ 1.068572] console [ttyO0] enabled
    [ 1.072662] omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
    [ 1.080322] omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
    [ 1.087982] omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
    [ 1.095672] omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
    [ 1.103332] omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
    [ 1.111114] [drm] Initialized drm 1.1.0 20060810
    [ 1.121978] brd: module loaded
    [ 1.128326] loop: module loaded
    [ 1.131805] i2c-core: driver [tsl2550] using legacy suspend method
    [ 1.138305] i2c-core: driver [tsl2550] using legacy resume method
    [ 1.144714] at24 1-0051: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [ 1.158630] Detected a daughter card on AM335x EVM..
    [ 1.163635] CPLD version: CPLD1.0F
    [ 1.167510] at24 1-0050: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [ 1.182678] Board name: A33515BB
    [ 1.186035] Board version: 1.4A
    [ 1.189331] SKU: SKU#01
    [ 1.192382] The board is general purpose EVM in profile 0
    [ 1.198883] da8xx_lcdc.0: alias fck already exists
    [ 1.204223] da8xx_lcdc da8xx_lcdc.0: GLCD: Found TFC_S9700RTWV35TR_01B panel
    [ 1.224334] omap-gpmc omap-gpmc: GPMC revision 6.0
    [ 1.229339] Registering NAND on CS0
    [ 1.233428] omap_i2c.2: alias fck already exists
    [ 1.252319] omap_i2c omap_i2c.2: bus 2 rev2.4.0 at 100 kHz
    [ 1.258453] tsl2550 2-0039: standard operating mode
    [ 1.264404] tsl2550 2-0039: registering lightsensor-level input device
    [ 1.271453] input: lightsensor-level as /devices/virtual/input/input0
    [ 1.278228] tsl2550 2-0039: support ver. 1.2 enabled
    [ 1.283843] davinci-mcasp.1: alias fck already exists
    [ 1.289459] davinci-mcasp.0: alias fck already exists
    [ 1.295135] omap_hsmmc.0: alias fck already exists
    [ 1.300384] omap_hsmmc.2: alias fck already exists
    [ 1.305694] am335xevm: bt init
    [ 1.311950] (stk) :sysfs entries created
    [ 1.316131] (stk) : debugfs entries created
    [ 1.320465] (hci_tty): inside hci_tty_init
    [ 1.325134] (hci_tty): allocated 251, 0
    [ 1.329193] _regulator_get: 2-0018 supply Vdd not found, using dummy regulato
    r
    [ 1.336791] _regulator_get: 2-0018 supply Vdd_IO not found, using dummy regul
    ator
    [ 1.365386] lis3lv02d: 8 bits 3DLH sensor found
    [ 1.462524] input: ST LIS3LV02DL Accelerometer as /devices/platform/lis3lv02d
    /input/input1
    [ 1.472412] NFC Driver for TI WiLink
    [ 1.476867] mtdoops: mtd device (mtddev=name/number) must be supplied
    [ 1.484100] omap2-nand driver initializing
    [ 1.488677] ONFI flash detected
    [ 1.492065] ONFI param page 0 valid
    [ 1.495758] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G
    08ABAEAWP)
    [ 1.504577] Creating 8 MTD partitions on "omap2-nand.0":
    [ 1.510131] 0x000000000000-0x000000020000 : "SPL"
    [ 1.516113] 0x000000020000-0x000000040000 : "SPL.backup1"
    [ 1.522674] 0x000000040000-0x000000060000 : "SPL.backup2"
    [ 1.529205] 0x000000060000-0x000000080000 : "SPL.backup3"
    [ 1.535766] 0x000000080000-0x000000260000 : "U-Boot"
    [ 1.542602] 0x000000260000-0x000000280000 : "U-Boot Env"
    [ 1.549072] 0x000000280000-0x0000007a0000 : "Kernel"
    [ 1.557220] 0x0000007a0000-0x000010000000 : "File System"
    [ 1.666809] OneNAND driver initializing
    [ 1.671264] UBI: attaching mtd7 to ubi0
    [ 1.675292] UBI: physical eraseblock size: 131072 bytes (128 KiB)
    [ 1.681854] UBI: logical eraseblock size: 126976 bytes
    [ 1.687469] UBI: smallest flash I/O unit: 2048
    [ 1.692382] UBI: VID header offset: 2048 (aligned 2048)
    [ 1.698638] UBI: data offset: 4096
    [ 2.945587] UBI error: compare_lebs: unsupported on-flash UBI format
    [ 2.945587]
    [ 2.953765] slab error in kmem_cache_destroy(): cache `ubi_scan_leb_slab': Ca
    n't free all objects
    [ 2.963043] Backtrace:
    [ 2.965637] [<c00176e8>] (dump_backtrace+0x0/0x114) from [<c05a6894>] (dump_s
    tack+0x20/0x24)
    [ 2.974426] r6:df7dd000 r5:df7b0dc0 r4:df22b5c0 r3:c0809360
    [ 2.980377] [<c05a6874>] (dump_stack+0x0/0x24) from [<c00d1218>] (kmem_cache_
    destroy+0xc4/0x104)
    [ 2.989562] [<c00d1154>] (kmem_cache_destroy+0x0/0x104) from [<c0335b98>] (ub
    i_scan+0x338/0xa14)
    [ 2.998748] r4:0000048b r3:df76e000
    [ 3.002502] [<c0335860>] (ubi_scan+0x0/0xa14) from [<c032d5ac>] (ubi_attach_m
    td_dev+0x41c/0xa78)
    [ 3.011688] [<c032d190>] (ubi_attach_mtd_dev+0x0/0xa78) from [<c07a8174>] (ub
    i_init+0x1d8/0x2d4)
    [ 3.020843] [<c07a7f9c>] (ubi_init+0x0/0x2d4) from [<c0008780>] (do_one_initc
    all+0x124/0x18c)
    [ 3.029785] [<c000865c>] (do_one_initcall+0x0/0x18c) from [<c078a858>] (kerne
    l_init+0x80/0x11c)
    [ 3.038848] [<c078a7d8>] (kernel_init+0x0/0x11c) from [<c0046ed0>] (do_exit+0
    x0/0x6c4)
    [ 3.047119] r5:c078a7d8 r4:00000000
    [ 3.051300] UBI error: ubi_init: cannot attach mtd7
    [ 3.056640] CAN device driver interface
    [ 3.060668] CAN bus driver for Bosch D_CAN controller 1.0
    [ 3.112304] davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
    [ 3.118774] davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    [ 3.126342] davinci_mdio.0: probed
    [ 3.129913] davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
    [ 3.137329] PPP generic driver version 2.4.2
    [ 3.141967] PPP BSD Compression module registered
    [ 3.146911] PPP Deflate Compression module registered
    [ 3.152313] usbcore: registered new interface driver cdc_ether
    [ 3.158477] usbcore: registered new interface driver cdc_eem
    [ 3.164428] usbcore: registered new interface driver dm9601
    [ 3.170288] usbcore: registered new interface driver cdc_subset
    [ 3.176544] cdc_ncm: 04-Aug-2011
    [ 3.179962] usbcore: registered new interface driver cdc_ncm
    [ 3.185943] usbcore: registered new interface driver cdc_acm
    [ 3.191833] cdc_acm: USB Abstract Control Model driver for USB modems and ISD
    N adapters
    [ 3.200195] Initializing USB Mass Storage driver...
    [ 3.205413] usbcore: registered new interface driver usb-storage
    [ 3.211669] USB Mass Storage support registered.
    [ 3.216674] usbcore: registered new interface driver usbserial
    [ 3.222808] USB Serial support registered for generic
    [ 3.228149] usbcore: registered new interface driver usbserial_generic
    [ 3.234954] usbserial: USB Serial Driver core
    [ 3.239562] USB Serial support registered for GSM modem (1-port)
    [ 3.245971] usbcore: registered new interface driver option
    [ 3.251800] option: v0.7.2:USB Driver for GSM modems
    [ 3.258758] gadget: Mass Storage Function, version: 2009/09/11
    [ 3.264984] gadget: Number of LUNs=1
    [ 3.268798] lun0: LUN: removable file: (no medium)
    [ 3.274139] gadget: android_usb ready
    [ 3.278076] musb-hdrc musb-hdrc.0: MUSB HDRC host driver
    [ 3.283691] musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus numbe
    r 2
    [ 3.291534] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
    [ 3.298645] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=
    1
    [ 3.306182] usb usb2: Product: MUSB HDRC host driver
    [ 3.311340] usb usb2: Manufacturer: Linux 3.2.0 musb-hcd
    [ 3.316894] usb usb2: SerialNumber: musb-hdrc.0
    [ 3.322174] hub 2-0:1.0: USB hub found
    [ 3.326110] hub 2-0:1.0: 1 port detected
    [ 3.330932] mousedev: PS/2 mouse device common for all mice
    [ 3.337646] input: matrix-keypad as /devices/platform/matrix-keypad/input/inp
    ut2
    [ 3.346343] input: ti-tsc as /devices/platform/omap/ti_tscadc/tsc/input/input
    3
    [ 3.354980] using rtc device, am33xx-rtc, for alarms
    [ 3.360015] omap_rtc am33xx-rtc: rtc core: registered am33xx-rtc as rtc0
    [ 3.367309] i2c /dev entries driver
    [ 3.371246] Linux video capture interface: v2.00
    [ 3.376434] usbcore: registered new interface driver uvcvideo
    [ 3.382446] USB Video Class driver (1.1.1)
    [ 3.387603] input: lm75-temp as /devices/virtual/input/input4
    [ 3.394042] lm75 2-0048: hwmon0: sensor 'tmp275'
    [ 3.401519] OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [ 3.408111] device-mapper: uevent: version 1.0.3
    [ 3.413116] device-mapper: ioctl: 4.22.0-ioctl (2011-10-19) initialised: dm-d
    evel@redhat.com
    [ 3.421936] Bluetooth: HCI UART driver ver 2.2
    [ 3.426605] Bluetooth: HCI H4 protocol initialized
    [ 3.431579] Bluetooth: HCILL protocol initialized
    [ 3.436492] Bluetooth: Bluetooth Driver for TI WiLink - Version 1.0
    [ 3.445556] cpuidle: using governor ladder
    [ 3.449981] cpuidle: using governor menu
    [ 3.457885] usbcore: registered new interface driver usbhid
    [ 3.463775] usbhid: USB HID core driver
    [ 3.643096] logger: created 256K log 'log_main'
    [ 3.647949] logger: created 256K log 'log_events'
    [ 3.652984] logger: created 256K log 'log_radio'
    [ 3.657897] logger: created 256K log 'log_system'
    [ 3.663391] tiadc tiadc: attached adc driver
    [ 3.668273] usbcore: registered new interface driver snd-usb-audio
    [ 3.676116] _regulator_get: 2-001b supply IOVDD not found, using dummy regula
    tor
    [ 3.683929] _regulator_get: 2-001b supply DVDD not found, using dummy regulat
    or
    [ 3.691619] _regulator_get: 2-001b supply AVDD not found, using dummy regulat
    or
    [ 3.699279] _regulator_get: 2-001b supply DRVDD not found, using dummy regula
    tor
    [ 3.710174] asoc: tlv320aic3x-hifi <-> davinci-mcasp.1 mapping ok
    [ 3.717407] asoc: wl1271bt <-> davinci-mcasp.0 mapping ok
    [ 3.724090] ALSA device list:
    [ 3.727172] #0: AM335X EVM
    [ 3.730163] oprofile: hardware counters not available
    [ 3.735473] oprofile: using timer interrupt.
    [ 3.740112] Netfilter messages via NETLINK v0.30.
    [ 3.745178] nf_conntrack version 0.5.0 (7966 buckets, 31864 max)
    [ 3.751831] ctnetlink v0.93: registering with nfnetlink.
    [ 3.757476] NF_TPROXY: Transparent proxy support initialized, version 4.1.0
    [ 3.764739] NF_TPROXY: Copyright (c) 2006-2007 BalaBit IT Ltd.
    [ 3.771179] xt_time: kernel timezone is -0000
    [ 3.776031] ip_tables: (C) 2000-2006 Netfilter Core Team
    [ 3.781799] arp_tables: (C) 2002 David S. Miller
    [ 3.786712] TCP cubic registered
    [ 3.790252] NET: Registered protocol family 10
    [ 3.795715] Mobile IPv6
    [ 3.798309] ip6_tables: (C) 2000-2006 Netfilter Core Team
    [ 3.804168] IPv6 over IPv4 tunneling driver
    [ 3.809234] NET: Registered protocol family 17
    [ 3.813964] NET: Registered protocol family 15
    [ 3.818572] can: controller area network core (rev 20090105 abi 8)
    [ 3.825164] NET: Registered protocol family 29
    [ 3.829803] can: raw protocol (rev 20090105)
    [ 3.834259] can: broadcast manager protocol (rev 20090105 t)
    [ 3.840667] Bluetooth: RFCOMM TTY layer initialized
    [ 3.845764] Bluetooth: RFCOMM socket layer initialized
    [ 3.851135] Bluetooth: RFCOMM ver 1.11
    [ 3.855072] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [ 3.860595] Bluetooth: BNEP filters: protocol multicast
    [ 3.866058] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
    [ 3.872406] Registering the dns_resolver key type
    [ 3.877380] VFP support v0.3: implementor 41 architecture 3 part 30 variant c
    rev 3
    [ 3.885406] ThumbEE CPU extension supported.
    [ 3.889923] mux: Failed to setup hwmod io irq -22
    [ 3.895599] Power Management for AM33XX family
    [ 3.900482] Trying to load am335x-pm-firmware.bin (60 secs timeout)
    [ 3.907165] Copied the M3 firmware to UMEM
    [ 3.911529] Cortex M3 Firmware Version = 0x181
    [ 3.920898] clock: disabling unused clocks to save power
    [ 3.928131] Detected MACID=0:18:31:ed:d7:c9
    [ 3.934844] input: gpio-keys as /devices/platform/gpio-keys/input/input5
    [ 3.942199] omap_rtc am33xx-rtc: setting system clock to 2000-01-01 00:00:01
    UTC (946684801)
    [ 3.951568] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
    [ 3.958953] Please append a correct "root=" boot option; here are the availab
    le partitions:
    [ 3.967712] 1f00 128 mtdblock0 (driver?)
    [ 3.972991] 1f01 128 mtdblock1 (driver?)
    [ 3.978271] 1f02 128 mtdblock2 (driver?)
    [ 3.983551] 1f03 128 mtdblock3 (driver?)
    [ 3.988830] 1f04 1920 mtdblock4 (driver?)
    [ 3.994110] 1f05 128 mtdblock5 (driver?)
    [ 3.999389] 1f06 5248 mtdblock6 (driver?)
    [ 4.004669] 1f07 254336 mtdblock7 (driver?)
    [ 4.009948] Kernel panic - not syncing: VFS: Unable to mount root fs on unkno
    wn-block(0,0)
    [ 4.018585] Backtrace:
    [ 4.021148] [<c00176e8>] (dump_backtrace+0x0/0x114) from [<c05a6894>] (dump_s
    tack+0x20/0x24)
    [ 4.029968] r6:c07bbd84 r5:00000000 r4:c084e8d8 r3:c0809360
    [ 4.035919] [<c05a6874>] (dump_stack+0x0/0x24) from [<c05a6b04>] (panic+0x6c/
    0x190)
    [ 4.043914] [<c05a6a98>] (panic+0x0/0x190) from [<c078ac5c>] (mount_block_roo
    t+0x178/0x22c)
    [ 4.052642] r3:df7b9000 r2:00000000 r1:df06bf78 r0:c06d2e48
    [ 4.058563] r7:00008000
    [ 4.061218] [<c078aae4>] (mount_block_root+0x0/0x22c) from [<c078af74>] (prep
    are_namespace+0x94/0x1c0)
    [ 4.070922] [<c078aee0>] (prepare_namespace+0x0/0x1c0) from [<c078a8c8>] (ker
    nel_init+0xf0/0x11c)
    [ 4.080200] r5:c07dedf8 r4:c07dedf8
    [ 4.083953] [<c078a7d8>] (kernel_init+0x0/0x11c) from [<c0046ed0>] (do_exit+0
    x0/0x6c4)
    [ 4.092193] r5:c078a7d8 r4:00000000

    Best regards,

    Benz

  • Hi Benz,

    You mentioned that you have a bad block at NAND offset 0x7a0000. What version of the AM335x SDK/PSP are you using and what ECC scheme are you using to flash the rootfs to the NAND?

    The message you get (unsupported on-flash UBI format) is documented like this inside the kernel source code:

            /*
             * This must be a really ancient UBI image which has been
             * created before sequence numbers support has been added. At
             * that times we used 32-bit LEB versions stored in logical
             * eraseblocks. That was before UBI got into mainline. We do not
             * support these images anymore. Well, those images still work,
             * but only if no unclean reboots happened.
             */

    Also, this makes me a bit suspicious:

    Benz Kek said:
    [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=256MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_alignment=1
    vol_flags=autoresize

    You have entered a volume size of 256MiB and it makes me wonder if you have reserved some space for bad block handling. I have explained the details about calculating the vol_size in my post here: http://e2e.ti.com/support/arm/sitara_arm/f/791/p/268305/941327.aspx#941327 Please note that if you wish your file system partition to be 256MiB, then after reserving some space for bad block handling the vol_size parameter in the .cfg file would be a bit lower. Please check this.

    If this isn't relevant or doesn't work, then can you try to change the rootfs offset to 0x800000 as you mentioned in your first post?

    You should do the following:

    1. Modify the "mtdparts" U-Boot variable by either entering a larger size for the kernel partition, or inserting another partition between the kernel and rootfs partitions. If you do the latter, make sure you increment the mtd part number for the ubi.mtd kernel boot argument (ex.: ubi.mtd=8,2048).

    2. Modify the static struct mtd_partition am335x_nand_partitions[] in your board-am335xevm.c board file in the linux kernel sources accordingly.

    3. Flash the UBIFS image to the correct NAND offset.

    Best regards,
    Miroslav

  • Miroslav,

    Miroslav Kiradzhiyski XID said:

    Also, this makes me a bit suspicious:

    [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=256MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_alignment=1
    vol_flags=autoresize

    You have entered a volume size of 256MiB and it makes me wonder if you have reserved some space for bad block handling.

    [/quote]

    I solved this earlier by changing it to 200MiB and the first error is gone. 

    Miroslav Kiradzhiyski XID said:

    If this isn't relevant or doesn't work, then can you try to change the rootfs offset to 0x800000 as you mentioned in your first post?

    You should do the following:

    1. Modify the "mtdparts" U-Boot variable by either entering a larger size for the kernel partition, or inserting another partition between the kernel and rootfs partitions. If you do the latter, make sure you increment the mtd part number for the ubi.mtd kernel boot argument (ex.: ubi.mtd=8,2048).

    2. Modify the static struct mtd_partition am335x_nand_partitions[] in your board-am335xevm.c board file in the linux kernel sources accordingly.

    3. Flash the UBIFS image to the correct NAND offset.

    For this, I solved it by editing the board-am335xevm.c. The new mtdparts:

    U-Boot# mtdparts

    device nand0 <omap2-nand.0>, # parts = 8
    #: name size offset mask_flags
    0: SPL 0x00020000 0x00000000 0
    1: SPL.backup1 0x00020000 0x00020000 0
    2: SPL.backup2 0x00020000 0x00040000 0
    3: SPL.backup3 0x00020000 0x00060000 0
    4: u-boot 0x001e0000 0x00080000 0
    5: u-boot-env 0x00020000 0x00260000 0
    6: kernel 0x00520000 0x00280000 0
    7: rootfs 0x0f860000 0x007a0000 0

    active partition: nand0,0 - (SPL) 0x00020000 @ 0x00000000

    defaults:
    mtdids : nand0=omap2-nand.0
    mtdparts: mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),12
    8k(SPL.backup3),1920k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs)

     

    However, now I encountered another problem which is the valid VID header but corrupted EC header.

    I included the log for my current situation:

    5811.log.txt

    You see, I getting a lot of these errors:

    [ 1.723297] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 by
    tes from PEB 16:0, read 64 bytes
    [ 1.734161] UBI warning: process_eb: valid VID header but corrupted EC header
    at PEB 16
    [ 1.745025] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 by
    tes from PEB 17:0, read 64 bytes
    [ 1.755889] UBI warning: process_eb: valid VID header but corrupted EC header
    at PEB 17

     

    The following is the latest commands I use to make the ubi.img:

    sudo '/home/benz/Desktop/mtd/install/sbin/mkfs.ubifs' -q -r '/home/benz/Desktop/am335xevm/Filesystem' -F -m 2048 -e 126976 -c 2047 -o ubifs.img

    sudo '/home/benz/Desktop/mtd/install/sbin/ubinize' -o ubi.img -m 2048 -p 128KiB -s 2048 ubinize.cfg

    The content of ubinize.cfg is:

    [ubifs]
    mode=ubi
    image=ubifs.img
    vol_id=0
    vol_size=200MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_flags=autoresize

     

     

    Best regards,

    Benz

  • Benz,

    What version of the AM335x SDK/PSP are you using and what ECC scheme are you using to flash the rootfs to the NAND?

    Best regards,
    Miroslav

  • Hi Miroslav:

    I've got the same problem as Benz, and I'm using the TI-SDK-AM335x-EVM-07.00.00.00.

    I use the images under $(SDK)/board-support/prebuilt-images/ directory. Under u-boot, I flash the MLO, dtb, u-boot.img, zImage.bin to NAND, and I also flash the $(SDK)/filesystem/arago-base-tisdk-image-am335x-evm.ubi to NAND.

    After that, I reboot the EVM board, and I got the following logs:

    [    1.753789] Creating 10 MTD partitions on "omap2-nand.0":
    [    1.759792] 0x000000000000-0x000000020000 : "NAND.SPL"
    [    1.767567] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
    [    1.775574] 0x000000040000-0x000000060000 : "NAND.SPL.backup2"
    [    1.783539] 0x000000060000-0x000000080000 : "NAND.SPL.backup3"
    [    1.791525] 0x000000080000-0x0000000c0000 : "NAND.u-boot-spl-os"
    [    1.800150] 0x0000000c0000-0x0000001c0000 : "NAND.u-boot"
    [    1.808599] 0x0000001c0000-0x0000001e0000 : "NAND.u-boot-env"
    [    1.816386] 0x0000001e0000-0x000000200000 : "NAND.u-boot-env.backup1"
    [    1.824930] 0x000000200000-0x000000a00000 : "NAND.kernel"
    [    1.840328] 0x000000a00000-0x000010000000 : "NAND.file-system"
    [    2.091912] tps65910 0-002d: No interrupt support, no core IRQ
    [    2.100799] vrtc: 1800 mV 
    [    2.104262] vrtc: supplied by vbat
    [    2.109416] vio: at 1800 mV 
    [    2.112930] vio: supplied by vbat
    [    2.118140] vdd_mpu: 912 <--> 1375 mV at 1137 mV 
    [    2.123502] vdd_mpu: supplied by vbat
    [    2.129078] vdd_core: 912 <--> 1150 mV at 1137 mV 
    [    2.134524] vdd_core: supplied by vbat
    [    2.139943] vdd3: 5000 mV 
    [    2.144276] vdig1: at 1800 mV 
    [    2.147867] vdig1: supplied by vbat
    [    2.153075] vdig2: at 1800 mV 
    [    2.156657] vdig2: supplied by vbat
    [    2.161838] vpll: at 1800 mV 
    [    2.165328] vpll: supplied by vbat
    [    2.170410] vdac: at 1800 mV 
    [    2.173933] vdac: supplied by vbat
    [    2.179017] vaux1: at 1800 mV 
    [    2.182621] vaux1: supplied by vbat
    [    2.187774] vaux2: at 3300 mV 
    [    2.191381] vaux2: supplied by vbat
    [    2.196571] vaux33: at 3300 mV 
    [    2.200249] vaux33: supplied by vbat
    [    2.205545] vmmc: 1800 <--> 3300 mV at 3300 mV 
    [    2.210695] vmmc: supplied by vbat
    [    2.215419] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [    2.225453] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
    [    2.232651] edma-dma-engine edma-dma-engine.0: allocated channel for 0:25
    [    2.240159] edma-dma-engine edma-dma-engine.0: allocated channel for 0:24
    [    2.283772] UBI: attaching mtd9 to ubi0
    [    3.528936] UBI: scanning is finished
    [    3.546307] UBI: attached mtd9 (name "NAND.file-system", size 246 MiB) to ubi0
    [    3.554311] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
    [    3.561782] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
    [    3.569057] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
    [    3.576613] UBI: good PEBs: 1968, bad PEBs: 0, corrupted PEBs: 0
    [    3.583256] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
    [    3.591091] UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 145352975
    [    3.600844] UBI: available PEBs: 0, total reserved PEBs: 1968, PEBs reserved for bad PEB handling: 40
    [    3.610893] UBI: background thread "ubi_bgt0d" started, PID 832
    [    3.701091] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [    3.707840] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
    [    3.731921] libphy: 4a101000.mdio: probed
    [    3.736472] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver Atheros 8031 ethernet
    [    3.762011] Detected MACID = 40:5f:c2:8b:d6:c8
    [    3.783042] input: volume_keys.8 as /devices/volume_keys.8/input/input2
    [    3.801698] omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 00:00:02 UTC (946684802)
    [    3.831002] UBIFS: background thread "ubifs_bgt0_0" started, PID 846
    [    3.942660] UBI warning: ubi_io_read: error -74 (ECC error) while reading 148 bytes from PEB 249:129312, read only 148 bytes, retry
    [    3.972274] UBI warning: ubi_io_read: error -74 (ECC error) while reading 148 bytes from PEB 249:129312, read only 148 bytes, retry
    [    4.001872] UBI warning: ubi_io_read: error -74 (ECC error) while reading 148 bytes from PEB 249:129312, read only 148 bytes, retry
    [    4.032116] UBI error: ubi_io_read: error -74 (ECC error) while reading 148 bytes from PEB 249:129312, read 148 bytes
    [    4.043648] CPU: 0 PID: 1 Comm: swapper Not tainted 3.12.10-ti2013.12.01 #1
    [    4.051303] Backtrace: 
    [    4.054207] [<c0017880>] (dump_backtrace+0x0/0x10c) from [<c0017a1c>] (show_stack+0x18/0x1c)
    [    4.063419]  r6:dd2bc000 r5:00000094 r4:ffffffb6 r3:00000000
    [    4.070005] [<c0017a04>] (show_stack+0x0/0x1c) from [<c056b5b0>] (dump_stack+0x20/0x28)
    [    4.078771] [<c056b590>] (dump_stack+0x0/0x28) from [<c03ab7ac>] (ubi_io_read+0x128/0x2ec)
    [    4.087808] [<c03ab684>] (ubi_io_read+0x0/0x2ec) from [<c03a9010>] (ubi_eba_read_leb+0x174/0x428)
    [    4.097500] [<c03a8e9c>] (ubi_eba_read_leb+0x0/0x428) from [<c03a8590>] (ubi_leb_read+0xb0/0x124)
    [    4.107190] [<c03a84e0>] (ubi_leb_read+0x0/0x124) from [<c01fde50>] (ubifs_leb_read+0x2c/0x90)
    [    4.116594]  r8:000000f7 r7:000000f7 r6:0001e920 r5:00000094 r4:dd374e40
    [    4.124571] [<c01fde24>] (ubifs_leb_read+0x0/0x90) from [<c01ff9dc>] (ubifs_read_node+0xa0/0x2a8)
    [    4.134242]  r7:dd370000 r6:dd374e40 r5:0001e920 r4:dd374e40
    [    4.140821] [<c01ff93c>] (ubifs_read_node+0x0/0x2a8) from [<c0208c70>] (dbg_old_index_check_init+0x6c/0xe4)
    [    4.151425] [<c0208c04>] (dbg_old_index_check_init+0x0/0xe4) from [<c0205580>] (ubifs_read_master+0xb34/0xd40)
    [    4.162296] [<c0204a4c>] (ubifs_read_master+0x0/0xd40) from [<c01fb728>] (ubifs_mount+0xcd0/0x1674)
    [    4.172163] [<c01faa58>] (ubifs_mount+0x0/0x1674) from [<c00d473c>] (mount_fs+0x4c/0x18c)
    [    4.181109] [<c00d46f0>] (mount_fs+0x0/0x18c) from [<c00eb6b0>] (vfs_kern_mount+0x54/0xc8)
    [    4.190134] [<c00eb65c>] (vfs_kern_mount+0x0/0xc8) from [<c00ed53c>] (do_mount+0x1c8/0x8c8)
    [    4.199254]  r8:c07f5f04 r7:dd390580 r6:00000000 r5:00008000 r4:c07fcd9c
    r3:00000000
    [    4.208427] [<c00ed374>] (do_mount+0x0/0x8c8) from [<c00edcc8>] (SyS_mount+0x8c/0xc0)
    [    4.217018] [<c00edc3c>] (SyS_mount+0x0/0xc0) from [<c074bf6c>] (mount_block_root+0x108/0x240)
    [    4.226412]  r7:c0787294 r6:dd382000 r5:00008000 r4:dd382000
    [    4.233000] [<c074be64>] (mount_block_root+0x0/0x240) from [<c074c354>] (prepare_namespace+0x94/0x1cc)
    [    4.243140] [<c074c2c0>] (prepare_namespace+0x0/0x1cc) from [<c074bc1c>] (kernel_init_freeable+0x178/0x1bc)
    [    4.253725]  r5:00000007 r4:c07a13c4
    [    4.257817] [<c074baa4>] (kernel_init_freeable+0x0/0x1bc) from [<c0566268>] (kernel_init+0x10/0xec)
    [    4.267696] [<c0566258>] (kernel_init+0x0/0xec) from [<c00146f8>] (ret_from_fork+0x14/0x3c)
    [    4.276818]  r4:00000000 r3:00000000
    [    4.280904] UBIFS error (pid 1): ubifs_check_node: bad CRC: calculated 0x8492e3e1, read 0xf5217070
    [    4.290669] UBIFS error (pid 1): ubifs_check_node: bad node at LEB 247:125216
    [    4.298506]  magic          0x6101831
    [    4.302669]  crc            0xf5217070
    [    4.306911]  node_type      9 (indexing node)
    [    4.311810]  group_type     0 (no node group)
    [    4.316692]  sqnum          30637
    [    4.320473]  len            148
    [    4.324086]  child_cnt      6
    [    4.327500]  level          4
    [    4.330922]  Branches:
    [    4.333701]  0: LEB 1271:124104 len 188 key (1, inode)
    [    4.339415]  1: LEB 1271:124296 len 188 key (1214, data, 62)
    [    4.345693]  2: LEB 1271:124488 len 188 key (1541, data, 6)
    [    4.351877]  3: LEB 1271:124680 len 188 key (2274, direntry, 0x18c53933)
    [    4.359245]  4: LEB 247:124872 len 188 key (3403, data, 26)
    [    4.365427]  5: LEB 1271:125064 len 148 key (3792, inode)
    [    4.371425] CPU: 0 PID: 1 Comm: swapper Not tainted 3.12.10-ti2013.12.01 #1
    [    4.379064] Backtrace: 
    [    4.381955] [<c0017880>] (dump_backtrace+0x0/0x10c) from [<c0017a1c>] (show_stack+0x18/0x1c)
    [    4.391164]  r6:dd370000 r5:0001e920 r4:dd374e40 r3:00000000
    [    4.397739] [<c0017a04>] (show_stack+0x0/0x1c) from [<c056b5b0>] (dump_stack+0x20/0x28)
    [    4.406504] [<c056b590>] (dump_stack+0x0/0x28) from [<c01fe54c>] (ubifs_check_node+0x1c4/0x2dc)
    [    4.415998] [<c01fe388>] (ubifs_check_node+0x0/0x2dc) from [<c01ffa1c>] (ubifs_read_node+0xe0/0x2a8)
    [    4.425955] [<c01ff93c>] (ubifs_read_node+0x0/0x2a8) from [<c0208c70>] (dbg_old_index_check_init+0x6c/0xe4)
    [    4.436551] [<c0208c04>] (dbg_old_index_check_init+0x0/0xe4) from [<c0205580>] (ubifs_read_master+0xb34/0xd40)
    [    4.447424] [<c0204a4c>] (ubifs_read_master+0x0/0xd40) from [<c01fb728>] (ubifs_mount+0xcd0/0x1674)
    [    4.457285] [<c01faa58>] (ubifs_mount+0x0/0x1674) from [<c00d473c>] (mount_fs+0x4c/0x18c)
    [    4.466226] [<c00d46f0>] (mount_fs+0x0/0x18c) from [<c00eb6b0>] (vfs_kern_mount+0x54/0xc8)
    [    4.475265] [<c00eb65c>] (vfs_kern_mount+0x0/0xc8) from [<c00ed53c>] (do_mount+0x1c8/0x8c8)
    [    4.484380]  r8:c07f5f04 r7:dd390580 r6:00000000 r5:00008000 r4:c07fcd9c
    r3:00000000
    [    4.493556] [<c00ed374>] (do_mount+0x0/0x8c8) from [<c00edcc8>] (SyS_mount+0x8c/0xc0)
    [    4.502138] [<c00edc3c>] (SyS_mount+0x0/0xc0) from [<c074bf6c>] (mount_block_root+0x108/0x240)
    [    4.511530]  r7:c0787294 r6:dd382000 r5:00008000 r4:dd382000
    [    4.518107] [<c074be64>] (mount_block_root+0x0/0x240) from [<c074c354>] (prepare_namespace+0x94/0x1cc)
    [    4.528244] [<c074c2c0>] (prepare_namespace+0x0/0x1cc) from [<c074bc1c>] (kernel_init_freeable+0x178/0x1bc)
    [    4.538832]  r5:00000007 r4:c07a13c4
    [    4.542921] [<c074baa4>] (kernel_init_freeable+0x0/0x1bc) from [<c0566268>] (kernel_init+0x10/0xec)
    [    4.552789] [<c0566258>] (kernel_init+0x0/0xec) from [<c00146f8>] (ret_from_fork+0x14/0x3c)
    [    4.561905]  r4:00000000 r3:00000000
    [    4.565974] UBIFS error (pid 1): ubifs_read_node: expected node type 9
    [    4.573432] UBIFS: background thread "ubifs_bgt0_0" stops
    [    4.591576] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -117
    [    4.600438] Please append a correct "root=" boot option; here are the available partitions:
    [    4.609615] 1f00             128 mtdblock0  (driver?)
    [    4.615268] 1f01             128 mtdblock1  (driver?)
    [    4.620895] 1f02             128 mtdblock2  (driver?)
    [    4.626538] 1f03             128 mtdblock3  (driver?)
    [    4.632178] 1f04             256 mtdblock4  (driver?)
    [    4.637804] 1f05            1024 mtdblock5  (driver?)
    [    4.643444] 1f06             128 mtdblock6  (driver?)
    [    4.649074] 1f07             128 mtdblock7  (driver?)
    [    4.654713] 1f08            8192 mtdblock8  (driver?)
    [    4.660340] 1f09          251904 mtdblock9  (driver?)
    [    4.665981] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

    I've searched and found some tips on http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#Flashing_Kernel, which indicate that I should set the NAND ECC layout before I flash the ubifs, but I could not find 'nandecc' command under u-boot.

    Please give some advice to solve this problem, thanks.

  • Hello,

    The "nandecc" command was used in older versions of U-Boot. The latest versions use BCH8 ECC scheme by default in all cases except when storing the U-Boot environment variables, where Hamming Code is used.

    Regarding the ECC error:

    Did you erase the whole NAND flash before writing to it?

    Did you pass a large enough "size" argument to the "nand write" command, that would write everything to NAND and not cut some of the end of the filesystem? For example, using the default binaries and UBIFS from the SDK v7, I pass a size of 0x2950000 to my "nand write" command:

    nand write 0x81000000 0x0 0x2950000

    Best regards,
    Miroslav

  • Hi Miroslav:

    I've erase the whole NAND chip before flashing it, and I also pass a enough "size" to "nand write"(0x2950000), but I've got the same problem as above.

    I flashing NAND under U-Boot as following:

    U-Boot# nand erase.chip
    
    NAND erase.chip: device 0 whole chip
    Erasing at 0xffe0000 -- 100% complete.
    OK
    U-Boot# 
    U-Boot# mw.b 0x81000000 0xFF 0x2950000
    U-Boot# 
    U-Boot# 
    U-Boot# tftp 0x81000000 MLO-am335x-evm
    link up on port 0, speed 100, full duplex
    Using cpsw device
    TFTP from server 192.168.1.100; our IP address is 192.168.1.1
    Filename 'MLO-am335x-evm'.
    Load address: 0x81000000
    Loading: ########
             646.5 KiB/s
    done
    Bytes transferred = 107920 (1a590 hex)
    U-Boot# cp.b 0x81000000 0x81020000 20000; cp.b 0x81000000 0x81040000 20000; cp.b 0x81000000 0x81060000 20000
    U-Boot# tftp 0x81080000 am335x-evm.dtb
    link up on port 0, speed 100, full duplex
    Using cpsw device
    TFTP from server 192.168.1.100; our IP address is 192.168.1.1
    Filename 'am335x-evm.dtb'.
    Load address: 0x81080000
    Loading: ###
             579.1 KiB/s
    done
    Bytes transferred = 41564 (a25c hex)
    U-Boot# tftp 0x810c0000 u-boot-am335x-evm.img
    link up on port 0, speed 100, full duplex
    Using cpsw device
    TFTP from server 192.168.1.100; our IP address is 192.168.1.1
    Filename 'u-boot-am335x-evm.img'.
    Load address: 0x810c0000
    Loading: ###########################
             985.4 KiB/s
    done
    Bytes transferred = 389768 (5f288 hex)
    U-Boot# tftp 0x81200000 zImage-am335x-evm.bin
    link up on port 0, speed 100, full duplex
    Using cpsw device
    TFTP from server 192.168.1.100; our IP address is 192.168.1.1
    Filename 'zImage-am335x-evm.bin'.
    Load address: 0x81200000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #####################
             1.1 MiB/s
    done
    Bytes transferred = 4117616 (3ed470 hex)
    U-Boot# tftp 0x81a00000 arago-base-tisdk-image-am335x-evm.ubi
    link up on port 0, speed 100, full duplex
    Using cpsw device
    TFTP from server 192.168.1.100; our IP address is 192.168.1.1
    Filename 'arago-base-tisdk-image-am335x-evm.ubi'.
    Load address: 0x81a00000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #######################
             1.1 MiB/s
    done
    Bytes transferred = 32768000 (1f40000 hex)
    U-Boot# nand write 0x81000000 0x0 0x2950000
    
    NAND write: device 0 offset 0x0, size 0x2950000
     43319296 bytes written: OK
    U-Boot# 
    U-Boot# 

  • If you've got the Linux kernel booting off NAND then that's a good start.

    I found the easiest way to get the UBI rootfs going was to do the next easy step, which was to recompile the Linux kernel with an embedded initramfs containing the busybox shell.  Then boot this kernel off your NAND, and at least you now have a running Linux kernel on the target.

    To format the NAND UBIFS rootfs, I used the tools in arago-base-tisdk-image-am335x-evm.tgz (i.e. from the ti-sdk-06.00), which is a minimal rootfs (built using arago/bitbake).  I loaded this tar file off a USB stick attached to the target and extracted to the initramfs.

    To format the NAND (i.e. on the target):

    # flash_erase /dev/mtd7 0 0

    # ubiformat /dev/mtd7 -O 2048 -s 2048 -y

    # ubiattach /dev/ubi_ctrl -m 7 -O 2048
    # ubimkvol /dev/ubi0 -N rootfs -m
    # mount -t ubifs ubi0:rootfs /mnt/nand

    NB:  Make sure you use the ubi* tools from the arago tar file, not the 'cut-down' ones in busybox.

  • 请问这个问题最后是如何解决的?