MKFS.JFFS2(1)

πŸ’– MKFS.JFFS2 πŸ’–

okay so bestie, welcome to the mkfs.jffs2(1) page from the General Commands Manual β€” yes that's the manual name, it's in the title, we love her πŸ’…


✨ NAME ✨

mkfs.jffs2 β€” Create a JFFS2 file system image from directory


🌸 SYNOPSIS 🌸

mkfs.jffs2 [ -p,--pad[=SIZE] ] [ -r,-d,--root directory ] [
-s,--pagesize=SIZE ] [ -e,--eraseblock=SIZE ] [ -c,--cleanmarker=SIZE ]
[ -n,--no-cleanmarkers ] [ -o,--output image.jffs2 ] [ -l,--little-
endian ] [ -b,--big-endian ] [ -D,--devtable=FILE ] [ -f,--faketime ] [
-q,--squash ] [ -U,--squash-uids ] [ -P,--squash-perms ] [ --with-xattr
] [ --with-selinux ] [ --with-posix-acl ] [ -m,--compression-mode=MODE ]
[ -x,--disable-compressor=NAME ] [ -X,--enable-compressor=NAME ] [
-y,--compressor-priority=PRIORITY:NAME ] [ -L,--list-compressors ] [
-t,--test-compression ] [ -h,--help ] [ -v,--verbose ] [ -V,--version ]
[ -i,--incremental image.jffs2 ]

πŸ¦‹ DESCRIPTION πŸ¦‹

so mkfs.jffs2 makes a JFFS2 (Second Journalling Flash File System) file system image, and then writes that image out to the file you name with -o, or β€” if you didn't say anything β€” to standard output. but plot twist: if standard output happens to be a terminal device, mkfs.jffs2 will straight up abort. no image for you. πŸ™ˆ

the file system image gets built from all the files and directories hanging out inside the directory you point at with -r, or from the present directory if you never passed -r at all. keeping it local, love that. 🫢

every single block of the files going into the image gets compressed using one of the available compressors, depending on whichever compression mode you picked. ✨

file systems are created with the same endianness as the host, unless you went and specified -b or -l. and like, history lesson: the JFFS2 driver in the 2.4 Linux kernel only supported images with the same endianness as the CPU. as of 2.5.48, the kernel can be changed with a #define to accept images of the non-native endianness. but full bi-endian support in the kernel is not planned. so. there's that. πŸ’€

ngl it's unlikely that JFFS2 images are useful except alongside the MTD (Memory Technology Device) drivers in the Linux kernel, because the JFFS2 file system driver in the kernel needs MTD devices. it's giving very specific-use-case, and honestly? iconic for it. πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

