SOLVED: Building a small read-only JFFS2 partition

Hello,
I'd like to make the smallest read-only JFFS2 partition to house a single file with the name of a 32byte uuid. Inside of target/myplatform/image/Makefile I have the following:

rm -rf $(BIN_DIR)/emptydir
    mkdir $(BIN_DIR)/emptydir
    echo  -ne "5f28b433e9c440db952b11a7c10a6414" > $(BIN_DIR)/emptydir/5f28b433e9c440db952b11a7c10a6414
    mkfs.jffs2 --root=$(BIN_DIR)/emptydir --output=$(BIN_DIR)/uuid.jffs2 --little-endian
    rm -rf $(BIN_DIR)/emptydir

My DTB & MTD driver knows about this partition (I added it), however, when I mount it manually, the partition is empty. The file is present when I run the strings command on the raw mtd.

Any help would be awesome - perhaps I need to append some magic to the image or need a minimum size?

My DTB node for this partition needed to be larger - set it to be about 16K. I had noticed in dmesg that the mounting process when I ran mount was saying size mismatch and concatenating the partition to 0KB. Once the padding and sizes matched, everything worked okay.

mkfs.jffs2 --root=$(BIN_DIR)/emptydir --output=$(BIN_DIR)/$PART_NAME --eraseblock=$EBS \
--pad=$PAD_SIZE --little-endian --no-cleanmarkers

Along with the kernel mtd mapping/driver, I was able to mount the FS correctly.

mount -t jffs2 -r /dev/mtdblockX /tmp/test

With the -r this at least will tell the user that the partition is Read-Only instead of the user writing (and thinking it was persistent); with the changes being gone on next reboot.

Marked as closed.

mkfs.jffs2 is not compiling with lede 17.01.4. Only mkfs.ext* files are getting prepared. Any hints on this.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.