Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-12-05 Thread Mark Mentovai
Jonathan McCrohan wrote:
 Is there even a need to produce an oversize image warning? I'm not aware
 of any other architecture that refuses to build over a certain size. x86
 being the obvious exception, but that is different because it doesn't
 target any particular device, but a whole architecture. (Either way, the
 rootfs size is customisable by the user.)

Silently producing an unusable image can be pretty bad.

It looks like juhosg has taken care of this in r29431.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-12-04 Thread Jonathan McCrohan
Hi Mark,

On 29/11/11 18:51, Dave Taht wrote:
 On Tue, Nov 29, 2011 at 7:44 PM, Mark Mentovai m...@moxienet.com wrote:
 Jonathan Bennett wrote:
 This patch seems like a really good idea for the ar71xx family. What
 sorts of problems are preventing this from being implemented? As small
 as it sounds, an extra 192k would be really useful on quite a few
 routers.

 I don't know of any actual problems with the patch. When I originally
 proposed the patch on this list, Dave Taht was concerned that it might
 not leave enough headroom to field-update the kernel with a larger one
 (https://lists.openwrt.org/pipermail/openwrt-devel/2011-August/012026.html),
 
 
 I withdraw my objections.

I see this patch has been committed as r29406.

Would you mind having another look at this patch as a priority, as it
causes images larger than 8MB to FTBFS.

While this obviously is not a problem for the WNDR3700, it is a problem
for the WNDR3700v2 and WNDR3800, both of which have 16MB of flash.

Attached is a build log.

Thanks,
Jon
/home/user/bin/openwrt/trunk/staging_dir/host/bin/lzma e 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700 
-lc1 -lp2 -pb2 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.bin.lzma

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
mkimage -A mips -O linux -T kernel -a 0x8006 -C lzma -e 0x8006 -n 'MIPS 
OpenWrt Linux-2.6.39.4' -d 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.bin.lzma
 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage
Image Name:   MIPS OpenWrt Linux-2.6.39.4
Created:  Mon Dec  5 00:17:03 2011
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:879870 Bytes = 859.25 kB = 0.84 MB
Load Address: 8006
Entry Point:  8006
rm -rf /home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700
mkdir -p 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700/image
/home/user/bin/openwrt/trunk/staging_dir/host/bin/wndr3700 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage
 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700/image/uImage
 3700
/home/user/bin/openwrt/trunk/staging_dir/host/bin/mksquashfs-lzma 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs.tmp
 -nopad -noappend -root-owned -be
Creating big endian 3.0 filesystem on 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs.tmp,
 block size 65536.

Big endian filesystem, data block size 65536, compressed data, compressed 
metadata, compressed fragments
Filesystem size 859.53 Kbytes (0.84 Mbytes)
99.99% of uncompressed filesystem size (859.61 Kbytes)
Inode table size 67 bytes (0.07 Kbytes)
45.89% of uncompressed inode table size (146 bytes)
Directory table size 37 bytes (0.04 Kbytes)
90.24% of uncompressed directory table size (41 bytes)
Number of duplicate files found 0
Number of inodes 3
Number of files 1
Number of fragments 0
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2
Number of uids 1
root (0)
Number of gids 0
rm -rf /home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700
mkimage -A mips -O linux -T filesystem -C none -a 0xbf07 -e 0xbf07 -n 
'MIPS OpenWrt Linux-2.6.39.4' -d 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs.tmp
 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs.tmp2
Image Name:   MIPS OpenWrt Linux-2.6.39.4
Created:  Mon Dec  5 00:17:03 2011
Image Type:   MIPS Linux Filesystem Image (uncompressed)
Data Size:880161 Bytes = 859.53 kB = 0.84 MB
Load Address: bf07
Entry Point:  bf07
/home/user/bin/openwrt/trunk/staging_dir/host/bin/wndr3700 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs.tmp2
 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs
 3700
rm -f 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs.tmp*
if [ `stat -c%s 
'/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs'`
 -gt `cat 
'/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700_kernel_maxsize'`
 ]; then echo 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/vmlinux-wndr3700.uImage.squashfs
 is too big  2; false; fi
if [ `stat -c%s 
'/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/root.jffs2-64k'` 
-gt `cat 
'/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/wndr3700_rootfs_maxsize'`
 ]; then echo 
/home/user/bin/openwrt/trunk/build_dir/linux-ar71xx_generic/root.jffs2-64k is 
too big  2; false; fi

Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-12-04 Thread Dave Taht
On Mon, Dec 5, 2011 at 5:15 AM, Mark Mentovai m...@moxienet.com wrote:
 Jonathan McCrohan wrote:
 Would you mind having another look at this patch as a priority, as it
 causes images larger than 8MB to FTBFS.

 While this obviously is not a problem for the WNDR3700, it is a problem
 for the WNDR3700v2 and WNDR3800, both of which have 16MB of flash.

 Attached is a build log.

 Of course. It's failing while attempting to build a WNDR3700 (v1)
 image, because there's no way to produce an image for WNDR3700 this
 large. It'd never fit in its flash. I believe it's correct to produce
 an error in this case. What you'd evidently like to do is produce
 WNDR3700v2 and WNDR3800 images, but not WNDR3700 (v1). The build
 system doesn't currently allow for this, because it produces the three
 images simultaneously. What you can do is locally remove this line
 from target/linux/ar71xx/image/Makefile:

Would there be a way to set, globally, something that would disable
building images for sub 8MB flash units in the ar71xx series? That
way I could build for more than the wndr3700v2 and 3800 series (
the wzr, for example).


        $(call 
 Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3700,$(wndr3700_cmdline),$(wndr3700_mtdlayout),3700,WNDR3700,
 NA,)
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel



-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
FR Tel: 0638645374
http://www.bufferbloat.net
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-11-29 Thread Mark Mentovai
Jonathan Bennett wrote:
 This patch seems like a really good idea for the ar71xx family. What
 sorts of problems are preventing this from being implemented? As small
 as it sounds, an extra 192k would be really useful on quite a few
 routers.

I don't know of any actual problems with the patch. When I originally
proposed the patch on this list, Dave Taht was concerned that it might
not leave enough headroom to field-update the kernel with a larger one
(https://lists.openwrt.org/pipermail/openwrt-devel/2011-August/012026.html),
although my position is that this is what the configuration-preserving
sysupgrade feature is for
(https://lists.openwrt.org/pipermail/openwrt-devel/2011-August/012033.html).

My patch is specific to WNDR3700 (and derivatives including WNDR3700v2
and WNDR3800), not the entire ar71xx family.

I've been keeping the patch up-to-date
(https://dev.openwrt.org/ticket/8781) and have been using it in all of
my images for nearly a year. I know that others have been using this
patch as well, and it's present in at least one community binary
build. In current trunk images, the savings is only 128kB. In the time
since I originally wrote this patch, the kernel's grown into another
erase block.

Someone else suggested detecting the beginning of the rootfs as is
done on another target
(https://dev.openwrt.org/browser/trunk/target/linux/lantiq/patches/201-owrt-mtd_uimage_split.patch),
although I'm not very excited about scanning for a magic number in
this manner. It's too fragile. It may be possible to determine the
kernel size by other means, which would make it possible for the
kernel to calculate the kernel-rootfs split at runtime more reliably.
Unfortunately, detecting the kernel partition size in this manner
would be board-specific, because different boards load the kernel in
different ways.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-11-29 Thread Dave Taht
On Tue, Nov 29, 2011 at 7:44 PM, Mark Mentovai m...@moxienet.com wrote:
 Jonathan Bennett wrote:
 This patch seems like a really good idea for the ar71xx family. What
 sorts of problems are preventing this from being implemented? As small
 as it sounds, an extra 192k would be really useful on quite a few
 routers.

 I don't know of any actual problems with the patch. When I originally
 proposed the patch on this list, Dave Taht was concerned that it might
 not leave enough headroom to field-update the kernel with a larger one
 (https://lists.openwrt.org/pipermail/openwrt-devel/2011-August/012026.html),


I withdraw my objections.

 although my position is that this is what the configuration-preserving
 sysupgrade feature is for
 (https://lists.openwrt.org/pipermail/openwrt-devel/2011-August/012033.html).

 although I would like the field update feature to
become ever more robust.


-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
FR Tel: 0638645374
http://www.bufferbloat.net
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-08-26 Thread Mark Mentovai
Dave Taht wrote:
 Awesome. However I'd like to somehow make for fully field-upgradable
 kernels for this device (how to do that?), and reserving 64k strikes
 me as too small to account for future growth.

It doesn't reserve 64kB. It doesn't really reserve anything at all.
There can be as little as zero bytes of free space in the kernel mtd
partition. The point is to pack it in as tightly as possible, leaving
more space for the rootfs.

I didn't think that field-upgradability by replacing only the contents
of the kernel mtd partition was a design goal. Considering that it's
likely that a kernel upgrade will also require a /lib/modules upgrade,
I'm not sure it's even worthwhile to make it a design goal. Field-
upgradability is addressed by sysupgrade, which is able to replace the
entire firmware image (including the kernel and rootfs, with
/lib/modules) while retaining configuration files and other files marked
to be saved through the upgrade.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-08-25 Thread Mark Mentovai
This replaces the fixed flash layout currently used on the WNDR3700
family with one whose mtd partition sizes are computed dynamically.
Rather than reserving 1MB for the kernel regardless of its actual space
requirements, this computes an appropriate size for the kernel, rounded
up to a 64kB erase block boundary. The space freed up by the kernel is
available for use by the on-flash rootfs. In current trunk builds, this
makes an extra 192kB available for user purposes.

I've been using this patch since February when I first wrote it, and so
have others. Fixes https://dev.openwrt.org/ticket/8781.

Signed-off-by: Mark Mentovai m...@moxienet.com

---

Index: target/linux/ar71xx/image/Makefile
===
--- target/linux/ar71xx/image/Makefile  (revision 27926)
+++ target/linux/ar71xx/image/Makefile  (working copy)
@@ -42,13 +42,13 @@

 define PatchKernelLzma
cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
-   $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip 
$(2))'
+   $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) $(strip 
$(2))
$(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).bin.lzma)
 endef

 define PatchKernelGzip
cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
-   $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip 
$(2))'
+   $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) $(strip 
$(2))
gzip -9 -c $(KDIR)/vmlinux-$(1)  $(KDIR)/vmlinux-$(1).bin.gz
 endef

@@ -287,29 +287,72 @@
rm $(KDIR)/image.tmp
 endef

-define Image/Build/Netgear
-   $(call MkuImageLzma,$(2),$(3) $($(4)))
-   mkdir -p $(KDIR)/wndr3700/image
+define Image/Build/Netgear/Build_uImage
+   $(call MkuImageLzma,$(1),$(2) $(3))
+   -rm -rf $(KDIR)/$(1)
+   mkdir -p $(KDIR)/$(1)/image
$(STAGING_DIR_HOST)/bin/wndr3700 \
-   $(KDIR)/vmlinux-$(2).uImage \
-   $(KDIR)/wndr3700/image/uImage \
-   $(5)
+   $(KDIR)/vmlinux-$(1).uImage \
+   $(KDIR)/$(1)/image/uImage \
+   $(4)
$(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
-   $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
+   $(KDIR)/$(1) $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp \
-nopad -noappend -root-owned -be
-   -rm -rf $(KDIR)/wndr3700
+   -rm -rf $(KDIR)/$(1)
mkimage -A mips -O linux -T filesystem -C none \
-a 0xbf07 -e 0xbf07 \
-n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
-   -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
-   $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2
+   -d $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp \
+   $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp2
$(STAGING_DIR_HOST)/bin/wndr3700 \
-   $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \
-   $(KDIR)/vmlinux-$(2).uImage.squashfs \
-   $(5)
-   -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
+   $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp2 \
+   $(KDIR)/vmlinux-$(1).uImage.squashfs \
+   $(4)
+   -rm -f $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp*
+endef
+
+define Image/Build/Netgear/Estimate_uImage
+   $(call Image/Build/Netgear/Build_uImage,$(1)_est,$(2),$(3),$(4))
( \
-   dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k conv=sync; \
+   set -e; \
+   kk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(kernel).*/\1/'`; \
+   rk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(rootfs).*/\1/'`; \
+   let 'tk = kk + rk'; \
+   s=`stat -c'%s' '$(KDIR)/vmlinux-$(1)_est.uImage.squashfs'`; \
+   c=`echo '$(3)' | wc -c`; \
+   let 'kk = (((s + c) / (64 * 1024) + 1) * 64)'; \
+   let 'rk = tk - kk'; \
+   echo '$(3)' | sed -e s/[0-9]*k(kernel)/{kk}k(kernel)/ \
+ -e s/[0-9]*k(rootfs)/{rk}k(rootfs)/  \
+   '$(KDIR)/$(1)_mtdparts'; \
+   let 'k = kk * 1024'; \
+   echo {k}  '$(KDIR)/$(1)_kernel_maxsize'; \
+   let 'r = rk * 1024'; \
+   echo {r}  '$(KDIR)/$(1)_rootfs_maxsize'; \
+   )
+   -rm -f $(KDIR)/vmlinux-$(1)_est \
+  $(KDIR)/vmlinux-$(1)_est.bin.lzma \
+  $(KDIR)/vmlinux-$(1)_est.uImage \
+  $(KDIR)/vmlinux-$(1)_est.uImage.squashfs
+endef
+
+define Image/Build/Netgear
+   $(call Image/Build/Netgear/Estimate_uImage,$(2),$(3),$(4),$(5))
+   $(call Image/Build/Netgear/Build_uImage,$(2),$(3),`cat 
$(KDIR)/$(2)_mtdparts`,$(5))
+   if [ `stat -c%s '$(KDIR)/vmlinux-$(2).uImage.squashfs'` -gt \
+`cat '$(KDIR)/$(2)_kernel_maxsize'` ]; then \
+echo $(KDIR)/vmlinux-$(2).uImage.squashfs is too big  2; \
+   false; \
+   

Re: [OpenWrt-Devel] [PATCH] ar71xx: Reclaim unused space in WNDR3700 image

2011-08-25 Thread Dave Taht
Awesome. However I'd like to somehow make for fully field-upgradable
kernels for this device (how to do that?), and reserving 64k strikes
me as too small to account for future growth.

On Thu, Aug 25, 2011 at 6:20 PM, Mark Mentovai m...@moxienet.com wrote:
 This replaces the fixed flash layout currently used on the WNDR3700
 family with one whose mtd partition sizes are computed dynamically.
 Rather than reserving 1MB for the kernel regardless of its actual space
 requirements, this computes an appropriate size for the kernel, rounded
 up to a 64kB erase block boundary. The space freed up by the kernel is
 available for use by the on-flash rootfs. In current trunk builds, this
 makes an extra 192kB available for user purposes.

 I've been using this patch since February when I first wrote it, and so
 have others. Fixes https://dev.openwrt.org/ticket/8781.

 Signed-off-by: Mark Mentovai m...@moxienet.com

 ---

 Index: target/linux/ar71xx/image/Makefile
 ===
 --- target/linux/ar71xx/image/Makefile  (revision 27926)
 +++ target/linux/ar71xx/image/Makefile  (working copy)
 @@ -42,13 +42,13 @@

  define PatchKernelLzma
        cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
 -       $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip 
 $(2))'
 +       $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) $(strip 
 $(2))
        $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).bin.lzma)
  endef

  define PatchKernelGzip
        cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
 -       $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip 
 $(2))'
 +       $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) $(strip 
 $(2))
        gzip -9 -c $(KDIR)/vmlinux-$(1)  $(KDIR)/vmlinux-$(1).bin.gz
  endef

 @@ -287,29 +287,72 @@
        rm $(KDIR)/image.tmp
  endef

 -define Image/Build/Netgear
 -       $(call MkuImageLzma,$(2),$(3) $($(4)))
 -       mkdir -p $(KDIR)/wndr3700/image
 +define Image/Build/Netgear/Build_uImage
 +       $(call MkuImageLzma,$(1),$(2) $(3))
 +       -rm -rf $(KDIR)/$(1)
 +       mkdir -p $(KDIR)/$(1)/image
        $(STAGING_DIR_HOST)/bin/wndr3700 \
 -               $(KDIR)/vmlinux-$(2).uImage \
 -               $(KDIR)/wndr3700/image/uImage \
 -               $(5)
 +               $(KDIR)/vmlinux-$(1).uImage \
 +               $(KDIR)/$(1)/image/uImage \
 +               $(4)
        $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
 -               $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
 +               $(KDIR)/$(1) $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp \
                -nopad -noappend -root-owned -be
 -       -rm -rf $(KDIR)/wndr3700
 +       -rm -rf $(KDIR)/$(1)
        mkimage -A mips -O linux -T filesystem -C none \
                -a 0xbf07 -e 0xbf07 \
                -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
 -               -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
 -               $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2
 +               -d $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp \
 +               $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp2
        $(STAGING_DIR_HOST)/bin/wndr3700 \
 -               $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \
 -               $(KDIR)/vmlinux-$(2).uImage.squashfs \
 -               $(5)
 -       -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
 +               $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp2 \
 +               $(KDIR)/vmlinux-$(1).uImage.squashfs \
 +               $(4)
 +       -rm -f $(KDIR)/vmlinux-$(1).uImage.squashfs.tmp*
 +endef
 +
 +define Image/Build/Netgear/Estimate_uImage
 +       $(call Image/Build/Netgear/Build_uImage,$(1)_est,$(2),$(3),$(4))
        ( \
 -               dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k 
 conv=sync; \
 +               set -e; \
 +               kk=`echo '$(3)' | sed -e 
 's/.*[:,]\([0-9]*\)k(kernel).*/\1/'`; \
 +               rk=`echo '$(3)' | sed -e 
 's/.*[:,]\([0-9]*\)k(rootfs).*/\1/'`; \
 +               let 'tk = kk + rk'; \
 +               s=`stat -c'%s' '$(KDIR)/vmlinux-$(1)_est.uImage.squashfs'`; \
 +               c=`echo '$(3)' | wc -c`; \
 +               let 'kk = (((s + c) / (64 * 1024) + 1) * 64)'; \
 +               let 'rk = tk - kk'; \
 +               echo '$(3)' | sed -e s/[0-9]*k(kernel)/{kk}k(kernel)/ \
 +                                 -e s/[0-9]*k(rootfs)/{rk}k(rootfs)/  
 \
 +                       '$(KDIR)/$(1)_mtdparts'; \
 +               let 'k = kk * 1024'; \
 +               echo {k}  '$(KDIR)/$(1)_kernel_maxsize'; \
 +               let 'r = rk * 1024'; \
 +               echo {r}  '$(KDIR)/$(1)_rootfs_maxsize'; \
 +       )
 +       -rm -f $(KDIR)/vmlinux-$(1)_est \
 +              $(KDIR)/vmlinux-$(1)_est.bin.lzma \
 +              $(KDIR)/vmlinux-$(1)_est.uImage \
 +              $(KDIR)/vmlinux-$(1)_est.uImage.squashfs
 +endef
 +
 +define Image/Build/Netgear
 +       $(call