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.

Failure to load ubl from NAND dm368 ubl / nand write issues?

We are developing on DM368 using the Appro IPNC SDK 4.x, hardware is based on the Leopardboard but using an MT29F1G08AB NAND chip.

After a fair bit of initial confusion getting the board up & running, we had UBL, U-Boot and the kernel & filesys burnt to the NAND with the correct system clocks for the DM368, and could then use TFTP through U-Boot to load updated kernel & filesys during development.

We now have prototype hardware, so it's completely blank, and we have an odd problem.

We are using a bootable SD card to burn UBL, U-Boot etc. to the board, which is what we used originally on the Leopardboard. However, although U-Boot reports no problems with erasing the NAND and writing the images, the board will not boot. It doesn't even load u-boot. However, if we reinsert the SD card, it boots the UBL & U-Boot from the SD card, then picks up the kernel image in NAND and will boot that, although it does throw a lot of ECC errors and has a kernel panic.

Our bootable SD card is executing the following commands:

echo  SDCard Installer Script Generated by RidgeRun SDK
echo  "==== Modified by Bob ===="
echo  Target Platform: Leopard Board DM368
echo
askenv dummy "  Press the any key to continue..." 1

nand erase.chip clean

fatload mmc 0 ${loadaddr} ubl_nand.nandbin
nand write ${loadaddr} 0x20000 ${filesize}

fatload mmc 0 ${loadaddr} bootloader.nandbin
nand write ${loadaddr} 0x320000 ${filesize}

fatload mmc 0 ${loadaddr} kernel.uImage
nand write ${loadaddr} 0x500000 ${filesize}

fatload mmc 0 ${loadaddr} fsimage.uImage
nand write.ubl ${loadaddr} 0x900000 ${filesize}

setenv bootargs 'mem=48M console=ttyS0,115200n8 noinitrd ip=192.168.2.168:192.168.2.10:192.168.2.254:255.255.255.0:::off rw ubi.mtd=3,2048 rootfstype=ubifs root=ubi0:rootfs cmemk.phys_start=0x83000000 cmemk.phys_end=0x88000000 cmemk.phys_start_1=0x00001000 cmemk.phys_end_1=0x00008000 cmemk.pools_1=1x28672 cmemk.allowOverlap=1 cmemk.useHeapIfPoolUnavailable=1 lpj=1077248 nohz=off highres=off eth=00:0c:0c:A0:04:31 earlyprintk video=davincifb:vid1=1280x720x16,8100K:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4'
setenv bootdelay 3
setenv bootfile uImage
setenv bootcmd 'nboot 0x80700000 0 0x500000;bootm 0x80700000'
setenv gatewayip 192.168.2.254
setenv ipaddr 192.168.2.160
setenv nfshost 192.168.2.10
setenv serverip 192.168.2.10

saveenv

echo
echo " ======= Installation Complete! "
echo
echo "You may restart your board by"
echo "  - turning off power,"
echo "  - removing the SD card,"
echo "  - setting hardware to boot from NAND, and"
echo "  - powering on the board."
echo "  - dipping in coffee."
echo
echo

When the board boots, using the SD card's UBL & U-Boot, the console output is:

U-Boot 2010.12-rc2 (Jul 07 2011 - 16:42:20) ##This is the SD card's u_boot

Cores: ARM 297 MHz
DDR:   243 MHz
I2C:   ready
DRAM:  128 MiB
NAND:  128 MiB
MMC:   davinci: 0, davinci: 1
Net:   Ethernet PHY: GENERIC @ 0x00
DaVinci-EMAC
Hit any key to stop autoboot:  0

Loading from nand0, offset 0x500000
   Image Name:   Linux-2.6.37_bobIPNC_DM368n_4.0.0
   Created:      2013-07-11  11:42:30 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3439968 Bytes = 3.3 MiB
   Load Address: 80008000
   Entry Point:  80008000
## Booting kernel from Legacy Image at 80700000 ...
   Image Name:   Linux-2.6.37_bobIPNC_DM368n_4.0.0
   Created:      2013-07-11  11:42:30 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3439968 Bytes = 3.3 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

