2 # This is free software, licensed under the GNU General Public License v2.
3 # See /LICENSE for more information.
5 include $(TOPDIR)/rules.mk
6 include $(INCLUDE_DIR)/image.mk
8 DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT
11 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
14 define Build/copy-file
18 # combine kernel and rootfs into one image
19 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
20 # <type> is "sysupgrade" or "factory"
22 # -a align the rootfs start on an <align> bytes boundary
23 # -j add jffs2 end-of-filesystem markers
24 # -s strip padding from end of the image
25 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
26 define Build/mktplinkfw
27 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
28 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
33 -a $(call rootfs_align,$(FILESYSTEM)) \
34 $(wordlist 2,$(words $(1)),$(1)) \
35 $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
41 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
42 KERNEL_ENTRY := 0x00000000
43 KERNEL_LOADADDR := 0x00000000
47 ifeq ($(SUBTARGET),generic)
49 define Device/tl-wdr4900-v1
50 DEVICE_TITLE := TP-Link TL-WDR4900
51 TPLINK_HWID := 0x49000001
53 TPLINK_FLASHLAYOUT := 16Mppc
54 KERNEL_NAME := cuImage.tl-wdr4900-v1
56 SUPPORTED_DEVICES:=tl-wdr4900-v1 tplink,tl-wdr4900-v1
57 IMAGES := fdt.bin factory.bin sysupgrade.bin
58 IMAGE/fdt.bin := append-dtb
59 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade | append-metadata
60 IMAGE/factory.bin := append-rootfs | mktplinkfw factory
62 TARGET_DEVICES += tl-wdr4900-v1
64 define Device/red-15w-rev1
65 DEVICE_TITLE := Sophos RED 15w Rev.1
66 # Original firmware uses a dedicated DTB-partition.
67 # The bootloader however supports FIT-images.
68 KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
69 SUPPORTED_DEVICES := sophos,red-15w-rev1
70 IMAGES := sysupgrade.bin
71 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
73 TARGET_DEVICES += red-15w-rev1
77 ifeq ($(SUBTARGET),p1020)
79 define Device/hiveap-330
80 DEVICE_TITLE := Aerohive HiveAP-330
81 DEVICE_PACKAGES := kmod-tpm-i2c-atmel
85 KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs | uImage none
86 SUPPORTED_DEVICES := aerohive,hiveap-330
87 IMAGES := fdt.bin sysupgrade.bin
88 IMAGE/fdt.bin := append-dtb
89 IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | check-size 256k | \
90 append-uImage-fakehdr ramdisk | pad-to 256k | check-size 512k | \
91 append-rootfs | pad-rootfs $$(BLOCKSIZE) | pad-to 41216k | check-size 41216k | \
92 append-kernel | append-metadata
94 TARGET_DEVICES += hiveap-330
97 DEVICE_TITLE := OCEDO Panda
98 DEVICE_PACKAGES := kmod-rtc-ds1307 uboot-envtools
99 KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
103 SUPPORTED_DEVICES := ocedo,panda
104 IMAGES := fdt.bin sysupgrade.bin
105 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
106 IMAGE/fdt.bin := append-dtb
108 TARGET_DEVICES += panda
112 ifeq ($(SUBTARGET),p2020)
114 define Device/p2020rdb
115 DEVICE_TITLE := Freescale P2020RDB
116 DEVICE_DTS_DIR := $(DTS_DIR)/fsl
117 DEVICE_PACKAGES := kmod-hwmon-core kmod-hwmon-lm90 kmod-rtc-ds1307 \
118 kmod-gpio-pca953x kmod-eeprom-at24
120 KERNEL := kernel-bin | gzip | \
121 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
122 SUPPORTED_DEVICES := fsl,P2020RDB
123 IMAGES := sysupgrade.bin
124 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \
125 pad-rootfs $$(BLOCKSIZE) | append-metadata
127 TARGET_DEVICES += p2020rdb
131 $(eval $(call BuildImage))