ubuntu1404 MTD安装 ubi文件系统制作

ubuntu1404

zlib
host$ tar -jxvf zlib-1.2.5.tar.bz2
host$ cd zlib-1.2.5/
host$ ./configure --prefix=/home/yqa1404/mtd/install
host$ make
host$ make install
host$ cd ..
Result should be libz.a in ~/mtd/install/lib directory and zlib's headers in ~/mtd/install/include.

lzo
host$ tar xvf lzo-2.10.tar.gz
host$ cd lzo-2.10/
host$ ./configure --build=i686-pc-linux --prefix= /home/yqa1404 /mtd/install
host$ make
host$ make install
host$ cd ..
Result should be liblzo2.a in ~/mtd/install/lib directory and lzo's headers in ~/mtd/install/include/lzo.

e2fsprogs
host$ tar xvf e2fsprogs-1.42.tar.gz
host$ cd e2fsprogs-1.42/
host$ ./configure --build=i686-pc-linux --prefix= /home/yqa1404 /mtd/install
host$ make
host$ make install
host$ cd lib/uuid/
host$ make install
host$ cd ../../../
Result should be libuuid.a in ~/mtd/install/lib directory and uuid's headers in ~/mtd/install/include/uuid.

mtd-utils
host$ tar xvf mtd-utils-d37fcc0.tar.gz
host$ cd mtd-utils-d37fcc0/
mtd-utils doesn't have a configure script, so we have to edit the Makefile again. Depending on the version of mtd-utils, make sure head of top level Makefile has:
host$ vi Makefile //增加如下内容
PREFIX = /home/yqa1404 /mtd/install
ZLIBCPPFLAGS = -I$(PREFIX)/include
LZOCPPFLAGS = -I$(PREFIX)/include
ZLIBLDFLAGS = -L$(PREFIX)/lib
LZOLDFLAGS = -L$(PREFIX)/lib
LDFLAGS += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
CFLAGS ?= -O2 -g $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
Save and close vi editor
Edit the common.mk file and comment out the PREFIX=/usr line
host$ vi common.mk //修改
#PREFIX=/usr
Save and close vi editor
host$ WITHOUT_XATTR=1 make
host$ make install DESTDIR= /home/yqa1404 /mtd/install
host$ cd ..
Directory ~/mtd/install/sbin/ should now contain compiled MTD utils you can use on Linux host. The binaries for the tools used to create a UBIFS root file system will be found here:
~/mtd/install/home/<username>/mtd/install/sbin/mkfs.ubifs 
~/mtd/install/home/<username>/mtd/install/sbin/ubinize

制作 ubifs之前声明路径:
mkfs.ubifs ubinize在/home/yqa1404/mtd/install/sbin
$:  vim ~/.profile 
添加
export PATH=$PATH:/home/yqa1404/mtd/install/home/yqa1404/mtd/install/sbin
export PATH=$PATH:/home/yqa1404/mtd/install/sbin/
$:  source ~ /.profile 


制作:
////home/yqa1404/fsubi/rootfs/  文件系统存储目录   nand :256M
1、
$: mkdir fsubi
$: cd fsubi
$: mkfs.ubifs -F  -r / home/yqa1404/fsubi/rootfs/  -m 2048 -e 126976 -c 1580 -o ubifs.img

-F:使能"white-space-fixup",如果是通过 u-boot 烧写需要使能此功能。
-r:待制作的文件系统目录
-m: NAND FLASH 的最小读写单元,一般为 page size
-e: -e, --leb-size=SIZE      logical erase block size LEB size,对于 AM335x 的 NAND driver,为 block size-2x(page size)
-c:文件系统所占用的最大 block 数,一般小于等于 block count -1
-o:输出的 ubifs.img 文件
2、
$: touch cfg.ini
_________________________________
$: vim cfg.ini 
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=200MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
vol_alignment=1
_________________________________
-s:最小的硬件输入输出页面大小
文件系统最多可以访问卷上的-e (volue)*-c(volue)=xxxM空间
$:  
ubinize -o ubi.img -m 2048 -p 128KiB -s 2048 -O 2048 cfg.ini

猜你喜欢

转载自blog.csdn.net/yqa1027473639/article/details/78729139