当前位置 博文首页 > 似水流年:嵌入式Linux--mkfs.jffs2使用方法

    似水流年:嵌入式Linux--mkfs.jffs2使用方法

    作者:[db:作者] 时间:2021-09-05 22:18

    Linux使用mkfs.jffs2命令需要安装mtd-utils工具

    root@ubuntu:~# apt-get install mtd-utils
    
    root@ubuntu:~# mkfs.jffs2 --help
    mkfs.jffs2: error!: Usage: mkfs.jffs2 [OPTIONS]
    从现有目录树制作JFFS2文件系统映像
    
    
    Options:
      -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.
                              Set according to target system's memory management
                              page 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
    
    !/bin/sh
    mkfs.jffs2 -s 0x100 -e 0x10000 --pad= 0xAF0000 -d rootfs/ -o jffs2.img
    
    • -s 页面大小:0x100,256字节
    • -e 擦除块的大小:0x10000,65536字节
    • –pad
    • -d 设备表
    • -o 输出文件
    cs