Hello
I'm quite new to embedded Linux, and don't know how to compile a Ubifs root filesystem + Ubi volume so that it'll work on a 256MiB NAND flash with 248 MiB available in the second partition to hold the root filesystem.
Here's what I used:
On the workstation
# mkfs.ubifs -v --squash-uids -m 2048 -e 204800 -c 1024 -d ./romfs -D ./vendors/mfg/board/device_table-min.txt -o ./images/rootfs.ubifs
On the appliance
# cat /proc/mtd
dev: size erasesize name
mtd0: 00800000 00001000 "ROMfs"
mtd1: 00800000 00020000 "linux kernel(nand)"
mtd2: 0f800000 00020000 "file system(nand)"
# 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: volume 0 ("rootfs") re-sized from 1626 to 1961 LEBs
UBI: attached mtd2 to ubi0
UBI: MTD device name: "file system(nand)"
UBI: MTD device size: 248 MiB
UBI: number of good PEBs: 1984
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 1984
UBI: number of PEBs reserved for bad PEB handling: 19
UBI: max/mean erase counter: 10/5
UBI: image sequence number: 364645537
mtd: Giving out device 3 to rootfs
UBI: background thread "ubi_bgt0d" started, PID 69
UBI device number 0, total 1984 LEBs (255983616 bytes, 244.1 MiB), available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
# mdev -s
# ubinfo /dev/ubi0 -a
ubi0:
Volumes count: 1
Logical eraseblock size: 129024
Total amount of logical eraseblocks: 1984 (255983616 bytes, 244.1 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes 128
Count of bad physical eraseblocks: 0
Count of reserved physical eraseblocks: 19
Current maximum erase counter value: 11
Minimum input/output unit size: 2048 bytes
Character device major/minor: 251:0
Present volumes: 0
Volume ID: 0 (on ubi0)
Type: dynamic
Alignment: 1
Size: 1961 LEBs (253016064 bytes, 241.3 MiB)
State: OK
Name: rootfs
Character device major/minor: 251:1
# ubimkvol /dev/ubi0 -N test --lebs=51
ubimkvol: error!: UBI device does not have free logical eraseblocks
Could someone tell me what numbers to use in mkfs.ubifs and ubimkvol so that I can proceed with "mount"?
Thank you.