build: move mktplinkfw-combined command to image-commands.mk

We will need "mktplinkfw-combined" command also in the "ramips" target
for new MediaTek based TP-Link devices, with "safeloader" image type.

Also, rename the command to "tplink-v1-header", use "VERSION_DIST"
variable instead of "OpenWrt" and allow passing additional parameters.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
Piotr Dymacz 2017-07-06 18:10:22 +02:00
parent b3cb0e7588
commit f08f754993
2 changed files with 13 additions and 18 deletions

View file

@ -233,6 +233,15 @@ define Build/sysupgrade-tar
$@
endef
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 -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) -k $@ -o $@.new

View file

@ -35,20 +35,6 @@ define Build/mktplinkfw
$(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
endef
# mktplinkfw-combined
#
# -c combined image
define Build/mktplinkfw-combined
$(STAGING_DIR_HOST)/bin/mktplinkfw \
-H $(TPLINK_HWID) -W $(TPLINK_HWREV) -N OpenWrt -V $(REVISION) $(1) \
-L $(KERNEL_LOADADDR) -m $(TPLINK_HEADER_VERSION) \
-E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-k $@ \
-o $@.new \
-c
@mv $@.new $@
endef
# add RE450 and similar header to the kernel image
define Build/mktplinkfw-kernel
$(STAGING_DIR_HOST)/bin/mktplinkfw-kernel \
@ -73,7 +59,7 @@ define Device/tplink
TPLINK_HEADER_VERSION := 1
LOADER_TYPE := gz
KERNEL := kernel-bin | patch-cmdline | lzma
KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-combined
KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | tplink-v1-header
IMAGES := sysupgrade.bin factory.bin
IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
IMAGE/factory.bin := append-rootfs | mktplinkfw factory
@ -85,7 +71,7 @@ define Device/tplink-nolzma
COMPILE := loader-$(1).gz
COMPILE/loader-$(1).gz := loader-okli-compile
KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1)
KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel-cmdline | mktplinkfw-combined
KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel-cmdline | tplink-v1-header
endef
define Device/tplink-4m
@ -643,7 +629,7 @@ define Device/tl-wdr6500-v2
DEVICE_TITLE := TP-LINK TL-WDR6500 v2
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x
KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | mktplinkfw-combined
KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | tplink-v1-header
BOARDNAME := TL-WDR6500-v2
DEVICE_PROFILE := TLWDR6500V2
TPLINK_HWID := 0x65000002
@ -710,7 +696,7 @@ define Device/tl-wr1043nd-v4
MTDPARTS := spi0.0:128k(u-boot)ro,1536k(kernel),14016k(rootfs),128k(product-info)ro,320k(config)ro,64k(partition-table)ro,128k(logs)ro,64k(ART)ro,15552k@0x20000(firmware)
IMAGE_SIZE := 15552k
TPLINK_BOARD_ID := TLWR1043NDV4
KERNEL := kernel-bin | patch-cmdline | lzma | mktplinkfw-combined
KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header
IMAGES := sysupgrade.bin factory.bin
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory