• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » Linux » Linux forum » Flashing File System to Nand Flash using U-boot
Share
Linux
  • Forum
Options
  • Subscribe via RSS

Flashing File System to Nand Flash using U-boot

Flashing File System to Nand Flash using U-boot

This question is not answered
Keldy
Posted by Keldy
on Jul 07 2012 05:36 AM
Expert1770 points

Hi,

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

Keldy

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • santosh vastrad
    Posted by santosh vastrad
    on Jul 08 2012 23:04 PM
    Expert2065 points

    Hi Keldy,

    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?

    Regards,

    santosh vastrad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Surendra Dhobale92789
    Posted by Surendra Dhobale92789
    on Jul 09 2012 01:10 AM
    Intellectual640 points

    Hi Keldy,

    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.

    Surendra Dhobale

    ubifs
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Keldy
    Posted by Keldy
    on Jul 12 2012 10:37 AM
    Expert1770 points

    hi,

    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

                            = 4688

                            = 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:

    [rootfs-volume]

    mode=ubi

    image=rootfs.img

    vol_id=0

    vol_size=95MiB

    vol_type=dynamic

    vol_name=rootfs

    vol_flags=autoresize  

     

    Am I correct ?

    Please advise.

     

    Thanks & Regards

    Keldy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Amir Lee
    Posted by Amir Lee
    on Jul 13 2012 03:47 AM
    Intellectual280 points

    Hi,Keldy

    I am facing the same problem.

    Have you fixed it?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Renjith Thomas
    Posted by Renjith Thomas
    on Jul 22 2012 01:56 AM
    Guru23890 points

    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 @ renjith.thomas@pathpartnertech.com. I'll give the medicine for ECC issues :)

    -Renjith | www.pathpartnertech.com | Verify the answer if you think your query is resolved

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • santosh vastrad
    Posted by santosh vastrad
    on Jul 31 2012 02:03 AM
    Expert2065 points

    HI Renijith,

    Need help?

    For our nand flash is SLC with 2GiB!

    Steps for creating UBIFS image?

    Regards,

    santosh vastrad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Renjith Thomas
    Posted by Renjith Thomas
    on Jul 31 2012 14:24 PM
    Guru23890 points

    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.

    -Renjith | www.pathpartnertech.com | Verify the answer if you think your query is resolved

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • santosh vastrad
    Posted by santosh vastrad
    on Jul 31 2012 22:50 PM
    Expert2065 points

    HI Renjith,

    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?

    Regards,

    santosh vastrad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • santosh vastrad
    Posted by santosh vastrad
    on Aug 01 2012 01:07 AM
    Expert2065 points

    Hi all:

    for 2GIb Nand flash i'm trying create ubifs image:

    as follows:

    sudo mkfs.ubifs -r rootfs -m 4096 -e 1044480 -c 812 -o ubifs.img
    sudo 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

    Regards,

    santosh vastrad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Renjith Thomas
    Posted by Renjith Thomas
    on Aug 01 2012 06:15 AM
    Guru23890 points

    Please share the datasheets of the NAND part. If you can't upload it, please send it to renjith.thomas@pathpartnertech.com

    -Renjith | www.pathpartnertech.com | Verify the answer if you think your query is resolved

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • santosh vastrad
    Posted by santosh vastrad
    on Aug 01 2012 07:00 AM
    Expert2065 points

    HI Ranjith;
    Here the nand flash part numbers, you can get the datasheets :


    1) First Nand : part No : H9DA4GH2GJAMCR

    2) Second Nand : part No : MT29F16G08CBACA

    Regards,

    santosh vastrad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Tom Rini
    Posted by Tom Rini
    on Aug 01 2012 19:25 PM
    Intellectual1335 points

    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 LEBs
    MKUBIFS_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.

    Thanks,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

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.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use