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.

OMAP-L138: u-boot and kernel in NAND flash can't be found when they were written with Linux user space commands

Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138,

Hi,

I am using the newest processor SDK(ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106-Linux-x86-Install.bin) in one custom EVM board, so the u-boot version is 2019.01 and the Linux kernel version is 4.19.94. I followed the link below to build the u-boot and Linux kernel separately. The config file of u-boot is "omapl138_lcdk_defconfig" and the one of Linux kernel is "tisdk_omapl138-lcdk_defconfig".  When all the builds were done, I replaced all the files in "board-support/prebuit-images" withe the new ones(two .dtb file, u-boot-spl.bin, u-boot.ais and zImage).  After that, I ran the script "bin/create-sdcard.sh" to create a bootable SD card.

When all were done, I can start up the EVM board successfully, and I can also get the MTD partitions as below:
root@omapl138-lcdk:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00020000 00020000 "env"
mtd1: 00100000 00020000 "u-boot"
mtd2: 00020000 00020000 "NAND.u-boot-spl-os"
mtd3: 00500000 00020000 "NAND.kernel"
mtd4: 1f9c0000 00020000 "NAND.file-system"
root@omapl138-lcdk:~# nandtest /dev/mtd1
ECC corrections: 0
ECC failures : 0
Bad blocks : 0
BBT blocks : 0
000e0000: checking...of 4)...
Finished pass 1 successfully
root@omapl138-lcdk:~# nandtest /dev/mtd2
ECC corrections: 0
ECC failures : 0
Bad blocks : 0
BBT blocks : 0
00000000: checking...of 4)...
Finished pass 1 successfully
root@omapl138-lcdk:~# nandtest /dev/mtd3
ECC corrections: 0
ECC failures : 0
Bad blocks : 0
BBT blocks : 0
004e0000: checking...of 4)...
Finished pass 1 successfully

I ran the command "flash_erase" and "dd" to write the u-boot, the device tree, and zImage into the NAND flash as below. Both commands are fine. But when I tried to reboot the EVM from NAND, I can't see anything from the console.

root@omapl138-lcdk:/home/gw# flash_erase /dev/mtd1 0 0
Erasing 128 Kibyte @ e0000 -- 100 % complete
root@omapl138-lcdk:/home/gw# dd if=u-boot.ais of=/dev/mtdblock1
1279+1 records in
1279+1 records out
root@omapl138-lcdk:/home/gw# flash_erase /dev/mtd2 0 0
Erasing 128 Kibyte @ 0 -- 100 % complete
root@omapl138-lcdk:/home/gw# dd if=da850-lcdk.dtb of=/dev/mtdblock2
39+1 records in
39+1 records out
root@omapl138-lcdk:/home/gw# flash_erase /dev/mtd3 0 0
Erasing 128 Kibyte @ 4e0000 -- 100 % complete
root@omapl138-lcdk:/home/gw# dd if=zImage of=/dev/mtdblock3
6801+1 records in
6801+1 records out

But if I started up the EVM from SD card and wrote them into NAND flash from u-boot console, everything works fine - I can start up u-boot and Linux kernel from NAND flash

Hit any key to stop autoboot: 0
=> mtdparts

device nand0 <davinci_nand.0>, # parts = 5
#: name size offset mask_flags
0: env 0x00020000 0x00000000 0
1: u-boot 0x00100000 0x00020000 0
2: NAND.u-boot-spl-os 0x00020000 0x00120000 0
3: NAND.kernel 0x00500000 0x00140000 0
4: NAND.file-system 0x1f9c0000 0x00640000 0

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

defaults:
mtdids : nand0=davinci_nand.0
mtdparts: mtdparts=davinci_nand.0:128k(env),1m(u-boot),128k(NAND.u-boot-spl-os),5M(NAND.kernel),-(NAND.file-system)
=> set serverip 10.42.19.6
=> setenv bootfile ${serverip}:u-boot.ais
=> dhcp 0xc0700000
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 10.42.19.151 (1046 ms)
Using DaVinci-EMAC device
TFTP from server 10.42.19.6; our IP address is 10.42.19.151
Filename 'u-boot.ais'.
Load address: 0xc0700000
Loading: #############################################
4.8 MiB/s
done
Bytes transferred = 655028 (9feb4 hex)
=> nand erase 0x00020000 0x00100000

