[ELDK] [PATCH][RFSB] Expand mkfs.jffs2 options

Ron Madrid ron_madrid at sbcglobal.net
Mon Jun 28 23:12:36 CEST 2010


This patch will add the options for page size, image padding, clean markers,
and clean marker size.  This patch also sets the default for
JFFS2_ERASE_BLOCKSIZE to zero and checks that all appropriate values have been
set.

Signed-off-by: Ron Madrid <ron_madrid at sbcglobal.net>
---
 Config.in |   37 ++++++++++++++++++++++++++++++++++++-
 Makefile  |   18 ++++++++++++++++--
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/Config.in b/Config.in
index 39c965b..fe61feb 100644
--- a/Config.in
+++ b/Config.in
@@ -129,12 +129,47 @@ config IMAGE_JFFS2
 config JFFS2_ERASE_BLOCKSIZE
        depends IMAGE_JFFS2
        int "Eraseblocksize to use for image"
-       default 16384
+       default 0
        help
          This has to match the eraseblocksize of the chip the image is
          going to be used on.  On NOR flashes nowadays this is usally
          greater than 64k, whereas NAND usually has 16k today.
 
+config JFFS2_PAGE_SIZE
+       depends IMAGE_JFFS2
+       int "Page size to use for image"
+       default 0
+       help
+         This has to match the page size of the chip the image is going to
+	 be used on.  For large page NAND flash this is usally 2 KiB and
+	 for small page NAND FLASH this is usually 512 bytes.
+
+config JFFS2_PAD_IMAGE
+       depends IMAGE_JFFS2
+       bool "Pad the JFFS2 image"
+       default y
+       help
+         This will pad the resultant JFFS2 image to the next eraseblocksize
+	 boundary.
+
+config JFFS2_CLEANMARKER
+       depends IMAGE_JFFS2
+       bool "Apply CLEANMARKER nodes to JFFS2 image"
+       default n
+       help
+         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.
+
+config JFFS2_CLEANMARKER_SIZE
+       depends JFFS2_CLEANMARKER
+       int "CLEANMARKER size"
+       default 0
+       help
+         Write 'CLEANMARKER' nodes with the size specified. It is not normally
+	 appropriate to specify a size other than the default 12 bytes.
+
 config IMAGE_UBIFS
        bool "Create UBIFS image"
        default n
diff --git a/Makefile b/Makefile
index 2ccc845..0c2a4a7 100644
--- a/Makefile
+++ b/Makefile
@@ -129,6 +129,16 @@ else
 JFFS2_FLAGS=-l
 CRAMFS_FLAGS=-l
 endif
+
+ifeq ($(strip $(JFFS2_PAD_IMAGE)),y)
+JFFS2_FLAGS+=--pad
+endif
+
+ifeq ($(strip $(JFFS2_CLEANMARKER)),y)
+JFFS2_FLAGS+=--cleanmarker=$(strip $(JFFS2_CLEANMARKER_SIZE))
+else
+JFFS2_FLAGS+=-n
+endif
 SQUASHFS_FLAGS=
 
 all:   $(image_targets)
@@ -274,8 +284,12 @@ image_jffs2:	$(JFFS2_FILE)
 
 $(JFFS2_FILE):	$(STAMP_ROOTFS)
 	@echo Generating JFFS2 image
-	mkfs.jffs2 $(JFFS2_FLAGS) -d $(BUILD_RFS) -e $(JFFS2_ERASE_BLOCKSIZE) -D $(DEV_TAB) \
-	 -o $(JFFS2_FILE)
+	@if [[ $(JFFS2_PAGE_SIZE) == 0 || $(JFFS2_ERASE_BLOCKSIZE) == 0 || "$(JFFS2_CLEANMARKER_SIZE)" == 0 ]];then \
+		echo "ERROR: Not all JFFS2 parameters set.  Fix your configuration and try again" >&2 ; \
+	else \
+	mkfs.jffs2 $(JFFS2_FLAGS) -d $(BUILD_RFS) -s $(JFFS2_PAGE_SIZE) \
+		-e $(JFFS2_ERASE_BLOCKSIZE) -D $(DEV_TAB) -o $(JFFS2_FILE); \
+	fi
 
 image_ubifs:	$(UBIFS_FILE)
 
-- 
1.7.0.4



More information about the eldk mailing list