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 TI,
I'm working with a am335X and a NAND flash of 1GB.
I'm try to flash an UBIFS root file system, using u-boot, from a SD card to the NAND flash but the kernel isn't able to detect the rootfs partition.
The UBI image file that I need to copy is in the boot(FAT) partition of the SD card, I hope this not cause the whole problem.
This is the error from the kernel:
[ 1.988948] omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 00:00:01 UTC (946684801)
[ 2.001853] UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", error -19
[ 2.009879] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
[ 2.018391] Please append a correct "root=" boot option; here are the available partitions:
[ 2.027268] b300 3694592 mmcblk0 driver: mmcblk
[ 2.032910] b310 16384 mmcblk0boot1 (driver?)
[ 2.038525] b308 16384 mmcblk0boot0 (driver?)
[ 2.044163] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
MTD info:
device nand0 <omap2-nand.0>, # parts = 8
#: name size offset mask_flags
0: SPL 0x00080000 0x00000000 0
1: SPL.backup1 0x00080000 0x00080000 0
2: SPL.backup2 0x00080000 0x00100000 0
3: SPL.backup3 0x00080000 0x00180000 0
4: u-boot 0x00180000 0x00200000 0
5: u-boot-env 0x00080000 0x00380000 0
6: kernel 0x00c00000 0x00400000 0
7: rootfs 0x3f000000 0x01000000 0
active partition: nand0,0 - (SPL) 0x00080000 @ 0x00000000
defaults:mtdids : nand0=omap2-nand.0
mtdparts: mtdparts=omap2-nand.0:512k(SPL),512k(SPL.backup1),512k(SPL.backup2),512k(SPL.backup3),1536k(u-boot),512k(u-boot-env),12288k(kernel),-(rootfs)
environment
nandroot=ubi0:rootfs rw ubi.mtd=7,4096
nandrootfstype=ubifs rootwait=1
nandargs=run bootargs_defaults;setenv bootargs ${bootargs} root=${nandroot} noinitrd rootfstype=${nandrootfstype} ip=${ip_method}
u-boot command for copy
nand erase 1000000 4000000
fatload mmc 0 81000000 ubi.img;
nand write 81000000 1000000 3A80000
saveenv
NAND INFO
Device 0: nand0, sector size 512 KiB
Page size 4096 b
OOB size 224 b
Erase size 524288 b
CREATE UBI IMG
sudo mkfs.ubifs -r filesystem/ -F -o ubifs.img -m 4096 -e 516096 -c 2000
ubinize -o ubi.img -m 4096 -p 512KiB -s 4096 -O 4096 ubinize.cfg
After a lot of test i'm still not able to figure out of this problem. Could anyone help me, please?
Regards,
Mauro
Hi, thank you for the reply.
I've already tyied to follow the step of your second link but I've found the same results.
Regarding your first link, is used a UBIFS partitioning from user space and i need to do all from u-boot.
I'm thinking that the problem could come from some bad parameters used for the UBIFS image creation.
Maybe, according with the size of the initial partition I have to resize some parameters, I try to calculate them again.
NAND INFO
Device 0: nand0, sector size 512 KiB
Page size 4096 b
OOB size 224 b
Erase size 524288 b
UBIFS.CFG
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=192MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
Thanks,
Mauro
Hi Mauro,
I was facing similar issue,
Check below link if that helps you,
http://stackoverflow.com/questions/20917921/unable-to-attach-ubi-to-mtd-partition
Thank you,
Regards,
Ankur
Hi Ankur,
Thanks for you reply,
I've already seen your link but I still haven't any success in the rootfs flashing.
Have you a working rootfs at now?
I'm thinking that the problem is due to an old version of uboot that don't include the 16bit ECC. Which version do you have?
Thanks,
Mauro
I don't have working RFS right now,
have you tried defining peb and min_io size in your ubinize.cfg file ? Can you recheck the same?
My ubinize content was as follows,
[ubifs]
peb=0x40000
min_io_size=0x800
compress_type=zlib
mode=ubi
image=ubifs.img
vol_id=0
vol_size=124MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
Hi Mauro,
Ours was also Micron NAND, it was MT29F8G08ABABA.
If you see architecture diagram of my NAND in below link
Page size was mentioned as 4096 but i had to use page size as 2048 to make it work,
You too try it.
It was my old project, i don't have that setup now :(
I suggest you to compare your NAND architecture with mine,(refer stackoverflow link)
You can also see my board's boot log, refer kernel parameter and check if you have to use the same or not.
[ 0.000000] Linux version 2.6.37_IPNC_DM368_5.1.0 (still-image@stillimage-VirtualBox) (gcc version 4.3.3 (GCC) ) #2 PREEMPT Wed Jan 8 12:23:10 IST 2014 [ 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=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 nohz=off highres=off clocksource=acpi_pm lpj=1077248 [ 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: 44480k/44480k available, 4672k 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 - 0xc002c000 ( 144 kB) [ 0.000000] .text : 0xc002c000 - 0xc03d6000 (3752 kB) [ 0.000000] .data : 0xc03d6000 - 0xc03ff520 ( 166 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.000399] Calibrating delay loop (skipped) preset value.. 215.44 BogoMIPS (lpj=1077248) [ 0.000484] pid_max: default: 32768 minimum: 301 [ 0.000792] Security Framework initialized [ 0.000999] Mount-cache hash table entries: 512 [ 0.002201] CPU: Testing write buffer coherency: ok [ 0.004941] devtmpfs: initialized [ 0.010979] DaVinci: 8 gpio irqs [ 0.012017] NET: Registered protocol family 16 [ 0.064671] dm365_rmd_cs_rdk_150_wl_init [ 0.064750] No entry for the specified index [ 0.067394] No entry for the specified index [ 0.192130] bio: create slab <bio-0> at 0 [ 0.199416] SCSI subsystem initialized [ 0.205990] usbcore: registered new interface driver usbfs [ 0.208114] usbcore: registered new interface driver hub [ 0.209513] usbcore: registered new device driver usb [ 0.215131] vpss vpss: dm365_vpss vpss probed [ 0.215226] vpss vpss: dm365_vpss vpss probe success [ 0.221974] Advanced Linux Sound Architecture Driver Version 1.0.23. [ 0.227559] Switching to clocksource timer0_1 [ 0.354570] NET: Registered protocol family 2 [ 0.355054] IP route cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.356313] TCP established hash table entries: 2048 (order: 2, 16384 bytes) [ 0.356521] TCP bind hash table entries: 2048 (order: 1, 8192 bytes) [ 0.356653] TCP: Hash tables configured (established 2048 bind 2048) [ 0.356699] TCP reno registered [ 0.356759] UDP hash table entries: 256 (order: 0, 4096 bytes) [ 0.356855] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) [ 0.357705] NET: Registered protocol family 1 [ 0.469332] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.472687] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. [ 0.481434] JFS: nTxBlock = 347, nTxLock = 2780 [ 0.483434] msgmni has been set to 86 [ 0.489764] io scheduler noop registered (default) [ 0.492754] CSL: Module install successful, device major num = 254 [ 0.492824] CSL: Module version 0.10.00, built on Jan 6 2014 10:30:29 [ 0.492898] I2C: Module install successful, device major num = 253 [ 0.492956] DMA: Module install successful, device major num = 252 [ 0.492999] DRV: Module install successful [ 0.493037] DRV: Module built on Jan 6 2014 10:30:41 [ 0.493077] DRV: EDMACC.QUEPRI = 00002777 [ 0.493112] DRV: SYSTEM.MSTPRI0 = 00440011 [ 0.493147] DRV: SYSTEM.MSTPRI1 = 00000444 [ 0.493180] DRV: ISP.BCR = 00000002 [ 0.493215] DRV: SYSTEM.MISC = 00000399 [ 0.493249] EDMAK module: built on Jan 6 2014 at 10:28:58 [ 0.493293] Reference Linux version 2.6.37 [ 0.493332] File /home/still-image/Ipnc_rdk_v5_128Mnand/OV9715_Ver5_0/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/edma/src/module/edmak.c [ 0.495908] IRQK module: built on Jan 6 2014 at 10:12:21 [ 0.495983] Reference Linux version 2.6.37 [ 0.496024] File /home/still-image/Ipnc_rdk_v5_128Mnand/OV9715_Ver5_0/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/irq/src/module/irqk.c [ 0.498643] irqk initialized [ 0.498757] CMEMK module: built on Jan 6 2014 at 10:28:43 [ 0.498815] Reference Linux version 2.6.37 [ 0.498856] File /home/still-image/Ipnc_rdk_v5_128Mnand/OV9715_Ver5_0/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c [ 0.506569] allocated heap buffer 0xc4000000 of size 0x5000000 [ 0.506635] heap fallback enabled - will try heap if pool buffer is not available [ 0.506694] CMEM Range Overlaps Kernel Physical - allowing overlap [ 0.506745] CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83000000) [ 0.506961] cmemk initialized [ 0.507042] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled [ 0.621316] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A [ 1.158314] console [ttyS0] enabled [ 1.231109] serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A [ 1.274647] brd: module loaded [ 1.290667] NAND device: Manufacturer ID: 0x2c, Chip ID: 0x38 (Micron ) [ 1.299266] Bad block table not found for chip 0 [ 1.305859] Bad block table not found for chip 0 [ 1.310666] Scanning device for bad blocks [ 1.759866] Creating 7 MTD partitions on "davinci_nand.0": [ 1.765556] 0x000000000000-0x000000600000 : "bootloader" [ 1.778535] 0x000000600000-0x000000a00000 : "params" [ 1.791595] 0x000000a00000-0x000000e00000 : "kernel" [ 1.804407] 0x000000e00000-0x000003600000 : "filesystem1" [ 1.817920] 0x000003600000-0x000003e00000 : "data1" [ 1.830859] 0x000003e00000-0x00000be00000 : "filesystem2" [ 1.844099] 0x00000be00000-0x000040000000 : "data2" [ 1.858381] davinci_nand davinci_nand.0: controller rev. 2.3 [ 1.869169] UBI: attaching mtd3 to ubi0 [ 1.873516] UBI: physical eraseblock size: 262144 bytes (256 KiB) [ 1.879836] UBI: logical eraseblock size: 258048 bytes [ 1.885512] UBI: smallest flash I/O unit: 2048 [ 1.890407] UBI: sub-page size: 512 [ 1.895067] UBI: VID header offset: 2048 (aligned 2048) [ 1.901212] UBI: data offset: 4096 [ 2.041789] UBI: max. sequence number: 0 [ 2.078440] UBI: volume 0 ("rootfs") re-sized from 151 to 154 LEBs [ 2.088659] UBI: attached mtd3 to ubi0 [ 2.092613] UBI: MTD device name: "filesystem1" [ 2.098149] UBI: MTD device size: 40 MiB [ 2.103212] UBI: number of good PEBs: 160 [ 2.107866] UBI: number of bad PEBs: 0 [ 2.112415] UBI: number of corrupted PEBs: 0 [ 2.116890] UBI: max. allowed volumes: 128 [ 2.121621] UBI: wear-leveling threshold: 4096 [ 2.126360] UBI: number of internal volumes: 1 [ 2.130894] UBI: number of user volumes: 1 [ 2.135364] UBI: available PEBs: 0 [ 2.139827] UBI: total number of reserved PEBs: 160 [ 2.144799] UBI: number of PEBs reserved for bad PEB handling: 2 [ 2.150900] UBI: max/mean erase counter: 1/0 [ 2.155200] UBI: image sequence number: 1048529566 [ 2.160215] UBI: background thread "ubi_bgt0d" started, PID 431 [ 2.173580] spi_davinci spi_davinci.0: Controller at 0xfec66000 [ 2.240164] davinci_mdio davinci_mdio.0: davinci mdio revision 1.4 [ 2.246407] davinci_mdio davinci_mdio.0: no live phy, scanning all [ 2.253804] davinci_mdio: probe of davinci_mdio.0 failed with error -5 [ 2.261610] Initializing USB Mass Storage driver... [ 2.267788] usbcore: registered new interface driver usb-storage [ 2.273971] USB Mass Storage support registered. [ 2.280293] i2c /dev entries driver [ 2.287335] Linux media interface: v0.10 [ 2.292561] Linux video capture interface: v2.00 [ 2.300802] vpbe-osd vpbe-osd: OSD sub device probe success [ 2.307763] vpbe-venc vpbe-venc: VENC sub device probe success [ 2.315217] vpbe-v4l2 vpbe-v4l2: vpbe v4l2 device registered [ 2.321728] Setting default output to Composite [ 2.326314] Setting default mode to ntsc [ 2.330566] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device. [ 2.337313] vpbe-v4l2 vpbe-v4l2: layer=c2a1c800,layer->video_dev=c2a1c8e8 [ 2.345895] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device. [ 2.352951] vpbe-v4l2 vpbe-v4l2: layer=c2a1c600,layer->video_dev=c2a1c6e8 [ 2.362960] watchdog watchdog: heartbeat 60 sec [ 2.376772] Error: Driver 'davinci-mcbsp' is already registered, aborting... [ 2.387615] ALSA device list: [ 2.391078] No soundcards found. [ 2.396287] nf_conntrack version 0.5.0 (695 buckets, 2780 max) [ 2.405542] ip_tables: (C) 2000-2006 Netfilter Core Team [ 2.411693] TCP cubic registered [ 2.414988] NET: Registered protocol family 17 [ 32.418933] UBIFS: mounted UBI device 0, volume 0, name "rootfs" [ 32.425125] UBIFS: file system size: 37158912 bytes (36288 KiB, 35 MiB, 144 LEBs) [ 32.432913] UBIFS: journal size: 5677056 bytes (5544 KiB, 5 MiB, 22 LEBs) [ 32.440339] UBIFS: media format: w4/r0 (latest is w4/r0) [ 32.446204] UBIFS: default compressor: lzo [ 32.450398] UBIFS: reserved for root: 0 bytes (0 KiB) [ 32.472659] VFS: Mounted root (ubifs filesystem) on device 0:13. [ 32.483433] devtmpfs: mounted [ 32.486771] Freeing init memory: 144K INIT: version 2.86 booting [ 160.367962] UBI: attaching mtd4 to ubi1 [ 160.380915] UBI: physical eraseblock size: 262144 bytes (256 KiB) [ 160.387238] UBI: logical eraseblock size: 258048 bytes [ 160.410857] UBI: smallest flash I/O unit: 2048 [ 160.415613] UBI: sub-page size: 512 [ 160.420260] UBI: VID header offset: 2048 (aligned 2048) [ 160.440811] UBI: data offset: 4096 [ 160.480694] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read 64 bytes [ 160.500951] UBI error: validate_ec_hdr: bad VID header offset 512, expected 2048 [ 160.508403] UBI error: validate_ec_hdr: bad EC header [ 160.530879] UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0 ubiattach: error!: cannot attach mtd4 error 22 (Invalid argument) libubi: error!: cannot get information about "/dev/ubi1" error 2 (No such file or directory) ubimkvol: error!: error while probing "/dev/ubi1" error 2 (No such file or directory) [ 161.837608] UBIFS error (pid 499): ubifs_mount: cannot open "ubi1:ubifs_volume", error -19 mount: mounting ubi1:ubifs_volume on /mnt/nand failed: No such device ubidetach: error!: cannot remove ubi1 error 22 (Invalid argument) ubiformat: mtd4 (nand), size 8388608 bytes (8.0 MiB), 32 eraseblocks of 262144 bytes (256.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 31 -- 100 % complete ubiformat: 31 eraseblocks have valid erase counter, mean value is 0 ubiformat: 1 eraseblocks are supposedly empty ubiformat: warning!: VID header and data offsets on flash are 512 and 2048, which is different to requested offsets 2048 and 4096 ubiformat: use new offsets 2048 and 4096? (yes/no) yes ubiformat: use offsets 2048 and 4096 ubiformat: formatting eraseblock 31 -- 100 % complete [ 42.480596] UBI: attaching mtd4 to ubi1 [ 42.494179] UBI: physical eraseblock size: 262144 bytes (256 KiB) [ 42.500500] UBI: logical eraseblock size: 258048 bytes [ 42.514144] UBI: smallest flash I/O unit: 2048 [ 42.518899] UBI: sub-page size: 512 [ 42.523549] UBI: VID header offset: 2048 (aligned 2048) [ 42.544139] UBI: data offset: 4096 [ 42.607706] UBI: max. sequence number: 0 [ 43.414272] UBI: attached mtd4 to ubi1 [ 43.418071] UBI: MTD device name: "data1" [ 43.423070] UBI: MTD device size: 8 MiB [ 43.444234] UBI: number of good PEBs: 32 [ 43.448815] UBI: number of bad PEBs: 0 [ 43.453287] UBI: number of corrupted PEBs: 0 [ 43.464165] UBI: max. allowed volumes: 128 [ 43.468832] UBI: wear-leveling threshold: 4096 [ 43.473565] UBI: number of internal volumes: 1 [ 43.494179] UBI: number of user volumes: 0 [ 43.498678] UBI: available PEBs: 26 [ 43.503233] UBI: total number of reserved PEBs: 6 [ 43.524142] UBI: number of PEBs reserved for bad PEB handling: 2 [ 43.530205] UBI: max/mean erase counter: 1/0 [ 43.544186] UBI: image sequence number: 891980687 [ 43.549098] UBI: background thread "ubi_bgt1d" started, PID 508 UBI device number 1, total 32 LEBs (8257536 bytes, 7.9 MiB), available 26 LEBs (6709248 bytes, 6.4 MiB), LEB size 258048 bytes (252.0 KiB) Set volume size to 6709248 Volume ID 0, size 26 LEBs (6709248 bytes, 6.4 MiB), LEB size 258048 bytes (252.0 KiB), dynamic, name "ubifs_volume", alignment 1 [ 44.946890] UBIFS: default file-system created [ 45.841681] UBIFS: mounted UBI device 1, volume 0, name "ubifs_volume" [ 45.864164] UBIFS: file system size: 4128768 bytes (4032 KiB, 3 MiB, 16 LEBs) [ 45.871538] UBIFS: journal size: 2064385 bytes (2016 KiB, 1 MiB, 6 LEBs) [ 45.894108] UBIFS: media format: w4/r0 (latest is w4/r0) [ 45.899994] UBIFS: default compressor: lzo [ 45.914165] UBIFS: reserved for root: 195011 bytes (190 KiB) mknod: /dev/spidev0.0: File exists Starting mounting local filesystems: mount mount: mounting /dev/root on / failed: No such file or directory mount: mounting none on /dev/shm failed: No such file or directory failed (2: ). Creat queue id:0 queue id:0 FileMngThread created Creat queue id:32769 queue id:32769 AlramThread created Share memory init success queue id:32769 Creat queue id:65538 queue id:65538 Creat queue id:98307 queue id:98307 IPNC_DM368_5.1.0 (still-image@stillimage-VirtualBox) (gcc version 4.3.3 (GCC) queue id:65538 [ 48.166236] PHY 0:01 not found [ 48.169357] net eth0: could not connect to phy 0:01 net_search_gateway:eth0, 1A8C0, 0, 1 Check_device_version : DEVICE VER = 0 !! Starting internet superserver: inetd CPU is DM368 ***************************************************************** IPNC BUILD VERSION: DM368 IPNC RDK V5.10.00.00 *****************************************************************
Regards,
Ankur
Forgot to put the link
http://stackoverflow.com/questions/20917921/unable-to-attach-ubi-to-mtd-partition
Regards,
Ankur
Of course my problem had a stupid and an unuseful solution.
The problem is that my custom board provide to deactivate the NAND flash before the kernel booting, and this is why I was'nt able to mount the MTD devices.
Thanks everybody.
Mauro