Some devices like the NBG6616 and NBG6617 expect the kernel to be
in a JFFS2 partition. This macro allows wrapping the kernel so that
a normal squashfs+jffs partition can be used for the rest of the
firmware.

Signed-off-by: Benjamin Berg <benja...@sipsolutions.net>
---
 include/image.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/image.mk b/include/image.mk
index 43980bc..8a23800 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -347,6 +347,21 @@ define Build/gzip
        @mv $@.new $@
 endef
 
+define Build/jffs2
+       mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1))
+       cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(1)
+
+       $(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad=$$(($(subst k,* 1024,$(subst 
m, * 1024k,$(KERNEL_SIZE))))) \
+               $(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) \
+               --squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
+               -o $@.new \
+               -d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
+               2>&1 1>/dev/null | awk '/^.+$$$$/'
+
+       @rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
+       @mv $@.new $@
+endef
+
 define Build/kernel-bin
        rm -f $@
        cp $^ $@
-- 
2.6.2
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to