UBIFS creation took me a while to understand and execute,it proved a worthwhile experience.
my objective was to create 2 volume of UBIFS,one for rootfs and other for data.
since the uboot I was using did not support UBIFS I choosed to write from linux with the help
of tools available with mtd-utilities.
About UBIFS on web
http://www.linux-mtd.infradead.org/faq/ubifs.html
Software used to accomplish this activity
linux 2.6.39 configured for mtd support ported on MINI2416 with 128Mb Nand flash
precompiled tool chain and rootfs avilable on denx site
http://ftp.denx.de/pub/eldk/5.3/targets/armv5te/
toolchain
eldk-eglibc-i686-arm-toolchain-qte-5.3.sh
rootfs with mtd-utilites compiled
core-image-minimal-mtdutils-generic-armv5te.tar.gz
install mtd-util on host ubuntu machine
I created core-image-minimal-mtdutils on USB-Stick on ext2 partition,once the linux is up.
use mtdinfo -a to list the info on mtd partitions for the board,usefull for creating ubifs image.
mtd0
Name: UBOOT
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 8 (1048576 bytes, 1024.0 KiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:0
Bad blocks are allowed: true
Device is writable: true
mtd1
Name: kernel
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 24 (3145728 bytes, 3.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:2
Bad blocks are allowed: true
Device is writable: true
mtd2
Name: ROOTFS
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 992 (130023424 bytes, 124.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
Preparing NAND partition
we used mtd2 partition for ubifs image.
root@generic-armv5te:~#flash_eraseall /dev/mtd2
Creating UBIFS image
my objective was to create 2 volume of UBIFS,one for rootfs and other for data.
since the uboot I was using did not support UBIFS I choosed to write from linux with the help
of tools available with mtd-utilities.
About UBIFS on web
http://www.linux-mtd.infradead.org/faq/ubifs.html
Software used to accomplish this activity
linux 2.6.39 configured for mtd support ported on MINI2416 with 128Mb Nand flash
precompiled tool chain and rootfs avilable on denx site
http://ftp.denx.de/pub/eldk/5.3/targets/armv5te/
toolchain
eldk-eglibc-i686-arm-toolchain-qte-5.3.sh
rootfs with mtd-utilites compiled
core-image-minimal-mtdutils-generic-armv5te.tar.gz
install mtd-util on host ubuntu machine
I created core-image-minimal-mtdutils on USB-Stick on ext2 partition,once the linux is up.
use mtdinfo -a to list the info on mtd partitions for the board,usefull for creating ubifs image.
mtd0
Name: UBOOT
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 8 (1048576 bytes, 1024.0 KiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:0
Bad blocks are allowed: true
Device is writable: true
mtd1
Name: kernel
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 24 (3145728 bytes, 3.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:2
Bad blocks are allowed: true
Device is writable: true
mtd2
Name: ROOTFS
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 992 (130023424 bytes, 124.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
Preparing NAND partition
we used mtd2 partition for ubifs image.
root@generic-armv5te:~#flash_eraseall /dev/mtd2
Creating UBIFS image
mkfs.ubifs -r basicrootfs/ -m 2048 -e 126976 -c 200 -F -o basicrootfs.ubi
mkfs.ubifs -r data/ -m 2048 -e 126976 -c 792 -F -o data.ubi
To flash image to Nand from From Linux,we require to ubinize tool on the host machine.
mode=ubi
image=./basicrootfs.img
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_size=20MiB
[data-volume]
mode=ubi
image=./data.img
vol_id=1
vol_type=dynamic
vol_name=data
vol_flags=autoresize
Flash the UBI file system image (ubi.img) to MTD partition "X"
ubiformat /dev/mtd2 -f basicrootfs1.ubi -s 512 -O 2048
mounting the data volume
mount -t ubifs ubi0:data /media/data
No comments:
Post a Comment