+define Build/tplink-v1-header
+ $(STAGING_DIR_HOST)/bin/mktplinkfw \
+ -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
+ -E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+ -m $(TPLINK_HEADER_VERSION) -N "$(VERSION_DIST)" -V $(REVISION) \
+ -k $@ -o $@.new $(1)
+ @mv $@.new $@
+endef
+
+define Build/tplink-v2-header
+ $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
+ -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
+ -E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+ -w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
+ -T $(TPLINK_HVERSION) -V "ver. 2.0" \
+ -k $@ -o $@.new $(1)
+ @mv $@.new $@
+endef
+
+define Build/tplink-v2-image
+ $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
+ -H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
+ -w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
+ -T $(TPLINK_HVERSION) -V "ver. 2.0" -a 0x4 -j \
+ -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new $(1)
+ cat $@.new >> $@
+ rm -rf $@.new
+endef
+