[    0.000000] Linux version 2.6.37_bobIPNC_DM368n_4.0.0 (root@Bob-VirtualBox) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Thu Jul 11 12:42:29 BST 2013
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: DaVinci DM36x IPNC
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] DaVinci dm36x_rev1.2 variant 0x8
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 12192
[    0.000000] Kernel command line: mem=48M console=ttyS0,115200n8 noinitrd ip=192.168.2.168:192.168.2.10:192.168.2.254:255.255.255.0:::off rw ubi.mtd=3,2048 rootfstype=ubifs root=ubi0:rootfs cmemk.phys_start=0x83000000 cmemk.phys_end=0x88000000 cmemk.phys_start_1=0x00001000 cmemk.phys_end_1=0x00008000 cmemk.pools_1=1x28672 cmemk.allowOverlap=1 cmemk.useHeapIfPoolUnavailable=1 lpj=1077248 nohz=off highres=off eth=00:0c:0c:A0:04:31 earlyprintk video=davincifb:vid1=1280x720x16,8100K:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4
[    0.000000] TI DaVinci EMAC: kernel boot params Ethernet address: 00:0c:0c:A0:04:31
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 48MB = 48MB total
[    0.000000] Memory: 45184k/45184k available, 3968k 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]     DMA     : 0xff000000 - 0xffe00000   (  14 MB)
[    0.000000]     vmalloc : 0xc3800000 - 0xfea00000   ( 946 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc3000000   (  48 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .init : 0xc0008000 - 0xc0028000   ( 128 kB)
[    0.000000]       .text : 0xc0028000 - 0xc032c000   (3088 kB)
[    0.000000]       .data : 0xc032c000 - 0xc034fd60   ( 144 kB)
[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptable hierarchical RCU implementation.
[    0.000000]  RCU-based detection of stalled CPUs is disabled.
[    0.000000]  Verbose stalled-CPUs detection is disabled.
[    0.000000] NR_IRQS:245
[    0.000000] Console: colour dummy device 80x30
[    0.000415] Calibrating delay loop (skipped) preset value.. 215.44 BogoMIPS (lpj=1077248)
[    0.000498] pid_max: default: 32768 minimum: 301
[    0.000894] Mount-cache hash table entries: 512
[    0.001985] CPU: Testing write buffer coherency: ok
[    0.008253] DaVinci: 8 gpio irqs
[    0.009104] NET: Registered protocol family 16
[    0.124125] bio: create slab <bio-0> at 0
[    0.130929] SCSI subsystem initialized
[    0.136108] usbcore: registered new interface driver usbfs
[    0.137930] usbcore: registered new interface driver hub
[    0.139143] usbcore: registered new device driver usb
[    0.143816] vpss vpss: dm365_vpss vpss probed
[    0.143906] vpss vpss: dm365_vpss vpss probe success
[    0.146570] Advanced Linux Sound Architecture Driver Version 1.0.23.
[    0.149320] Switching to clocksource timer0_1
[    0.235809] NET: Registered protocol family 2
[    0.236238] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.237377] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.237585] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.237716] TCP: Hash tables configured (established 2048 bind 2048)
[    0.237761] TCP reno registered
[    0.237818] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.237909] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.238626] NET: Registered protocol family 1
[    0.332754] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.337655] msgmni has been set to 88
[    0.341703] io scheduler noop registered (default)
[    0.343685] CSL: Module install successful, device major num = 254
[    0.343754] CSL: Module version 0.10.00, built on jul 11 2013 12:35:00
[    0.343826] I2C: Module install successful, device major num = 253
[    0.343881] DMA: Module install successful, device major num = 252
[    0.343921] DRV: Module install successful
[    0.343956] DRV: Module built on Jul 11 2013 12:35:02
[    0.343995] DRV: EDMACC.QUEPRI  = 00002777
[    0.344028] DRV: SYSTEM.MSTPRI0 = 00440011
[    0.344060] DRV: SYSTEM.MSTPRI1 = 00000444
[    0.344092] DRV: ISP.BCR        = 00000002
[    0.344124] DRV: SYSTEM.MISC    = 00000199
[    0.344157] EDMAK module: built on Jul 11 2013 at 12:34:48
[    0.344201]   Reference Linux version 2.6.37
[    0.346213] IRQK module: built on Jul 11 2013 at 12:34:45
[    0.346287]   Reference Linux version 2.6.37
[    0.348268] irqk initialized
[    0.348366] CMEMK module: built on Jul 11 2013 at 12:34:47
[    0.348422]   Reference Linux version 2.6.37
[    0.355448] allocated heap buffer 0xc4000000 of size 0x5000000
[    0.355511] heap fallback enabled - will try heap if pool buffer is not available
[    0.355571] CMEM Range Overlaps Kernel Physical - allowing overlap
[    0.355621] CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83000000)
[    0.355822] cmemk initialized
[    0.355902] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.390450] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A
[    0.877980] console [ttyS0] enabled
[    0.913267] serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A
[    0.924753] brd: module loaded
[    0.939646] ONFI flash detected
[    0.943414] ONFI param page 0 valid
[    0.946972] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron NAND 128MiB 3,3V 8-bit)
[    0.957549] Bad block table not found for chip 0
[    0.963880] Bad block table not found for chip 0
[    0.968536] Scanning device for bad blocks
[    1.067379] Creating 7 MTD partitions on "davinci_nand.0":
[    1.073072] 0x000000000000-0x000000300000 : "bootloader"
[    1.083953] 0x000000300000-0x000000500000 : "params"
[    1.094549] 0x000000500000-0x000000900000 : "kernel"
[    1.105316] 0x000000900000-0x000003100000 : "filesystem1"
[    1.116798] 0x000003100000-0x000003300000 : "data1"
[    1.127713] 0x000003300000-0x000005b00000 : "filesystem2"
[    1.139306] 0x000005b00000-0x000008000000 : "data2"
[    1.150740] davinci_nand davinci_nand.0: controller rev. 2.3
[    1.160717] UBI: attaching mtd3 to ubi0
[    1.164610] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[    1.171304] UBI: logical eraseblock size:    126976 bytes
[    1.176745] UBI: smallest flash I/O unit:    2048
[    1.181585] UBI: sub-page size:              512
[    1.186237] UBI: VID header offset:          2048 (aligned 2048)
[    1.192384] UBI: data offset:                4096
[    1.485301] UBI: max. sequence number:       6
[    1.507596] UBI: attached mtd3 to ubi0
[    1.511551] UBI: MTD device name:            "filesystem1"
[    1.517079] UBI: MTD device size:            40 MiB
[    1.522130] UBI: number of good PEBs:        320
[    1.526778] UBI: number of bad PEBs:         0
[    1.531326] UBI: number of corrupted PEBs:   0
[    1.535802] UBI: max. allowed volumes:       128
[    1.540507] UBI: wear-leveling threshold:    4096
[    1.545236] UBI: number of internal volumes: 1
[    1.549697] UBI: number of user volumes:     1
[    1.554217] UBI: available PEBs:             0
[    1.558688] UBI: total number of reserved PEBs: 320
[    1.563638] UBI: number of PEBs reserved for bad PEB handling: 3
[    1.569676] UBI: max/mean erase counter: 1/0
[    1.574012] UBI: image sequence number:  1629873885
[    1.578974] UBI: background thread "ubi_bgt0d" started, PID 400
[    1.640145] davinci_mdio davinci_mdio.0: davinci mdio revision 1.4
[    1.646388] davinci_mdio davinci_mdio.0: detected phy mask fffffffc
[    1.656592] davinci_mdio.0: probed
[    1.660344] davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
[    1.667453] davinci_mdio davinci_mdio.0: phy[1]: device 0:01, driver unknown
[    1.675644] i2c /dev entries driver
[    1.682190] Linux media interface: v0.10
[    1.687095] Linux video capture interface: v2.00
[    1.694849] vpbe-osd vpbe-osd: OSD sub device probe success
[    1.701780] vpbe-venc vpbe-venc: VENC sub device probe success
[    1.708982] vpbe-v4l2 vpbe-v4l2: vpbe v4l2 device registered
[    1.715168] Setting default output to Composite
[    1.719750] Setting default mode to ntsc
[    1.724046] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device.
[    1.730897] vpbe-v4l2 vpbe-v4l2: layer=c28c2e00,layer->video_dev=c28c2ee8
[    1.738792] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device.
[    1.745837] vpbe-v4l2 vpbe-v4l2: layer=c28c2800,layer->video_dev=c28c28e8
[    1.755208] watchdog watchdog: heartbeat 60 sec
[    1.767240] Error: Driver 'davinci-mcbsp' is already registered, aborting...
[    1.778320] asoc: cq93vc-hifi <-> davinci-vcif mapping ok
[    1.788692] ALSA device list:
[    1.792092]   #0: DaVinci DM365 EVM
[    1.797408] TCP cubic registered
[    1.801103] NET: Registered protocol family 17
[    1.818249] net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, id=221613)
[    1.841202] IP-Config: Complete:
[    1.844309]      device=eth0, addr=192.168.2.168, mask=255.255.255.0, gw=192.168.2.254,
[    1.852454]      host=192.168.2.168, domain=, nis-domain=(none),
[    1.858496]      bootserver=192.168.2.10, rootserver=192.168.2.10, rootpath=
[    1.896058] UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read 126976 bytes
[    1.934867] UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read 126976 bytes
[    1.947744] UBIFS: recovery needed
[    1.953019] UBI error: ubi_io_read: error -74 (ECC error) while reading 11 bytes from PEB 9:6144, read 11 bytes
[    1.981048] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
[    1.988145] Please append a correct "root=" boot option; here are the available partitions:
[    1.996845] 1f00            3072 mtdblock0  (driver?)
[    2.002111] 1f01            2048 mtdblock1  (driver?)
[    2.007217] 1f02            4096 mtdblock2  (driver?)
[    2.012465] 1f03           40960 mtdblock3  (driver?)
[    2.017573] 1f04            2048 mtdblock4  (driver?)
[    2.022779] 1f05           40960 mtdblock5  (driver?)
[    2.027888] 1f06           37888 mtdblock6  (driver?)
[    2.033070] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.041421] Backtrace:
[    2.043908] Function entered at [<c002c4ec>] from [<c02bfaa4>]
[    2.049766]  r7:00008000 r6:c2813000 r5:c002291c r4:c03504c0
[    2.055563] Function entered at [<c02bfa8c>] from [<c02bfb10>]
[    2.061468] Function entered at [<c02bfaa8>] from [<c0008f8c>]
[    2.067327]  r3:00000000 r2:00000000 r1:c2825f78 r0:c02dc2f9
[    2.073125] Function entered at [<c0008d20>] from [<c00090e8>]
[    2.078985] Function entered at [<c0009054>] from [<c00084b4>]
[    2.084891]  r5:c00220b8 r4:c034fd78
[    2.088513] Function entered at [<c00083a4>] from [<c0040e28>]
[    2.094420]  r5:c00083a4 r4:00000000