NAND erase: device 0 offset 0x20000, size 0x100000
Erasing at 0x100000 -- 100% complete.
OK
=> nand write 0xc0700000 0x00020000 0x00100000

NAND write: device 0 offset 0x20000, size 0x100000
1048576 bytes written: OK
=>

I am attaching the DTS file and git diff as the attached.

  • Hi Songtao,
    I'm attaching a log file for flashing u-boot/kernel/ubi_rootfs... to NAND @u-boot prompt.
    The log was captured on AM335x GP EVM as I don't currently have access to OMAP-L138 board.
    Some options for flashing NAND @kernel would be using "nandwrite", "nanddump"... cmds or "mtd-utils" cmds.
    These cmds would be more reliable for handling NAND bad-block, ECC... than directly using "dd" cmd.
    software-dl.ti.com/.../NAND.html
    Best,
    -Hong

    => mmc part
    
    Partition Map for MMC device 0  --   Partition Type: DOS
    
    Part	Start Sector	Num Sectors	UUID		Type
      1	2048      	143360    	64f02263-01	0c Boot
      2	145408    	31244288  	64f02263-02	83
    => ls mmc 0:1
       802120   u-boot.img
       110460   MLO
        65952   MLO.byteswap
       375744   u-boot_spi.img
                k2g/
       110460   MLO_ok
                am3_gp_uart/
                System Volume Information/
       802120   u-boot_ok.img
    
    6 file(s), 3 dir(s)
    
    => ls mmc 0:2
    <DIR>       4096 .
    <DIR>       4096 ..
    <DIR>       4096 lib
    <DIR>       4096 media
    <DIR>       4096 home
    <DIR>       4096 proc
    <DIR>       4096 dev
    <SYM>         19 linuxrc
    <DIR>       4096 tmp
    <DIR>       4096 www
    <DIR>       4096 boot
    <DIR>       4096 include
    <DIR>       4096 var
    <DIR>       4096 sys
    <DIR>       4096 sbin
    <DIR>       4096 mnt
    <DIR>       4096 bin
    <DIR>       4096 usr
    <DIR>       4096 srv
    <DIR>       4096 etc
    <DIR>       4096 run
    <DIR>       4096 opt
    => ls mmc 0:2 boot
    <DIR>       4096 .
    <DIR>       4096 ..
               37965 am335x-boneblack-prusuart.dtb
               37192 am335x-boneblack-pru-adc.dtb
               37566 am335x-icev2-prueth-pps.dtb
               41524 am335x-evm.dtb
               35001 am335x-bone.dtb
               35225 am335x-bonegreen.dtb
               37124 am335x-icev2.dtb
               34055 am335x-pocketbeagle.dtb
               36717 am335x-boneblack.dtb
            15894420 vmlinux-4.19.94-gbe5389fd85
               39511 am335x-icev2-pru-excl-uio.dtb
               40236 am335x-evmsk.dtb
               36352 am335x-boneblue.dtb
               37305 am335x-sancloud-bbe.dtb
               37166 am335x-icev2-prueth.dtb
               37092 am335x-boneblack-iot-cape.dtb
    <SYM>         26 zImage
               37934 am335x-boneblack-wireless.dtb
               36542 am335x-bonegreen-wireless.dtb
             4280832 zImage-4.19.94-gbe5389fd85
               35001 am335x-bone-am335x-evm.dtb
               36717 am335x-boneblack-am335x-evm.dtb
               37092 am335x-boneblack-iot-cape-am335x-evm.dtb
               37192 am335x-boneblack-pru-adc-am335x-evm.dtb
               37965 am335x-boneblack-prusuart-am335x-evm.dtb
               37934 am335x-boneblack-wireless-am335x-evm.dtb
               36352 am335x-boneblue-am335x-evm.dtb
               35225 am335x-bonegreen-am335x-evm.dtb
               36542 am335x-bonegreen-wireless-am335x-evm.dtb
               41524 am335x-evm-am335x-evm.dtb
               40236 am335x-evmsk-am335x-evm.dtb
               37124 am335x-icev2-am335x-evm.dtb
               39511 am335x-icev2-pru-excl-uio-am335x-evm.dtb
               37166 am335x-icev2-prueth-am335x-evm.dtb
               37566 am335x-icev2-prueth-pps-am335x-evm.dtb
               34055 am335x-pocketbeagle-am335x-evm.dtb
               37305 am335x-sancloud-bbe-am335x-evm.dtb
             4280832 zImage-4.19.94-gbe5389fd85_bkup
               41524 am335x-evm_bkup.dtb
               41524 am335x-evm-300MHz-t1.dtb
    => ls mmc 0:2 media
    <DIR>       4096 .
    <DIR>       4096 ..
    <DIR>       4096 ram
           134086656 arago-base-tisdk-image-am335x-evm.ubi
            10878976 arago-tiny-image-am335x-evm.ubi
    => mtdparts
    
    device nand0 <nand.0>, # parts = 10
     #: name		size		offset		mask_flags
     0: NAND.SPL            0x00020000	0x00000000	0
     1: NAND.SPL.backup1    0x00020000	0x00020000	0
     2: NAND.SPL.backup2    0x00020000	0x00040000	0
     3: NAND.SPL.backup3    0x00020000	0x00060000	0
     4: NAND.u-boot-spl-os  0x00040000	0x00080000	0
     5: NAND.u-boot         0x00100000	0x000c0000	0
     6: NAND.u-boot-env     0x00020000	0x001c0000	0
     7: NAND.u-boot-env.backup10x00020000	0x001e0000	0
     8: NAND.kernel         0x00800000	0x00200000	0
     9: NAND.file-system    0x0f600000	0x00a00000	0
    
    active partition: nand0,0 - (NAND.SPL) 0x00020000 @ 0x00000000
    
    defaults:
    mtdids  : nand0=nand.0
    mtdparts: mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)
    => nand erase.chip
    
    NAND erase.chip: device 0 whole chip
    Erasing at 0x0 --   0% complete.Erasing at 0x280000 --   1% complete.Erasing at 0x500000 --   2% complete.Erasing at 0x7a0000 --   3% complete.Erasing at 0xa20000 --   4% complete.Skipping bad block at  0x00c80000                                          
    Skipping bad block at  0x00ca0000                                          
    Erasing at 0xcc0000 --   5% complete.Erasing at 0xf40000 --   6% complete.Erasing at 0x11e0000 --   7% complete.Erasing at 0x1460000 --   8% complete.Erasing at 0x1700000 --   9% complete.Erasing at 0x1980000 --  10% complete.Erasing at 0x1c20000 --  11% complete.Erasing at 0x1ea0000 --  12% complete.Erasing at 0x2140000 --  13% complete.Erasing at 0x23c0000 --  14% complete.Erasing at 0x2660000 --  15% complete.Erasing at 0x28e0000 --  16% complete.Erasing at 0x2b80000 --  17% complete.Erasing at 0x2e00000 --  18% complete.Erasing at 0x30a0000 --  19% complete.Erasing at 0x3320000 --  20% complete.Erasing at 0x35c0000 --  21% complete.Erasing at 0x3840000 --  22% complete.Erasing at 0x3ae0000 --  23% complete.Erasing at 0x3d60000 --  24% complete.Erasing at 0x3fe0000 --  25% complete.Erasing at 0x4280000 --  26% complete.Erasing at 0x4500000 --  27% complete.Erasing at 0x47a0000 --  28% complete.Erasing at 0x4a20000 --  29% complete.Erasing at 0x4cc0000 --  30% complete.Erasing at 0x4f40000 --  31% complete.Erasing at 0x51e0000 --  32% complete.Erasing at 0x5460000 --  33% complete.Erasing at 0x5700000 --  34% complete.Erasing at 0x5980000 --  35% complete.Erasing at 0x5c20000 --  36% complete.Erasing at 0x5ea0000 --  37% complete.Erasing at 0x6140000 --  38% complete.Erasing at 0x63c0000 --  39% complete.Erasing at 0x6660000 --  40% complete.Erasing at 0x68e0000 --  41% complete.Erasing at 0x6b80000 --  42% complete.Erasing at 0x6e00000 --  43% complete.Erasing at 0x70a0000 --  44% complete.Erasing at 0x7320000 --  45% complete.Erasing at 0x75c0000 --  46% complete.Erasing at 0x7840000 --  47% complete.Erasing at 0x7ae0000 --  48% complete.Erasing at 0x7d60000 --  49% complete.Erasing at 0x7fe0000 --  50% complete.Erasing at 0x8280000 --  51% complete.Erasing at 0x8500000 --  52% complete.Erasing at 0x87a0000 --  53% complete.Erasing at 0x8a20000 --  54% complete.Erasing at 0x8cc0000 --  55% complete.Erasing at 0x8f40000 --  56% complete.Erasing at 0x91e0000 --  57% complete.Erasing at 0x9460000 --  58% complete.Erasing at 0x9700000 --  59% complete.Erasing at 0x9980000 --  60% complete.Erasing at 0x9c20000 --  61% complete.Erasing at 0x9ea0000 --  62% complete.Erasing at 0xa140000 --  63% complete.Erasing at 0xa3c0000 --  64% complete.Erasing at 0xa660000 --  65% complete.Erasing at 0xa8e0000 --  66% complete.Erasing at 0xab80000 --  67% complete.Erasing at 0xae00000 --  68% complete.Erasing at 0xb0a0000 --  69% complete.Erasing at 0xb320000 --  70% complete.Erasing at 0xb5c0000 --  71% complete.Erasing at 0xb840000 --  72% complete.Erasing at 0xbae0000 --  73% complete.Erasing at 0xbd60000 --  74% complete.Erasing at 0xbfe0000 --  75% complete.Erasing at 0xc280000 --  76% complete.Erasing at 0xc500000 --  77% complete.Erasing at 0xc7a0000 --  78% complete.Erasing at 0xca20000 --  79% complete.Erasing at 0xccc0000 --  80% complete.Erasing at 0xcf40000 --  81% complete.Erasing at 0xd1e0000 --  82% complete.Erasing at 0xd460000 --  83% complete.Erasing at 0xd700000 --  84% complete.Erasing at 0xd980000 --  85% complete.Erasing at 0xdc20000 --  86% complete.Erasing at 0xdea0000 --  87% complete.Erasing at 0xe140000 --  88% complete.Erasing at 0xe3c0000 --  89% complete.Erasing at 0xe660000 --  90% complete.Erasing at 0xe8e0000 --  91% complete.Erasing at 0xeb80000 --  92% complete.Erasing at 0xee00000 --  93% complete.Erasing at 0xf0a0000 --  94% complete.Erasing at 0xf320000 --  95% complete.Erasing at 0xf5c0000 --  96% complete.Erasing at 0xf840000 --  97% complete.Erasing at 0xfae0000 --  98% complete.Erasing at 0xfd60000 --  99% complete.Erasing at 0xffe0000 -- 100% complete.
    OK
    => load mmc 0:1 ${loadaddr} MLO
    110460 bytes read in 10 ms (10.5 MiB/s)
    => nand write ${loadaddr} NAND.SPL ${filesize}
    
    NAND write: device 0 offset 0x0, size 0x1af7c
     110460 bytes written: OK
    => load mmc 0:1 ${loadaddr} u-boot.img
    802120 bytes read in 55 ms (13.9 MiB/s)
    => nand write ${loadaddr} NAND.u-boot ${filesize}
    
    NAND write: device 0 offset 0xc0000, size 0xc3d48
     802120 bytes written: OK
    => load mmc 0:2 ${loadaddr} boot/am335x-evm.dtb
    41524 bytes read in 6 ms (6.6 MiB/s)
    => nand write ${loadaddr} NAND.u-boot-spl-os ${filesize}
    
    NAND write: device 0 offset 0x80000, size 0xa234
     41524 bytes written: OK
    => load mmc 0:2 ${loadaddr} boot/zImage
    4280832 bytes read in 279 ms (14.6 MiB/s)
    => nand write ${loadaddr} NAND.kernel ${filesize}
    
    NAND write: device 0 offset 0x200000, size 0x415200
     4280832 bytes written: OK
    => load mmc 0:2 ${loadaddr} media/arago-tiny-image-am335x-evm.ubi
    10878976 bytes read in 704 ms (14.7 MiB/s)
    => nand write ${loadaddr} NAND.file-system ${filesize}
    
    NAND write: device 0 offset 0xa00000, size 0xa60000
    Skip bad block 0x00c80000
    Skip bad block 0x00ca0000
     10878976 bytes written: OK
    =>