-define Image/Build/ZyXEL
- $(call PatchKernelLzma,$(2),$(3))
- if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
- echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
- else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2752512 ]; then \
- echo "Warning: $(KDIR)/root.$(1) is too big"; \
+define Image/Build/Netgear/Estimate_uImage
+ $(call Image/Build/Netgear/Build_uImage,$(1)_est,$(2),$(3),$(4))
+ ( \
+ 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; \
+ else if [ `stat -c%s '$(KDIR)/root.$(1)'` -gt \
+ `cat '$(KDIR)/$(2)_rootfs_maxsize'` ]; then \
+ echo "$(KDIR)/root.$(1) is too big" >& 2; \