3
votes

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
1
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 and UbiFs docs at infradead.org.artless noise

1 Answers

1
votes

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.