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.
Hi everyone,
I have trouble to boot from NAND with my custom board that has a AM3352 on it. I have read a lot of post around this subject, but I couldn't find a solution that worked for me. I think my problem is around the creation of the UBIFS image but I cant see where because I am following the guide. First, I'll explain what I did.
I have a u-boot, kernel and filesystem that can boot from SD without problem. If I take those files, create a UBIFS filesystem and use the mkmmc-android-ubifs.sh script, everything seems to go fine until I actually boot from NAND. I get the following error during the boot process:
[ 1.309143] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron MT29F4G08ABADAWP)
[ 1.318298] Creating 8 MTD partitions on "omap2-nand.0":
[ 1.323974] 0x000000000000-0x000000020000 : "SPL"
[ 1.330322] 0x000000020000-0x000000040000 : "SPL.backup1"
[ 1.337249] 0x000000040000-0x000000060000 : "SPL.backup2"
[ 1.344146] 0x000000060000-0x000000080000 : "SPL.backup3"
[ 1.350891] 0x000000080000-0x000000260000 : "U-Boot"
[ 1.358001] 0x000000260000-0x000000280000 : "U-Boot Env"
[ 1.364746] 0x000000280000-0x000000780000 : "Kernel"
[ 1.373199] 0x000000780000-0x000020000000 : "File System"
[ 1.592681] UBI: attaching mtd7 to ubi0
[ 1.596740] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.603363] UBI: logical eraseblock size: 126976 bytes
[ 1.609039] UBI: smallest flash I/O unit: 2048
[ 1.614013] UBI: sub-page size: 512
[ 1.618865] UBI: VID header offset: 2048 (aligned 2048)
[ 1.625183] UBI: data offset: 4096
[ 3.049194] UBI error: process_eb: bad image sequence number 2011098337 in PEB 1307, expected 50675805
[ 3.059051] slab error in kmem_cache_destroy(): cache `ubi_scan_leb_slab': Can't free all objects
[ 3.068389] Backtrace:
[ 3.071014] [<c00176e8>] (dump_backtrace+0x0/0x114) from [<c057bf8c>] (dump_stack+0x20/0x24)
[ 3.079925] r6:cfaf9000 r5:cfad74c0 r4:cf9bd640 r3:c07c3560
[ 3.085937] [<c057bf6c>] (dump_stack+0x0/0x24) from [<c00cdb98>] (kmem_cache_destroy+0xc4/0x104)
[ 3.095214] [<c00cdad4>] (kmem_cache_destroy+0x0/0x104) from [<c031697c>] (ubi_scan+0x338/0xa14)
[ 3.104492] r4:0000051b r3:cfb25a00
[ 3.108276] [<c0316644>] (ubi_scan+0x0/0xa14) from [<c030e390>] (ubi_attach_mtd_dev+0x41c/0xa78)
[ 3.117553] [<c030df74>] (ubi_attach_mtd_dev+0x0/0xa78) from [<c0764c58>] (ubi_init+0x1d8/0x2d4)
[ 3.126831] [<c0764a80>] (ubi_init+0x0/0x2d4) from [<c0008780>] (do_one_initcall+0x124/0x18c)
[ 3.135833] [<c000865c>] (do_one_initcall+0x0/0x18c) from [<c0747858>] (kernel_init+0x80/0x11c)
[ 3.145019] [<c07477d8>] (kernel_init+0x0/0x11c) from [<c0043820>] (do_exit+0x0/0x6c4)
[ 3.153381] r5:c07477d8 r4:00000000
[ 3.157806] UBI error: ubi_init: cannot attach mtd7
Now, why I think that my problem is within the UBIFS image? It's because if I use the original ubi.img that is in the file AM335xEVM_UBIFS.tar.gz, the boot process works:
[ 1.309082] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron MT29F4G08ABADAWP)
[ 1.318176] Creating 8 MTD partitions on "omap2-nand.0":
[ 1.323883] 0x000000000000-0x000000020000 : "SPL"
[ 1.330230] 0x000000020000-0x000000040000 : "SPL.backup1"
[ 1.337188] 0x000000040000-0x000000060000 : "SPL.backup2"
[ 1.344085] 0x000000060000-0x000000080000 : "SPL.backup3"
[ 1.350830] 0x000000080000-0x000000260000 : "U-Boot"
[ 1.357940] 0x000000260000-0x000000280000 : "U-Boot Env"
[ 1.364685] 0x000000280000-0x000000780000 : "Kernel"
[ 1.373138] 0x000000780000-0x000020000000 : "File System"
[ 1.592681] UBI: attaching mtd7 to ubi0
[ 1.596740] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.603363] UBI: logical eraseblock size: 126976 bytes
[ 1.609039] UBI: smallest flash I/O unit: 2048
[ 1.614013] UBI: sub-page size: 512
[ 1.618865] UBI: VID header offset: 2048 (aligned 2048)
[ 1.625183] UBI: data offset: 4096
[ 13.884857] UBI: max. sequence number: 584
[ 13.910217] UBI: attached mtd7 to ubi0
[ 13.914245] UBI: MTD device name: "File System"
[ 13.920043] UBI: MTD device size: 504 MiB
[ 13.925262] UBI: number of good PEBs: 4035
[ 13.930206] UBI: number of bad PEBs: 1
[ 13.934906] UBI: number of corrupted PEBs: 0
[ 13.939575] UBI: max. allowed volumes: 128
[ 13.944458] UBI: wear-leveling threshold: 4096
[ 13.949401] UBI: number of internal volumes: 1
[ 13.954071] UBI: number of user volumes: 1
[ 13.958740] UBI: available PEBs: 0
[ 13.963439] UBI: total number of reserved PEBs: 4035
[ 13.968658] UBI: number of PEBs reserved for bad PEB handling: 40
[ 13.975067] UBI: max/mean erase counter: 2/0
[ 13.979553] UBI: image sequence number: 2011098337
And later:
[ 15.153594] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 15.159912] UBIFS: file system size: 199225344 bytes (194556 KiB, 189 MiB, 1569 LEBs)
[ 15.168395] UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
[ 15.176116] UBIFS: media format: w4/r0 (latest is w4/r0)
[ 15.182250] UBIFS: default compressor: lzo
[ 15.186553] UBIFS: reserved for root: 0 bytes (0 KiB)
[ 15.195312] VFS: Mounted root (ubifs filesystem) on device 0:13.
Android doesn't actually works because I get a bunch of "untracked pid" error later on, but it's probably due to my kernel not having all the functionality that comes with the EVM.
So, does anyone is aware of a different way to create the UBIFS image then the one in the documentation? Here's the command I use:
1. First, I copy the filesystem from ANDROID_ROOT\out\target\product\beaglebone\android_rootfs in a local folder
2. ./mkfs.ubifs/mkfs.ubifs -r ../rootfs/ -F -m 2048 -e 126976 -c 1580 -o ubifs.img
3. ./ubi-utils/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
Best regards,
Jerome
It turned out I had to erase my whole chip to make it work. The boot.scr script only erase address until 0x0A360000 before writing the ubi.img file. I modified the uEnv.txt to erase the whole chip before launching the boot.scr script.
Also, it is important to use "sudo" before every command, as mentioned in the TI Wiki.
I also encountered this kind of situation,must erase whole chip is right, only erase filesystems is wrong.Why?