Re: [OpenWrt-Devel] [PATCH 1/2] include/image.mk: Introduce option to wrap kernel into JFFS2

2015-11-02 Thread Felix Fietkau
On 2015-11-02 20:33, Benjamin Berg wrote:
> 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.
Does that board run u-boot? If it does, you may want to use the padjffs2
utility to force it to stop scanning after the end of the filesystem image.

In case the boot loader scans the whole filesystem, this will also
prevent it from parsing data from OpenWrt's jffs2 overlay.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] include/image.mk: Introduce option to wrap kernel into JFFS2

2015-11-02 Thread Benjamin Berg
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 
---
 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


Re: [OpenWrt-Devel] [PATCH 1/2] include/image.mk: Introduce option to wrap kernel into JFFS2

2015-11-02 Thread Benjamin Berg
On Mo, 2015-11-02 at 20:49 +0100, Felix Fietkau wrote:
> On 2015-11-02 20:33, Benjamin Berg wrote:
> > 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.
> Does that board run u-boot? If it does, you may want to use the padjffs2
> utility to force it to stop scanning after the end of the filesystem image.
> 
> In case the boot loader scans the whole filesystem, this will also
> prevent it from parsing data from OpenWrt's jffs2 overlay.

Sounds good. I was simply looking at the ZyXELNAND target, which does
not do that currently. Only realized now that mkubntkernelimage is
pretty much identical and does the padding already.

So, the new plan would be to merge mkubntkernelimage with what I stared
with the jffs2 definition. That way both models can use the same
definition and the ubnt-uap-pro KERNEL line changes from
  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | mkubntkernelimage
to
  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0

Benjamin


signature.asc
Description: This is a digitally signed message part
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel