+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 $(KDIR)/wndr3700
+ mkdir $(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=1M 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
+endef
+