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.

UBIFS: ubiformat issues

Hi

I wanted to upgrade a UBIFS rootfs image from a running application on it.

But if I have to use ubiformat, I need  to detach  the ubi rootfs partition using ubidetach.

This gives Device busy error as below

ubiformat /dev/mtd4 -O 2048 -f /mnt/installubi.img

ubiformat: error!: please, first detach mtd4 (/dev/mtd4) from ubi0

So I tried to detach

 

ubidetach -p /dev/mtd4

ubidetach: error!: cannot detach "/dev/mtd4"
           error 16 (Device or resource busy)

I cannot  unmount my root   , since I am already inside the filesystem.

 

Can  someone tell  me , how to  proceed  using ubiformat?

When I tried to use nandwrite, it gives the following error

UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 2:4096, read 126976 bytes

I have reservations about using nandwrite for writing ubi images into nand flash.

Can someone help?

Regards

JK

  • I think you are booting your filesystem from UBIFS i.e /dev/mtd4 an dthen trying ubi format on same device. So the error is expected. To avoid such issue, boot your Filesystem from MMC or NFS and try ubi format from kernel. Alternatively you can also ry flashing ubi images from u-boot.

  • same question here:

    how to burn ubi (/dev/mtd4) while mounting it ???

  • Hi, 

    Let me know , How much space is left on your nand device.

    You can not detach it while you are on the same partion. 

    Let me know the exact requirements. 

    Murali krishna 

    dama.murali@gmail.com

    murali.krishna@pathpartnertech.com

  • hi, 

    Before you do 'ubiformat', first you must unmount the rootfile system, after updating again mount it with out doing any read write operations, like as shown

    umount /

    ubiformat /dev/mtd4 -O 2048 -f /mnt/installubi.img

    mount -rw -o remount /

  • Hi,

    Are you able to use ubiformat by being in the same partition, is it going fine?

    For me, it din't work well.

    I have to do the updation from only user space, so i created another partion for updating and calling the same by changing the u-boot.min.nand. Procedure is working fine.

    Murali Krishna

    dama.murali@gmail.com 

  • Ravikiran

    Booting from MMC or NFS cannot  be done, since  this is a production system.

    Best Regards

    JK

  • Sreenivas,

    Can't unmount the RFS, because the application for upgrading the image has to work. This is a production system.

    Best Regards

    JK

  • If that is the case I can suggest you the alternatives.

    1. Try formating/erasing from uboot  and flash from uboot. This should be solve all your problems. But, your ecc schemes of uboot must match with that of kernel.

    2.  Otherwise, If you want to do it from Kernel itself, then you can also try to make 2 dedicated partition for filesystem. You can erase filesystem-1 when you are booted with filesyetem-2 and vice versa.

  • I'm looking at this problem from the other end right now, the Appro DM368 IPNC SDK uses (or appears to use) the "two-partition" method for remote update of the filesys, but it seems to be broken, my post is here if anyone can help:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/t/328448.aspx


    To the subject at hand, what the Appro setup appears to do (or attempt to do) is create this partition layout:

    dev:    size   erasesize  name
    mtd0: 00300000 00020000 "bootloader"
    mtd1: 00200000 00020000 "params"
    mtd2: 00400000 00020000 "kernel"
    mtd3: 02800000 00020000 "filesystem1"
    mtd4: 00200000 00020000 "data1"
    mtd5: 02800000 00020000 "filesystem2"
    mtd6: 02500000 00020000 "data2"

    And then gets/sets a flag (using fw_getenv / fw_setenv) to denote either MTD3 or MTD5 is written to by the updater (and hopefully, at (re)boot, the correct one is chosen as the "live" one).

    Unfortunately, it's not quite working for several potential reasons (any suggestions welcome!) although I don't think any of them are major. I think it's using nandwrite rather than ubiformat, and fw_setenv doesn't seem to actually set the uboot args.