target: split jffs2 NAND out of jffs2
authorJonas Gorski <jogo@openwrt.org>
Wed, 5 Jun 2013 20:58:03 +0000 (20:58 +0000)
committerJonas Gorski <jogo@openwrt.org>
Wed, 5 Jun 2013 20:58:03 +0000 (20:58 +0000)
Make jffs2_nand a separate option so this can be triggered without forcing
jffs2 images for nor targets.

Adds a new NAND_BLOCKSIZE variable that allows setting the generated layout
in <page_size>:<block_size> pairs.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 36860

Config.in
include/image.mk
scripts/metadata.pl
target/Config.in

index b79a26e871e89bb0717372f8eb5d824d78151a7e..8dd73cc2586e24cdfa28ad7b3346a227ca8b0153 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -97,6 +97,13 @@ menu "Target Images"
                help
                  Build a jffs2 root filesystem
 
+       config TARGET_ROOTFS_JFFS2_NAND
+               bool "jffs2 for NAND"
+               default y if USES_JFFS2_NAND
+               depends on !TARGET_ROOTFS_INITRAMFS && USES_JFFS2_NAND
+               help
+                 Build a jffs2 root filesystem for NAND flash
+
        config TARGET_ROOTFS_SQUASHFS
                bool "squashfs"
                default y if USES_SQUASHFS
index 302228816ee5e80cf61edc156e74413bf3784ae5..60cde014de857b203824ff4f0cb05c4bb957c164 100644 (file)
@@ -77,15 +77,25 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 
 else
 
-  ifneq ($(CONFIG_TARGET_ROOTFS_JFFS2),)
-    define Image/mkfs/jffs2/sub
+  define Image/mkfs/jffs2/sub
                # FIXME: removing this line will cause strange behaviour in the foreach loop below
-               $(STAGING_DIR_HOST)/bin/mkfs.jffs2 $(JFFS2OPTS) -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(1) -d $(TARGET_DIR) -v 2>&1 1>/dev/null | awk '/^.+$$$$/'
-               $(call add_jffs2_mark,$(KDIR)/root.jffs2-$(1))
-               $(call Image/Build,jffs2-$(1))
-    endef
+               $(STAGING_DIR_HOST)/bin/mkfs.jffs2 $(3) -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(2) -d $(TARGET_DIR) -v 2>&1 1>/dev/null | awk '/^.+$$$$/'
+               $(call add_jffs2_mark,$(KDIR)/root.jffs2-$(2))
+               $(call Image/Build,jffs2-$(2))
+  endef
+
+  ifneq ($(CONFIG_TARGET_ROOTFS_JFFS2),)
     define Image/mkfs/jffs2
-               $(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/sub,$(SZ)))
+               $(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/sub,$(SZ),$(SZ),$(JFFS2OPS)))
+    endef
+  endif
+
+  ifneq ($(CONFIG_TARGET_ROOTFS_JFFS2_NAND),)
+    define Image/mkfs/jffs2_nand
+               $(foreach SZ,$(NAND_BLOCKSIZE), $(call Image/mkfs/jffs2/sub, \
+                       $(word 2,$(subst :, ,$(SZ))),nand-$(subst :,-,$(SZ)), \
+                       $(JFFS2OPTS) --no-cleanmarkers --pagesize=$(word 1,$(subst :, ,$(SZ)))) \
+               )
     endef
   endif
 
@@ -188,6 +198,7 @@ define BuildImage
                $(call Image/mkfs/ext4)
                $(call Image/mkfs/iso)
                $(call Image/mkfs/jffs2)
+               $(call Image/mkfs/jffs2_nand)
                $(call Image/mkfs/squashfs)
                $(call Image/mkfs/ubifs)
                $(call Image/Checksum)
@@ -199,6 +210,7 @@ define BuildImage
                $(call Image/mkfs/ext4)
                $(call Image/mkfs/iso)
                $(call Image/mkfs/jffs2)
+               $(call Image/mkfs/jffs2_nand)
                $(call Image/mkfs/squashfs)
                $(call Image/mkfs/ubifs)
                $(call Image/Checksum)
index 13abcb29370c1df205cbedb7c6bc93c63032f169..ade86c867c85ed11c8db876c3e2c0072098c4654 100755 (executable)
@@ -165,7 +165,8 @@ sub target_config_features(@) {
                /pcmcia/ and $ret .= "\tselect PCMCIA_SUPPORT\n";
                /rtc/ and $ret .= "\tselect RTC_SUPPORT\n";
                /squashfs/ and $ret .= "\tselect USES_SQUASHFS\n";
-               /jffs2/ and $ret .= "\tselect USES_JFFS2\n";
+               /jffs2$/ and $ret .= "\tselect USES_JFFS2\n";
+               /jffs2_nand/ and $ret .= "\tselect USES_JFFS2_NAND\n";
                /ext4/ and $ret .= "\tselect USES_EXT4\n";
                /targz/ and $ret .= "\tselect USES_TARGZ\n";
                /cpiogz/ and $ret .= "\tselect USES_CPIOGZ\n";
index 947e80ca4a511d9bf9e62f951c9e423fec646ac0..a7951aaf3b6da904024e55b36115fee9fce26121 100644 (file)
@@ -48,6 +48,9 @@ config USES_SQUASHFS
 config USES_JFFS2
        bool
 
+config USES_JFFS2_NAND
+       bool
+
 config USES_EXT4
        bool