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 <pepe2k@gmail.com>
master
Piotr Dymacz 8 years ago
parent 7d6c63d875
commit 5b7f592251
  1. 14
      include/image-commands.mk
  2. 25
      target/linux/lantiq/image/tp-link.mk
  3. 24
      target/linux/ramips/image/mt7620.mk

@ -233,6 +233,20 @@ define Build/sysupgrade-tar
$@ $@
endef 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))) json_quote=$(subst ','\'',$(subst ",\",$(1)))
#")') #")')
metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))"))))

@ -1,27 +1,18 @@
define Build/tplink-fw DEVICE_VARS += TPLINK_BOARD_ID
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
define Device/lantiqTpLink define Device/lantiqTpLink
KERNEL := kernel-bin | append-dtb | lzma 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 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 endef
define Device/TDW8970 define Device/TDW8970
$(Device/lantiqTpLink) $(Device/lantiqTpLink)
DEVICE_PROFILE := TDW8970 DEVICE_PROFILE := TDW8970
BOARD_ID := TD-W8970v1 TPLINK_BOARD_ID := TD-W8970v1
IMAGE_SIZE := 7680k IMAGE_SIZE := 7680k
DEVICE_TITLE := TP-LINK TD-W8970 DEVICE_TITLE := TP-LINK TD-W8970
DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
@ -30,7 +21,7 @@ endef
define Device/TDW8980 define Device/TDW8980
$(Device/lantiqTpLink) $(Device/lantiqTpLink)
DEVICE_PROFILE := TDW8980 DEVICE_PROFILE := TDW8980
BOARD_ID := TD-W8980v1 TPLINK_BOARD_ID := TD-W8980v1
IMAGE_SIZE := 7680k IMAGE_SIZE := 7680k
DEVICE_TITLE := TP-LINK TD-W8980 DEVICE_TITLE := TP-LINK TD-W8980
DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
@ -39,7 +30,7 @@ endef
define Device/VR200v define Device/VR200v
$(Device/lantiqTpLink) $(Device/lantiqTpLink)
DEVICE_PROFILE := VR200v DEVICE_PROFILE := VR200v
BOARD_ID := ArcherVR200V TPLINK_BOARD_ID := ArcherVR200V
IMAGE_SIZE := 15808k IMAGE_SIZE := 15808k
DEVICE_TITLE := TP-LINK Archer VR200v DEVICE_TITLE := TP-LINK Archer VR200v
DEVICE_PACKAGES:= kmod-usb-dwc2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES:= kmod-usb-dwc2 kmod-usb-ledtrig-usbport

@ -2,10 +2,7 @@
# MT7620A Profiles # MT7620A Profiles
# #
define Build/tplink-header DEVICE_VARS += TPLINK_BOARD_ID
$(STAGING_DIR_HOST)/bin/mktplinkfw2 -a 0x4 -V "ver. 2.0" -B $(1) \
-o $@.new -k $@ -r $(IMAGE_ROOTFS) && mv $@.new $@
endef
define Build/elecom-header define Build/elecom-header
cp $@ $(KDIR)/v_0.0.0.bin cp $@ $(KDIR)/v_0.0.0.bin
@ -31,10 +28,11 @@ TARGET_DEVICES += ai-br100
define Device/ArcherC20i define Device/ArcherC20i
DTS := ArcherC20i DTS := ArcherC20i
SUPPORTED_DEVICES := c20i SUPPORTED_DEVICES := c20i
TPLINK_BOARD_ID := ArcherC20i
KERNEL := $(KERNEL_DTB) KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherC20i -c KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
IMAGE/factory.bin := append-kernel | tplink-header ArcherC20i -j IMAGE/factory.bin := tplink-v2-image
IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherC20i -j -s | append-metadata IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
IMAGES += factory.bin IMAGES += factory.bin
DEVICE_TITLE := TP-Link ArcherC20i DEVICE_TITLE := TP-Link ArcherC20i
endef endef
@ -43,10 +41,11 @@ TARGET_DEVICES += ArcherC20i
define Device/ArcherC50 define Device/ArcherC50
DTS := ArcherC50 DTS := ArcherC50
SUPPORTED_DEVICES := c50 SUPPORTED_DEVICES := c50
TPLINK_BOARD_ID := ArcherC50
KERNEL := $(KERNEL_DTB) KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherC50 -c KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
IMAGE/factory.bin := append-kernel | tplink-header ArcherC50 -j IMAGE/factory.bin := tplink-v2-image
IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherC50 -j -s | append-metadata IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
IMAGES += factory.bin IMAGES += factory.bin
DEVICE_TITLE := TP-Link ArcherC50 DEVICE_TITLE := TP-Link ArcherC50
endef endef
@ -55,9 +54,10 @@ TARGET_DEVICES += ArcherC50
define Device/ArcherMR200 define Device/ArcherMR200
DTS := ArcherMR200 DTS := ArcherMR200
SUPPORTED_DEVICES := mr200 SUPPORTED_DEVICES := mr200
TPLINK_BOARD_ID := ArcherMR200
KERNEL := $(KERNEL_DTB) KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherMR200 -c KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherMR200 -j -s | append-metadata 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_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-rndis kmod-usb-serial kmod-usb-serial-option adb-enablemodem
DEVICE_TITLE := TP-Link ArcherMR200 DEVICE_TITLE := TP-Link ArcherMR200
endef endef

Loading…
Cancel
Save