image: fix ar71xx legacy images
[openwrt/openwrt.git] / include / image-commands.mk
index 093b93d0e96b0729babb7c117adb701c36966a6a..ce84e3f11cf48d4384eb063f0597404d8f1eba12 100644 (file)
@@ -67,6 +67,16 @@ define Build/netgear-dni
        mv $@.new $@
 endef
 
+define Build/append-squashfs-fakeroot-be
+       rm -rf $@.fakefs $@.fakesquashfs
+       mkdir $@.fakefs
+       $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
+               $@.fakefs $@.fakesquashfs \
+               -noappend -root-owned -be -nopad -b 65536 \
+               $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
+       cat $@.fakesquashfs >> $@
+endef
+
 # append a fake/empty rootfs uImage header, to fool the bootloaders
 # rootfs integrity check
 define Build/append-uImage-fakeroot-hdr
@@ -81,7 +91,7 @@ endef
 
 define Build/tplink-safeloader
        -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
-               -B $(TPLINK_BOARD_NAME) \
+               -B $(TPLINK_BOARD_ID) \
                -V $(REVISION) \
                -k $(IMAGE_KERNEL) \
                -r $@ \
@@ -223,6 +233,20 @@ define Build/sysupgrade-tar
                $@
 endef
 
+define Build/tplink-v2-header
+       $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
+               -c -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) -k $@ -o $@.new
+       @mv $@.new $@
+endef
+
+define Build/tplink-v2-image
+       $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
+               -a 0x4 -j -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) \
+               -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new
+       cat $@.new >> $@
+       rm -rf $@.new
+endef
+
 json_quote=$(subst ','\'',$(subst ",\",$(1)))
 #")')
 metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))"))))