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.
Tool/software: Linux
In going from SDK6 to ProcessorSDK 1.03 on AM335x, a customer hardcoded the NAND MTD partition table for UBIFS (e.g. filesystem) from the old board file into a device tree .dtsi file:
partition@8 {
label = "NAND.File-System";
reg = <0x00C80000 0x06000000>;
};
When the first two physical blocks of the rootfs partition are bad blocks, U-boot recognizes this when flashing the rootfs and skips them. But when the kernel is just starting and tries to mount rootfs for the first time, it does not even see a valid ubi filesystem there and gives an error:
>>[ 1.077744] UBI error: scan_peb: bad image sequence number 529790210 in PEB 766, expected 1116986266
Is there a way to skip bad blocks with this method and boot the kernel successfully? What is wrong here?
Here’s the console log (The bootargs we use for the rootfs are: root=ubi0:rootfs ro ubi,mtd=8,2048 noinitrd rootfstype=ubifs rootwait=1):
Starting kernel ...
[ 0.305420] pinctrl-single: ioremap base is f9e10800 phys 44e10800
[ 1.077744] UBI error: scan_peb: bad image sequence number 529790210 in PEB 766, expected 1116986266
[ 1.087337] Erase counter header dump:
[ 1.091261] magic 0x55424923
[ 1.095182] version 1
[ 1.098295] ec 1
[ 1.101398] vid_hdr_offset 2048
[ 1.104773] data_offset 4096
[ 1.108160] image_seq 529790210
[ 1.111990] hdr_crc 0xb1cc42f3
[ 1.115910] erase counter header hexdump:
[ 1.120406] UBI error: ubi_attach_mtd_dev: failed to attach mtd8, error -22
[ 1.127762] UBI error: ubi_init: cannot attach mtd8
[ 1.137777] UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", error -19
[ 1.145961] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.154625] CPU: 0 PID: 1 Comm: swapper Not tainted 3.14.43+ #136
[ 1.161004] Backtrace:
[ 1.163593] [<c0016eb0>] (dump_backtrace) from [<c001704c>] (show_stack+0x18/0x1c)
[ 1.171518] r6:c5b51000 r5:c051e804 r4:c061bfa8 r3:00000000
[ 1.177471] [<c0017034>] (show_stack) from [<c0439ec4>] (dump_stack+0x20/0x28)
[ 1.185052] [<c0439ea4>] (dump_stack) from [<c04382bc>] (panic+0x84/0x1d4)
[ 1.192271] [<c043823c>] (panic) from [<c05a8040>] (mount_block_root+0x194/0x240)
[ 1.200108] r3:00000004 r2:00000000 r1:c5879ee0 r0:c051e804
[ 1.206048] r7:c05d3a04
[ 1.208708] [<c05a7eac>] (mount_block_root) from [<c05a8388>] (prepare_namespace+0x94/0x1cc)
[ 1.217543] r10:c05d39d8 r9:c05d39d0 r8:c05a74d0 r7:00000092 r6:c061b200 r5:c05d3a04
[ 1.225761] r4:c05d39f8
[ 1.228420] [<c05a82f4>] (prepare_namespace) from [<c05a7c68>] (kernel_init_freeable+0x174/0x1b8)
[ 1.237711] r5:00000007 r4:c05db7dc
[ 1.241465] [<c05a7af4>] (kernel_init_freeable) from [<c043706c>] (kernel_init+0x14/0xf4)
[ 1.250028] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0437058
[ 1.258245] r4:c061b200
[ 1.260916] [<c0437058>] (kernel_init) from [<c0014258>] (ret_from_fork+0x14/0x3c)
[ 1.268840] r4:00000000 r3:c5878000
Any progress??
Looking at this on the AM335x EVM, we can't figure out how to connect the u-boot mtdparts command with what the Linux kernel sees. The mtdparts change will not even stay permanent or get passed to the kernel even with a saveenv or reset.
Do we have to hard code in the device tree file somehow?
Please see b-boot log and kernel boot errors below
U-Boot# mtdparts del nand0,9
U-Boot# mtdparts add nand0 0x0f500000@0x00a20000 NAND.file-system
U-Boot# 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 0x0f500000 0x00a20000 0
NOT PASSED TO KERNEL (or even subsequent uboot):
[ 1.851992] 10 ofpart partitions found on MTD device omap2-nand.0
[ 1.858115] Creating 10 MTD partitions on "omap2-nand.0":
[ 1.863571] 0x000000000000-0x000000020000 : "NAND.SPL"
[ 1.870792] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
[ 1.878452] 0x000000040000-0x000000060000 : "NAND.SPL.backup2"
[ 1.885994] 0x000000060000-0x000000080000 : "NAND.SPL.backup3"
[ 1.893521] 0x000000080000-0x0000000c0000 : "NAND.u-boot-spl-os"
[ 1.901348] 0x0000000c0000-0x0000001c0000 : "NAND.u-boot"
[ 1.909143] 0x0000001c0000-0x0000001e0000 : "NAND.u-boot-env"
[ 1.916621] 0x0000001e0000-0x000000200000 : "NAND.u-boot-env.backup1"
[ 1.924822] 0x000000200000-0x000000a00000 : "NAND.kernel"
[ 1.938457] 0x000000a00000-0x000010000000 : "NAND.file-system"
[ 2.150387] tps65910 0-002d: No interrupt support, no core IRQ
KERNEL ERROR(S):
[ 2.371653] UBI: attaching mtd9 to ubi0
[ 3.568885] UBI error: scan_peb: bad image sequence number 1420516448 in PEB
1961, expected 275294271
[ 3.578183] Erase counter header dump:
[ 3.581962] magic 0x55424923
[ 3.585723] version 1
[ 3.588700] ec 0
[ 3.591690] vid_hdr_offset 2048
[ 3.594928] data_offset 4096
[ 3.598165] image_seq 1420516448
[ 3.601936] hdr_crc 0x9d364c14
[ 3.605700] erase counter header hexdump:
[ 3.610443] UBI error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
[ 3.617474] UBI error: ubi_init: cannot attach mtd9
[ 3.761689] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
[ 3.769761] Please append a correct "root=" boot option; here are the available partitions:
[ 3.778203] 1f00 128 mtdblock0 (driver?)
[ 3.783324] 1f01 128 mtdblock1 (driver?)
[ 3.788418] 1f02 128 mtdblock2 (driver?)
[ 3.793524] 1f03 128 mtdblock3 (driver?)
[ 3.798619] 1f04 256 mtdblock4 (driver?)
[ 3.803727] 1f05 1024 mtdblock5 (driver?)
[ 3.808820] 1f06 128 mtdblock6 (driver?)
[ 3.813930] 1f07 128 mtdblock7 (driver?)
[ 3.819026] 1f08 8192 mtdblock8 (driver?)
[ 3.824132] 1f09 251904 mtdblock9 (driver?)
[ 3.829228] Kernel panic - not syncing: VFS: Unable to mount root fs on unkno
wn-block(0,0)
[ 3.837530] drm_kms_helper: panic occurred, switching back to text console
[ 7.600297] random: nonblocking pool is initialized
DID NOT NEED THIS?
setenv bootargs 'console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=9,2048 rootfstype=ubifs root=ubi0:rootfs init=/init'