We've had this NAND problem before but the thread with the answer is no longer around... I believe the issue is around which parts of the image are in which filesystem format, and where the U-Boot nand write / nand write.ubl commands are used. As far as I can see, only the root filesystem is a UBIFS image - In the IPNC SDK we build "make sysall" then "make ubifs" which ubinizes the target filesystem. The kernel is in a file called "uImage" but there's no "ubinize" call on it.

Can anyone tell me where I've gone wrong with this?

  • I've done some testing with a spare leopardboard just to rule out our hardware;

    It seems to be the case that none of the IPNC UBL or u-boot images work;

    If I burn the RidgeRun / leopardBoard UBL (ubl_nand.nandbin) it works, if I burn ubl_432arm_340ddr_ipnc_dm368.bin it doesn't even start.

    Reverting to the RR UBL and burning u-boot-1.3.4-dm368_ipnc.bin gives this message at boot:

     NAND
    Starting NAND Copy...
    No valid boot image found!
    NAND Boot failed.
    Aborting...

    I have tried "nand write " and "nand write.ubl" for both the UBL and U-Boot images with no difference.

    Burning the RideRun U-Boot bootloader.nandbin works & boots.

    I would be happy enough to use the RR UBL / U-Boot except the system clocks end up at DM365 speeds (297MHz / 243MHz) rather than 432MHz + 340MHz.

  • I have also tried "5460.UBL_DM36x_NAND_ARM432_DDR340_OSC24.bin" mentioned in this post, but that doesn't boot either.

    I have the feeling I'm missing some step here, like adding a magicnum or header to the UBL or U-boot?

  • Well I managed to get the DM368 UBL + U-Boot on using the dm3xx_sd_boot-6_leopard tool. I'm not clear on what magic that is doing to make it work compared to writing it from u-boot?

    Anyway, U-Boot now falls over at loading the kernel:

    Loading from nand0, offset 0x500000
       Image Name:   Linux-2.6.37_bobIPNC_DM368n_4.0.0
       Created:      2013-07-17  16:29:57 UTC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    3439968 Bytes = 3.3 MiB
       Load Address: 80008000
       Entry Point:  80008000
    ## Booting kernel from Legacy Image at 80700000 ...
       Image Name:   Linux-2.6.37_bobIPNC_DM368n_4.0.0
       Created:      2013-07-17  16:29:57 UTC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    3439968 Bytes = 3.3 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... Bad Data CRC
    ERROR: can't get kernel image!
    DM36x EVM #

    If I use setenv verify no it will just  say "Loading kernel..." and hang forever.

  • To rule out a few more possibilities...

    If I manually set the machine ID to 1939 (davinci_dm36x_ipnc/evm) it makes no difference.

    The serial port is not wrong as I see the full bootlog on the Leopardboard through the same port w/ same software.

    The only difference I can really see is our NAND is MT29F1G08... (128MiB) and the Leopard is MT29F2G08... (256MiB) but the kernel + filesys are way less than this, and U-Boot seems to recognise correctly that the BBT is to be written at 0x7FE0000 on our board and 0xFFE0000 on the Leopard.

    I have started a new thread for this as it's a separate question than U-Boot / UBL.