From: Piotr Dymacz Date: Fri, 23 Jun 2017 21:07:10 +0000 (+0200) Subject: build: move mktplinkfw2 related commands to image-commands.mk X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b7f59225118a3553af5e9d485e2445f28444fb9;p=librecmc%2Flibrecmc.git build: move mktplinkfw2 related commands to image-commands.mk There are already two targets (lantiq, ramips) which use mktplinkfw2 tool for creating images. This de-duplicates code, introduces two new build commands: tplink-v2-header, tplink-v2-image and makes use of them in place of old, (sub)target specific ones. Signed-off-by: Piotr Dymacz --- diff --git a/include/image-commands.mk b/include/image-commands.mk index 718ffe82c3..ce84e3f11c 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -233,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))")))) diff --git a/target/linux/lantiq/image/tp-link.mk b/target/linux/lantiq/image/tp-link.mk index 49c4bc10e1..976184175a 100644 --- a/target/linux/lantiq/image/tp-link.mk +++ b/target/linux/lantiq/image/tp-link.mk @@ -1,27 +1,18 @@ -define Build/tplink-fw - mktplinkfw2 -c -B $(BOARD_ID) -s \ - -k $@ -o $@.new - mv $@.new $@ -endef - -define Build/mktplinkfw2 - mktplinkfw2 -B $(BOARD_ID) -s -a 0x4 -j \ - -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) \ - -o $@ -endef -DEVICE_VARS += BOARD_ID +DEVICE_VARS += TPLINK_BOARD_ID define Device/lantiqTpLink KERNEL := kernel-bin | append-dtb | lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-fw + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | \ + tplink-v2-header -s -V "ver. 1.0" IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin := mktplinkfw2 | append-metadata | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := tplink-v2-image -s -V "ver. 1.0" | \ + append-metadata | check-size $$$$(IMAGE_SIZE) endef define Device/TDW8970 $(Device/lantiqTpLink) DEVICE_PROFILE := TDW8970 - BOARD_ID := TD-W8970v1 + TPLINK_BOARD_ID := TD-W8970v1 IMAGE_SIZE := 7680k DEVICE_TITLE := TP-LINK TD-W8970 DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport @@ -30,7 +21,7 @@ endef define Device/TDW8980 $(Device/lantiqTpLink) DEVICE_PROFILE := TDW8980 - BOARD_ID := TD-W8980v1 + TPLINK_BOARD_ID := TD-W8980v1 IMAGE_SIZE := 7680k DEVICE_TITLE := TP-LINK TD-W8980 DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport @@ -39,7 +30,7 @@ endef define Device/VR200v $(Device/lantiqTpLink) DEVICE_PROFILE := VR200v - BOARD_ID := ArcherVR200V + TPLINK_BOARD_ID := ArcherVR200V IMAGE_SIZE := 15808k DEVICE_TITLE := TP-LINK Archer VR200v DEVICE_PACKAGES:= kmod-usb-dwc2 kmod-usb-ledtrig-usbport diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index e0f563e1b0..fd9f10a246 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -2,10 +2,7 @@ # MT7620A Profiles # -define Build/tplink-header - $(STAGING_DIR_HOST)/bin/mktplinkfw2 -a 0x4 -V "ver. 2.0" -B $(1) \ - -o $@.new -k $@ -r $(IMAGE_ROOTFS) && mv $@.new $@ -endef +DEVICE_VARS += TPLINK_BOARD_ID define Build/elecom-header cp $@ $(KDIR)/v_0.0.0.bin @@ -31,10 +28,11 @@ TARGET_DEVICES += ai-br100 define Device/ArcherC20i DTS := ArcherC20i SUPPORTED_DEVICES := c20i + TPLINK_BOARD_ID := ArcherC20i KERNEL := $(KERNEL_DTB) - KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherC20i -c - IMAGE/factory.bin := append-kernel | tplink-header ArcherC20i -j - IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherC20i -j -s | append-metadata + KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header + IMAGE/factory.bin := tplink-v2-image + IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata IMAGES += factory.bin DEVICE_TITLE := TP-Link ArcherC20i endef @@ -43,10 +41,11 @@ TARGET_DEVICES += ArcherC20i define Device/ArcherC50 DTS := ArcherC50 SUPPORTED_DEVICES := c50 + TPLINK_BOARD_ID := ArcherC50 KERNEL := $(KERNEL_DTB) - KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherC50 -c - IMAGE/factory.bin := append-kernel | tplink-header ArcherC50 -j - IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherC50 -j -s | append-metadata + KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header + IMAGE/factory.bin := tplink-v2-image + IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata IMAGES += factory.bin DEVICE_TITLE := TP-Link ArcherC50 endef @@ -55,9 +54,10 @@ TARGET_DEVICES += ArcherC50 define Device/ArcherMR200 DTS := ArcherMR200 SUPPORTED_DEVICES := mr200 + TPLINK_BOARD_ID := ArcherMR200 KERNEL := $(KERNEL_DTB) - KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherMR200 -c - IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherMR200 -j -s | append-metadata + KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header + IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-rndis kmod-usb-serial kmod-usb-serial-option adb-enablemodem DEVICE_TITLE := TP-Link ArcherMR200 endef