3

How can i make a .ubi file from a .tar.gz or folder if this is possible at all?

I looked at this (did not help me):

Creating UBI Image

To create the image from a rootfs you've built first you need to create the ubi.ini file, that describes your ubi image. Create a regular text file, ubi.ini, example contents, for more info run ubinize -h:

[ubi_rfs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=87349248
vol_type=dynamic
vol_name=ubi_rfs
vol_alignment=1
vol_flags=autoresize

Next you'll run the commands that actually build it. Here ubi.ini is the file you just created, ubifs.img is a temp file you can delete once you are done, and your_erootfs.ubi is the name of the rootfs image that will be created.

sudo /usr/sbin/mkfs.ubifs -m 2048 -e 129024 \
          -c 677 -r /path/to/rootfs ubifs.img
sudo /usr/sbin/ubinize -o your_erootfs.ubi  \
          -p 131072 -m 2048 -s 512 -O 512 ubi.ini
artless noise
  • 21,212
  • 6
  • 68
  • 105
kevin ver
  • 831
  • 4
  • 14
  • 37
  • Yes, it is possible. The difficult part is selecting all of the parameters above to match your flash controller (CPU side) and chip (memory storage). If you have `cat /proc/mtd` output, it is helpful. Also, the *ubifs.img* maybe flashed with `ubiupdatevol` to an existing empty UBI volume, which maybe simpler depending on your situation. Please also look at the [SO UbiFS wiki](http://stackoverflow.com/tags/ubifs/info) and [UbiFs docs](http://www.linux-mtd.infradead.org/doc/ubifs.html) at *infradead.org*. – artless noise Feb 11 '14 at 23:29

1 Answers1

1

Note the part in the mkfs command that says

-r /path/to/rootfs

Un-tar your tar.gz file and use the resulting directory as the destination for -r.

hymie
  • 1,982
  • 1
  • 13
  • 18
  • Well, this is mostly correct. You need to know your flash parameters. There are three key items. The erase block and sector sizes. Also, if your flash chip and controller support sub-pages. This will give less UBI overhead. Finally, `vol_size` should be less than the total size of the NAND chip. Your MTD partitioning may also determine this. See [UBI overhead](http://www.linux-mtd.infradead.org/doc/ubi.html#L_overhead) for more. – artless noise Feb 11 '14 at 23:21
  • `-D, --devtable=FILE` - *use device table FILE* and `-U, --squash-uids` - *squash owners making all files owned by root* are probably also helpful hints, depending on the format of the *tar.gz*. – artless noise Feb 11 '14 at 23:51