-define Image/Build/Template/Compex
- $(call Image/Build/MyLoader,$(1),$(2))
-endef
-
-define Image/Build/Template/Compex/squashfs
- $(call Image/Build/Template/Compex,squashfs,$(1))
-endef
-
-define Image/Build/Template/WRT400N
- $(call Image/Build/WRT400N,$(1),$(2),$(3),$(4))
-endef
-
-define Image/Build/Template/WRT400N/squashfs
- $(call Image/Build/Template/WRT400N,squashfs,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/WRT400N/jffs2-64k
- $(call Image/Build/Template/WRT400N,jffs2-64k,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/CyberTAN
- $(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4))
-endef
-
-define Image/Build/Template/CyberTAN/squashfs
- $(call Image/Build/Template/CyberTAN,squashfs,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/CyberTAN/jffs2-64k
- $(call Image/Build/Template/CyberTAN,jffs2-64k,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/Cameo
- $(call Image/Build/Cameo,$(1),$(2),$(3),$(4))
-endef
-
-define Image/Build/Template/Cameo/squashfs
- $(call Image/Build/Template/Cameo,squashfs,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/AP83
- $(call Image/Build/AP83,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/AP83/squashfs
- $(call Image/Build/Template/AP83,squashfs,$(1),$(2))
-endef
-
-define Image/Build/Template/AP83/jffs2-64k
- $(call Image/Build/Template/AP83,jffs2-64k,$(1),$(2))
-endef
-
-define Image/Build/Template/TPLINK
- $(call Image/Build/TPLINK,$(1),$(2),$(3),$(4))
+wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
+define Image/Build/WNDR3700
+ $(call PatchKernelLzma,$(2),$(3) $(wndr3700_mtdlayout))
+ $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage)
+ mkdir -p $(KDIR)/wndr3700/image
+ $(STAGING_DIR_HOST)/bin/wndr3700 \
+ $(KDIR)/vmlinux-$(2).uImage \
+ $(KDIR)/wndr3700/image/uImage
+ $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
+ $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
+ -nopad -noappend -root-owned -be
+ -rm -rf $(KDIR)/wndr3700
+ mkimage -A mips -O linux -T filesystem -C none \
+ -a 0xbf070000 -e 0xbf070000 \
+ -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
+ -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \
+ $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2
+ $(STAGING_DIR_HOST)/bin/wndr3700 \
+ $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \
+ $(KDIR)/vmlinux-$(2).uImage.squashfs
+ -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
+ ( \
+ dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k conv=sync; \
+ dd if=$(KDIR)/root.$(1) bs=64k; \
+ ) > $(call imgname,$(1),$(2))-sysupgrade.bin
+ $(STAGING_DIR_HOST)/bin/mkdniimg \
+ -B WNDR3700 -v OpenWrt.$(REVISION) \
+ -i $(call imgname,$(1),$(2))-sysupgrade.bin \
+ -o $(call imgname,$(1),$(2))-factory.img