Hello
I went through the docs/FAQs on the
MTD/UBI site and elsewhere, and proceeded to create a Ubifs root filesystem and flash a NAND partition with it.
However, "ubiattach" fails, so I guess I didn't use the right settings in mkfs.ubifs and/or ubinize and/or ubiformat for use with that NAND partition.
Here are the steps I took.
First, get infos about NAND
Code:
appliance:/> mtdinfo /dev/mtd2 -u
mtd2
Name: filesystem_nand
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 1984 (260046848 bytes, 248.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:4
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 512
Default UBI data offset: 2048
Default UBI LEB size: 129024 bytes, 126.0 KiB
Maximum UBI volumes count: 128
Next, cCreate root filesystem
Code:
ubuntu:/> mkfs.ubifs --squash-uids -m 2048 -e 131072 -c 1984 -d
./romfs -D device_table-min.txt -o ./images/rootfs.ubifs
Ubinize image
Code:
ubuntu:/> cat ubi.cfg
[ubifs]
mode=ubi
image=./images/rootfs.ubifs
vol_id=0
vol_size=248MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
ubuntu:/> ubinize -o rootfs.ubi.img -m 2048 -p 128KiB -s 512 ./ubi.cfg
On the appliance, format the partition on the NAND memory:
Code:
appliance:/> ubiformat /dev/mtd2 -s 512 -f rootfs.ubi.img
Finally, attach the MTD partition to Ubi before mounting it:
Code:
appliance:/> ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI error: vtbl_check: too large reserved_pebs 2016, good PEBs 1984
UBI error: vtbl_check: volume table check failed: record 0, error 9
UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22
ubiattach: error!: cannot attach mtd2
error 22 (Invalid argument)
I assume I used one or more settings wrong, but I don't know which. Maybe I must leave some room for the journal + recovery data?
Thank you.