《DM8168心得之文件系统jffs2的制作.doc》由会员分享,可在线阅读,更多相关《DM8168心得之文件系统jffs2的制作.doc(6页珍藏版)》请在三一办公上搜索。
1、DM8168心得之文件系统jffs2的制作/* author: 卢浩* time: 12.03.08* environment: ubuntu10.04LTS +TI DM8186* kernel version: linux-2.6.37*/首先要搭建制作jffs2的环境要下载这4个文件以下是下载链接1.zlib-1.2.5.tar.gz2. lzo-2.06.tar.gz 3. e2fsprogs-1.42.tar.gz 4. mtd-utils-d37fcc0.tar.gzhttp:/git.infradead.org/mtd-utils.git/snapshot/d37fcc0afd0
2、d4a14c56812847e8e4257d0a99e3b.tar.gz 下载完之后,TI的文档里面给了两种jffs2的,一种是给主机的,一种是个目标板的,也是是8168的。我这里就介绍给8168用的jffs2TargetThis section describes how to cross compile the MTD utilities on the Linux development host for Linux ARM target.首先我在我建立了一个文件夹/home/user/mtd用来存放这4个压缩文件。接下来按照以下步骤操作zlib host$ tar xvf zlib-1.
3、2.5.tar.gz host$ cd zlib-1.2.5/ host$ ./configure -prefix=/home/user/mtd/installEdit resulting Makefile and add toolchain prefix arm-arago-linux-gnueabi- to gcc, ldshared, cpp, ar and ranlib.这边需要注意的是修改Makefile的时候要注意对应你当前的编译器,比如我用的是arm-none-linux-gnueabi-gcc,那就需要把下面的arm-arago-linux-gnueabi-gcc改成arm-n
4、one-linux-gnueabi-gcc,。否则会报错找不到arm-arago-linux-gnueabi-gcc host$ vi Makefile CC=arm-arago-linux-gnueabi-gcc LDSHARED=arm-arago-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,-version-script,zlib.map CPP=arm-arago-linux-gnueabi-gcc -E AR=arm-arago-linux-gnueabi-ar rc RANLIB=arm-arago-linux-gnueabi-r
5、anlibSave and close vi editor. Then you should be ready to compile. host$ make host$ make install host$ cd .Result should be zlib.a in /home/user/mtd/install/lib directory and zlibs headers in /home/user/mtd/install/include.lzo host$ tar xvf lzo-2.06.tar.gz host$ cd lzo-2.06/ host$ ./configure -buil
6、d=i686-pc-linux -prefix=/home/user/mtd/install -host=arm-arago-linux-gnueabi host$ make host$ make install host$ cd .Result should be liblzo2.a in /home/user/mtd/install/lib directory and lzos headers in /home/user/mtd/install/include/lzo.e2fsprogs host$ tar xvf e2fsprogs-1.42.tar.gz host$ cd e2fspr
7、ogs-1.42/ host$ ./configure -build=i686-pc-linux -prefix=/home/user/mtd/install -host=arm-arago-linux-gnueabi host$ make host$ make install host$ cd lib/uuid/ host$ make install host$ cd ./././Result should be libuuid.a in /home/user/mtd/install/lib directory and uuids headers in /home/user/mtd/inst
8、all/include/uuid.mtd-utils host$ tar xvf mtd-utils-d37fcc0.tar.gz host$ cd mtd-utils-d37fcc0/MTD-Utils dont have a configure script, so we have to edit Makefile again. Depending on the version of MTD Utils, make sure head of top level Makefile has:这边TI的意思是把这段代码放在Makefile文件的顶端,但我编译错误了,后来我尝试放到低端,通过了。
9、host$ vi Makefile PREFIX = /home/user/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) CROSS=arm-none-linux-gnueabi-Save
10、and close vi editor. Edit common.mk and comment PREFIX=/usr. host$ vi common.mk # PREFIX=/usrSave and close vi editor. Then you should be ready to compile. host$ WITHOUT_XATTR=1 make host$ make install DESTDIR=/home/user/mtd/install host$ cd .Directory/home/user/mtd/install/sbin/ should now contain
11、cross compiled MTD utils that can be used on target.环境搭建好了,接下来我们要制作jffs2文件系统rootlocalhost util# cd /home/userrootlocalhost util# mkfs.jffs2 -lqn e 128 -r target -o/tftpboot/rd-jffs2.bin这里需要注意的是,你得在你的/home/user下面建立一个文件夹,名字为target,并且把你做的文件系统放在target里面,比如我用的是TI给的文件系统如图这些是解压这个文件得到的。现在你在tftpboot下面应该看到rd-jffs2.bin这个文件了,这就是要烧写到nand里面的文件系统。TI的8168好像只支持jffs2文件系统.不知道这是不是我孤陋寡闻.