+ -i $(call sysupname,$(1),$(2)) \
+ -o $(call factoryname,$(1),$(2)); \
+ fi
+endef
+
+alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
+define Image/Build/ALFA
+ $(call MkuImageLzma,$(2),$(3))
+ $(call Sysupgrade/RK,$(1),$(2),$(4),$(5))
+ if [ -e "$(call sysupname,$(1),$(2))" ]; then \
+ rm -rf $(KDIR)/$(1); \
+ mkdir -p $(KDIR)/$(1); \
+ cd $(KDIR)/$(1); \
+ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/$(1)/$(6); \
+ cp $(KDIR)/root.$(1) $(KDIR)/$(1)/$(7); \
+ $(TAR) zcf $(call factoryname,$(1),$(2)) -C $(KDIR)/$(1) $(6) $(7); \
+ ( \
+ echo WRM7222C | dd bs=32 count=1 conv=sync; \
+ echo -ne '\xfe'; \
+ ) >> $(call factoryname,$(1),$(2)); \
+ fi
+endef
+
+define Image/Build/TPLINKOLD/loader
+ $(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
+endef
+
+define Image/Build/TPLINKOLD
+ $(call MkuImageOKLI,$(2))
+ ( \
+ dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
+ dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
+ ) > $(KDIR_TMP)/kernel-$(2).bin
+ -$(STAGING_DIR_HOST)/bin/mktplinkfw \
+ -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
+ -k $(KDIR_TMP)/kernel-$(2).bin \
+ -r $(KDIR)/root.$(1) \
+ -o $(call factoryname,$(1),$(2))
+ -$(STAGING_DIR_HOST)/bin/mktplinkfw \
+ -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
+ -k $(KDIR_TMP)/kernel-$(2).bin \
+ -r $(KDIR)/root.$(1) \
+ -o $(call sysupname,$(1),$(2))
+endef
+
+define Image/Build/TPLINKOLD/initramfs
+ $(call Image/BuildLoader,$(2),gz,$(3),0x80060000)
+ -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
+ -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
+ -k $(KDIR)/loader-$(2).gz \
+ -o $(call imgname,$(1),$(2))-uImage.bin
+endef
+
+define Image/Build/TPLINK/loader
+ $(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)