TI E2E Community
Flashing File System to Nand Flash using U-boot
i use command as follow to flashing file system to Nand Flash from Uboot
mw.b 0x82000000 0xFF 0x3000000
tftp 0x82000000 ubi.img
nand erase 0x780000 0xF880000
nandecc hw 2
nand write 0x82000000 0x780000 0x3000000
on the nand boot right after flash the file system, the kernel can boot sucessfully, Once i reboot/reset the AM335x device, the kernel can't boot sucessfully and end up with error :
[ 4.091952] UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read 126976 bytes
[ 4.234131] UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read 126976 bytes
[ 4.249068] UBI error: ubi_io_read: error -74 (ECC error) while reading 188 bytes from PEB 383:8960, read 188 bytes
[ 4.262689] UBI error: ubi_io_read: error -74 (ECC error) while reading 11 bytes from PEB 10:8192, read 11 bytes
[ 4.273429] UBIFS error (pid 1): ubifs_leb_read: reading 11 bytes from LEB 8:4096 failed, error -74
How to fix this problem?
Am i in the correct forum?
Thanks and Regards
May be the offset you are writing an ubi.img is wrong,
Just check out the offset for file system to be written in u-boot partition is correct?
Before flashing the UBI file system on nand , the creation of the ubi must be proper w.r.t physical nand size. Error seems related PEB blocks.
Every ubi image changed depending upon the NAND Size. So Please check the ubi image is created that perfect.
For ref :http://www.linux-mtd.infradead.org/faq/ubi.html
after creating the right image , then flash on the nand.
Your commands seems correct. Only check with the the ubi image which you created.
i'm using 1G Nand Flash, mtd7 size is set to 100MiB, my calculation is as follow:
SP = 128KiB
SL = 124KiB
P = 100MiB / 128KiB = 800
B = 8
O = SP - SL = 128KiB - 124KiB = 4KiB
UBI OVerhead = (B + 4) * SP + O * (P - B - 4)
= (8 + 4) * 128KiB + 4KiB * (800 - 8 - 4)
= 1536 + 3152
= 36.625 PEBs
this left 800 - 36.625 = 763 PEB (round) or 97664KiB
97664KiB / 124KiB = 788 (-c 788)
97664KiB = 95MiB
Volume Size : 95MiB
mkfs.ubifs -r filesystem/ -F -o ubifs.img -m 2048 -e 126976 -c 788
ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
contain of ubinize.cfg is as follow:
Am I correct ?
Thanks & Regards
I am facing the same problem.
Have you fixed it?
John and Keldy,
Follow the steps here.
1. First you should have your rootfs as a tar ball in your SD card or NFS from where you mount the filesystem.
2. Boot up the device and the filesystem from NFS or SD card according your preference.
3. Boot it up and login. Hope you have all the required command binaries like "flash_erase" etc in your filesystem. If not take the default arago filesystem image thatcomes with the EZSDK package.
4. Follow the steps below
$ flash_erase /dev/mtd4 0 0 $ ubiattach /dev/ubi_ctrl -m 4 $ ubimkvol /dev/ubi0 -N rootfs -m
$ mkdir /mnt/nand $ mount -t ubifs ubi0:rootfs /mnt/nand $ tar xvf rootfs.tar.gz -C /mnt/nand
5. Change the bootargs like below for booting from UBIFS.
# setenv bootargs 'console=ttyO0,115200n8 mem=160M ubi.mtd=4 rootfstype=ubifs root=ubi0:rootfs rw'
After following all these, if you still face any issues then we can isolate this issue as the problem with ECC algorithm chosen. I'm not sure which platform you are using here. Mail me @ firstname.lastname@example.org. I'll give the medicine for ECC issues :)
-Renjith | www.pathpartnertech.com | Verify the answer if you think your query is resolved
For our nand flash is SLC with 2GiB!
Steps for creating UBIFS image?
Have you followed the instructions given in the previous reply? Please be more clear on what exactly is the issue that you are facing now? Also give more details about your platform.
Thanks for the reply!
Processor : AM3703
Two nand's are there :
512MiB for Booting purpose and
2GiB for secondary storage!
I have an android_filesystem,
From regerring devkit usermanual pdf,
created an ubifs image, added in first nand (512MiB),
booting and mounting that filesystem everything is fine!
But now same filesystem i want to add in second nand flash,
and trying to mount, but getting errors , related to creating ubifs image only!
I am facing problem in creating ubifs image only, so need help?
for 2GIb Nand flash i'm trying create ubifs image:
sudo mkfs.ubifs -r rootfs -m 4096 -e 1044480 -c 812 -o ubifs.imgsudo ubinize -o ubi.img -m 4096 -p 1024KiB -s 1024 /home/embest/tools/ubinize.cfg
But below error , while trying mount !
[ 292.099029] UBI: data offset: 4096[ 292.106536] UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 23:0, read 64 bytes[ 292.115753] UBI warning: process_eb: valid VID header but corrupted EC header at PEB 23[ 292.126342] UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 68:0, read 64 bytes[ 292.135589] UBI error: ubi_io_read: error -74 while reading 1024 bytes from PEB 68:1024, read 1024 bytes[ 292.146392] UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 74:0, read 64 bytes[ 292.155853] UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 76:0, read 64 bytes[ 292.165069] UBI error: ubi_io_read: error -74 while reading 1024 bytes from PEB 76:1024, read 1024 bytes[ 292.175384] UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 80:0, read 64 bytes
Please share the datasheets of the NAND part. If you can't upload it, please send it to email@example.com
HI Ranjith;Here the nand flash part numbers, you can get the datasheets :1) First Nand : part No : H9DA4GH2GJAMCR2) Second Nand : part No : MT29F16G08CBACARegards, santosh vastrad
As has been said before, the parameters are specific to your NAND chip. If you use rootfs from elsewhere first you can get Linux to tell you the required parameters. The following is from one of the machine.conf files in meta-ti, but applicable anywhere (in this case the filesystem is for mtd partition7) Also note that the '-O 2048' parameter is something you still have to know based on the flash chip and datasheet
# do ubiattach /dev/ubi_ctrl -m 7 -O 2048
# From dmesg:# UBI: smallest flash I/O unit: 2048# UBI: logical eraseblock size: 126976 bytes# from ubiattach stdout:# UBI device number 0, total 1988 LEBsMKUBIFS_ARGS = "-F -m 2048 -e 126976 -c 1988"
# do ubiattach /dev/ubi_ctrl -m 7 -O 2048# from dmesg:# UBI: smallest flash I/O unit: 2048# UBI: physical eraseblock size: 131072 bytes (128 KiB)# UBI: sub-page size: 512# UBI: VID header offset: 2048 (aligned 2048)UBINIZE_ARGS = "-m 2048 -p 128KiB -s 512 -O 2048"
Please click the Verify Answer button on this post if it answers your question.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.