okay so first, the little rule for all the options that take a SIZE argument: you can write that SIZE as decimal (like 65536), octal (like 0200000), or hexadecimal (like 0x1000). pick your fighter, bestie. πŸ’–

  • -p, --pad[=SIZE] β€” pad the output out to SIZE bytes using 0xFF. if you don't give a SIZE at all, the output gets padded to the end of the final erase block. cute little filler. 🌸
  • -r, -d, --root=DIR β€” build the file system from directory DIR. the default is the current directory. yes, three ways to say the same thing, she contains multitudes. πŸ’…
  • -s, --pagesize=SIZE β€” use page size SIZE. the default is 4 KiB. this size is the maximum size of a data node. set it according to the target system's memory management page size. and fr fr: NOTE: this is NOT related to NAND page size. don't get it twisted. 🫢
  • -e, --eraseblock=SIZE β€” use erase block size SIZE. the default is 64 KiB. if you use an erase block size that's different from the erase block size of the target MTD device, JFFS2 may not perform optimally. 😭 and if the SIZE you specified is below 4096, the units are assumed to be KiB.
  • -c, --cleanmarker=SIZE β€” write CLEANMARKER nodes with the size specified. it is not normally appropriate to specify a size other than the default 12 bytes. so like, unless you know exactly why you're doing this, don't. πŸ™ˆ
  • -n, --no-cleanmarkers β€” do not write CLEANMARKER nodes to the beginning of each erase block. this option can be useful for creating JFFS2 images for use on NAND flash, and for creating images which are to be used on a variety of hardware with differing eraseblock sizes. versatile queen. ✨
  • -o, --output=FILE β€” write the JFFS2 image to file FILE. default is the standard output.
  • -l, --little-endian β€” create a little-endian JFFS2 image. default is to make an image with the same endianness as the host.
  • -b, --big-endian β€” create a big-endian JFFS2 image. default is to make an image with the same endianness as the host.
  • -D, --devtable=FILE β€” use the named FILE as a device table file, for including devices and changing permissions in the created image when the user does not have appropriate permissions to create them on the file system used as source. permission-issue workaround, we stan a resourceful moment. πŸ‘‘
  • -f, --faketime β€” change all file timestamps to 0 for regression testing. time? never heard of her. ⭐
  • -q, --squash β€” squash permissions and owners, making all files be owned by root and removing write permission for group and other. flatten it all out, bestie. πŸŽ€
  • -U, --squash-uids β€” squash owners, making all files be owned by root.
  • -P, --squash-perms β€” squash permissions, removing write permission for group and other.
  • --with-xattr β€” enables xattr, stuffs all xattr entries into the jffs2 image file.
  • --with-selinux β€” enables xattr, stuffs only SELinux Labels into the jffs2 image file.
  • --with-posix-acl β€” enable xattr, stuffs only POSIX ACL entries into the jffs2 image file.
  • -m, --compression-mode=MODE β€” set the default compression mode. the default mode is priority, which tries the compressors in a predefined order and chooses the first successful one. the alternatives are: none (mkfs will not compress) and size (mkfs will try all compressors and chooses the one which has the smallest result). picking the smallest result? that's the overachiever energy we love. πŸ’–
  • -x, --disable-compressor=NAME β€” disable a compressor. use -L to see the list of the available compressors and their default states.
  • -X, --enable-compressor=NAME β€” enable a compressor. use -L to see the list of the available compressors and their default states.
  • -y, --compressor-priority=PRIORITY:NAME β€” set the priority of a compressor. use -L to see the list of the available compressors and their default priority. priorities are used by priority compression mode.
  • -L, --list-compressors β€” show the list of the available compressors and their states.
  • -t, --test-compression β€” call decompress after every compress β€” and compare the result with the original data β€” and some other check. double-checking your own work? self-aware icon behaviour. πŸ”₯
  • -h, --help β€” display help text.
  • -v, --verbose β€” verbose operation.
  • -V, --version β€” display version information.
  • -i, --incremental=FILE β€” generate an appendage image for FILE. if FILE is written to flash and flash is appended with the output, then it seems as if it was one thing. sneaky seamless, iykyk. πŸ¦‹

😭 LIMITATIONS 😭

the format and grammar of the device table file does not allow it to create symbolic links when the symbolic links are not already present in the root working directory. like, it simply cannot, bestie. no cap.

however β€” and this is the lil loophole β€” symbolic links may be specified in the device table file using the l type, for the purposes of setting their permissions and ownership. so it's not fully powerless. πŸ’…


πŸ’€ BUGS πŸ’€

JFFS2 limits device major and minor numbers to 8 bits each. some consider this a bug. (some do! and honestly, valid.) πŸ™ˆ

mkfs.jffs2 does not properly handle hard links in the input directory structure. currently, hard linked files will be expanded to multiple identical files in the output image. so your one file becomes many. it's giving clone army. not the slay we wanted. 😭


πŸ‘‘ AUTHORS πŸ‘‘

  • David Woodhouse
  • Manual page written by David Schleef <ds@schleef.org>

🌈 SEE ALSO 🌈


and that's the whole page bestie, we ate, no crumbs left πŸ“ β€” this was the mkfs.jffs2(1) page from the General Commands Manual, and the MKFS.JFFS2(1) footer tag at the very bottom is just her name signing off. mwah. πŸ’–βœ¨πŸŽ€πŸ¦‹