1 DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_BOARD_NAME TPLINK_BOARD_ID
4 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
7 # combine kernel and rootfs into one image
8 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
9 # <type> is "sysupgrade" or "factory"
11 # -a align the rootfs start on an <align> bytes boundary
12 # -j add jffs2 end-of-filesystem markers
13 # -s strip padding from end of the image
14 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
15 define Build/mktplinkfw
16 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
17 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
18 -m $(TPLINK_HEADER_VERSION) \
23 -a $(call rootfs_align,$(FILESYSTEM)) \
24 $(wordlist 2,$(words $(1)),$(1)) \
25 $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
31 define Build/mktplinkfw-combined
32 $(STAGING_DIR_HOST)/bin/mktplinkfw \
33 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $(1) \
34 -m $(TPLINK_HEADER_VERSION) \
42 define Build/uImageArcher
43 mkimage -A $(LINUX_KARCH) \
45 -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
46 -n '$(call toupper,$(LINUX_KARCH)) OpenWrt Linux-$(LINUX_VERSION)' -d $@ $@.new
52 TPLINK_HEADER_VERSION := 1
54 KERNEL := kernel-bin | append-dtb | lzma
55 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header
57 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade | append-metadata
58 IMAGE/factory.bin := append-rootfs | mktplinkfw factory
61 define Device/tplink-nolzma
63 LOADER_FLASH_OFFS := 0x22000
64 COMPILE := loader-$(1).gz
65 COMPILE/loader-$(1).gz := loader-okli-compile
66 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 7680
67 KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | tplink-v1-header
70 define Device/tplink-4m
71 $(Device/tplink-nolzma)
72 TPLINK_FLASHLAYOUT := 4M
76 define Device/tplink-4mlzma
78 TPLINK_FLASHLAYOUT := 4Mlzma
82 define Device/tplink-8m
83 $(Device/tplink-nolzma)
84 TPLINK_FLASHLAYOUT := 8M
88 define Device/tplink-8mlzma
90 TPLINK_FLASHLAYOUT := 8Mlzma
94 define Device/tplink-16mlzma
96 TPLINK_FLASHLAYOUT := 16Mlzma
100 define Device/tplink-safeloader
102 KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
103 IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
104 append-metadata | check-size $$$$(IMAGE_SIZE)
105 IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
108 define Device/tplink-safeloader-uimage
109 $(Device/tplink-safeloader)
110 KERNEL := kernel-bin | append-dtb | lzma | uImageArcher lzma