DM8168心得之文件系统jffs2的制作

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.gz

http://ishare.iask.sina.com.cn/f/13924714.html

2.lzo-2.06.tar.gz

http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz

3.e2fsprogs-1.42.tar.gz

http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/1.42/e2fsprogs-1.42.tar.gz/download

4.mtd-utils-d37fcc0.tar.gz

http://git.infradead.org/mtd-utils.git/snapshot/d37fcc0afd0d4a14c56812847e8e4257d0a99e3b.tar.gz


 


下载完之后,TI的文档里面给了两种jffs2的,一种是给主机的,一种是个目标板的,也是是8168的。
我这里就介绍给8168用的jffs2




Target
This 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.2.5.tar.gz
    host$ cd zlib-1.2.5/
    host$ ./configure --prefix=/home/user/mtd/install




Edit 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-none-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-ranlib




Save 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 zlib's headers in /home/user/mtd/install/include.
lzo
    host$ tar xvf lzo-2.06.tar.gz
    host$ cd lzo-2.06/
    host$ ./configure --build=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 lzo's headers in /home/user/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/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 uuid's headers in /home/user/mtd/install/include/uuid.
mtd-utils
    host$ tar xvf mtd-utils-d37fcc0.tar.gz
    host$ cd mtd-utils-d37fcc0/




MTD-Utils don't 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文件的顶端,但我编译错误了,后来我尝试放到低端,通过了。
    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 and close vi editor. Edit common.mk and comment PREFIX=/usr.
    host$ vi common.mk
           # PREFIX=/usr




Save 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 cross compiled MTD utils that can be used on target.
环境搭建好了,接下来我们要制作jffs2文件系统




[root@localhost util]# cd /home/user
[root@localhost 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文件系统...不知道这是不是我孤陋寡闻...
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值