在redhat端(宿主机端)制作jffs2文件系统

本文详细介绍了如何在宿主机上利用gcc制作JFFS2文件系统,包括安装zlib库、mtd-snapshot库,以及mkfs.jffs2命令的使用方法和参数详解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

网上有关于直接在开发板上制作文件系统的,

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 (指明安装地方)



2.接着安装mtd-snapshot-20050519.tar.bz2(下载地址http://down1.chinaunix.net/distfiles/mtd-snapshot-20050519.tar.bz2

$ 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

以上命令基於at91sam2000系列,根據nand flash 或者nor flash 大小和頁大小不同,文件系統的大小等,-s -e -p后的參數會所有不同。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值