jffs2文件系统的制作

环境ubuntu 11.04

参考:
http://blog.21ic.com/user1/6297/archives/2010/69706.html

http://hi.baidu.com/5924431/blog/item/11c0cbfa31ee7f3e4e4aea35.html

dd命令详解
http://blog.chinaunix.net/space.php?uid=20685699&do=blog&id=1571723

一、工具的安装
sudo apt-get install mtd-utils
二、制作文件系统
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

三、在linux的PC上挂载jffs2根文件系统映像
1)加载mtdblock内核模块
    #modprobe mtdblock
2)加载mtdram内核模块,将该设备的大小指定为jffs2根文件系统映像的大小,块擦除大小(即flash的块大小)指定为制作该 jffs2根文件系统时“-e”参数指定的大小,缺省为64KB。下面两个参数的单位都是KB。
     #modprobe mtdram total_size=28928 erase_size=128
3)这时将出现MTD设备/dev/mtdblock0,使用dd命令将jffs2根文件系统拷贝到/dev/mtdblock0设备中。  
    # dd if=genericfs.arm_nofpu.jffs2 of=/dev/mtdblock0
4)将保存了jffs2根文件系统的MTD设备挂载到指定的目录上。
    # mount -t jffs2 /dev/mtdblock0 /mnt/mtd
这样就可以在/mnt/mtd目录下看到文件系统内部的全部内容了,可以拷贝,也可以增加,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
PetaLinux是一个基于嵌入式Linux的开发工具链,用于构建嵌入式系统。它提供了许多可定制的组件和功能,其中包括对JFFS2文件系统的支持。 JFFS2(Journaling Flash File System 2)是一种针对闪存存储设备设计的文件系统。它具有很好的压缩率和高度可靠性,适用于嵌入式系统。在嵌入式系统中,闪存是一种常见的存储设备,它通常具有较小的存储容量和有限的周期寿命。因此,选择合适的文件系统对于确保系统的可靠性和性能至关重要。 使用PetaLinux时选择使用JFFS2文件系统有几个优点。首先,JFFS2具有较好的压缩率,可以节省存储空间。这在嵌入式系统中特别重要,因为闪存的容量通常有限。其次,JFFS2采用了日志技术,可以确保数据的完整性和一致性。它可以通过将修改的数据写入日志中,然后再写入闪存中来提供数据持久性。这有助于防止数据损坏和错误。 另外,PetaLinux提供了对JFFS2文件系统的内建支持和集成工具。这些工具使得在构建嵌入式系统时轻松地添加和配置JFFS2文件系统成为可能。开发人员可以使用PetaLinux提供的命令和选项设置文件系统的参数和属性,以满足特定的需求。 综上所述,使用PetaLinux来构建嵌入式系统并选择JFFS2文件系统能够提供较好的存储空间利用率和数据的可靠性。这使得嵌入式系统在具有有限存储容量和闪存设备的情况下,能够更好地运行和维护。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值