网上有关于直接在开发板上制作文件系统的,
http://linux.chinaunix.net/techdoc/system/2009/06/08/1117491.shtml
而我这里讲的是在宿主机上制作jffs2文件系统(当然是用gcc,而不是arm-linux-gcc了)
参考:http://blog.chinaunix.net/uid-23208702-id-353022.html
1.首先安装zlib库
$ tar –zxvf zlib-1.2.3.tar.gz
$ cd zlib-1.2.3
$ ./configure --prefix=/usr/local/arm/3.4.1/arm-linux --shared(共享库形式libz.so)
$ make
$ make install
Makefile文件如下:
CC=gcc(如果是arm-linux-gcc,就是在开发板上使用mkfs.jffs2)CFLAGS=-I/home/jimmy/usr/local/arm/3.4.1/include -DUSE_MMAP
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \q
# -Wstrict-prototypes -Wmissing-prototypes
LDFLAGS=-L. libz.so.1.2.3
LDSHARED=gcc -shared -Wl,-soname,libz.so.1
CPP=gcc -E
LIBS=libz.so.1.2.3
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.3
SHAREDLIBM=libz.so.1
AR=ar rc
RANLIB=ranlib
TAR=tar
SHELL=/bin/sh
EXE=
prefix =/home/jimmy/usr/local/arm/3.4.1 (指明安装地方)
$ tar –jxvf mtd-snapshot-20050519.tar.bz2
$ cd mtd/util
$ make
$ make install
3.安装成功后你会在/usr/sbin/ 看到命令mkfs.jffs2
mkfs.jffs2命令解析如下:
Usage: mkfs.jffs2 [OPTIONS]
Make a JFFS2 file system image from an existing directory tree
选项说明
-p, --pad[=SIZE] Pad output to SIZE bytes with 0xFF. If SIZE is
not specified, the output is padded to the end of
the final erase block
-r, -d, --root=DIR Build file system from directory DIR (default: cwd)
-s, --pagesize=SIZE Use page size (max data node size) SIZE (default: 4KiB)
-e, --eraseblock=SIZE Use erase block size SIZE (default: 64KiB)
-c, --cleanmarker=SIZE Size of cleanmarker (default 12)
-m, --compr-mode=MODE Select compression mode (default: priortiry)
-x, --disable-compressor=COMPRESSOR_NAME
Disable a compressor
-X, --enable-compressor=COMPRESSOR_NAME
Enable a compressor
-y, --compressor-priority=PRIORITY:COMPRESSOR_NAME
Set the priority of a compressor
-L, --list-compressors Show the list of the avaiable compressors
-t, --test-compression Call decompress and compare with the original (for test)
-n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock
-o, --output=FILE Output to FILE (default: stdout)
-l, --little-endian Create a little-endian filesystem
-b, --big-endian Create a big-endian filesystem
-D, --devtable=FILE Use the named FILE as a device table file
-f, --faketime Change all file times to '0' for regression testing
-q, --squash Squash permissions and owners making all files be owned by root
-U, --squash-uids Squash owners making all files be owned by root
-P, --squash-perms Squash permissions on all files
--with-xattr stuff all xattr entries into image
--with-selinux stuff only SELinux Labels into jffs2 image
--with-posix-acl stuff only POSIX ACL entries into jffs2 image
-h, --help Display this help text
-v, --verbose Verbose operation
-V, --version Display version information
-i, --incremental=FILE Parse FILE and generate appendage output for it
例如:
生成新的jffs2文件系统:
#mkfs.jffs2 -l -s 0x800 -e 0x20000 -p 0x4000000 -d mtd/ -o Angstrom-x11-image-demo-glibc-at91.rootfs.jffs2
mkfs.jffs2 -l -s 0x800 -e 0x20000 -p 0x4000000 -d rootfs -o at91-jffs2-rootfs
我的就是:
》mkfs.jffs2 -l -s 0x200 -e 0x4000 -p 0x500000 -d ramdiskfs -o root.jffs2