bcm53xx: add support for TP-LINK Archer C5 V2
[lede.git] / target / linux / bcm53xx / image / Makefile
1 #
2 # Copyright (C) 2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 define Image/Prepare
11         rm -f $(KDIR)/fs_mark
12         echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
13         $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
14
15         # For UBI we want only one extra block
16         rm -f $(KDIR)/ubi_mark
17         echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
18 endef
19
20 define Build/lzma-d16
21         $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) $@.new
22         mv $@.new $@
23 endef
24
25 # Similar to Build/tplink-safeloader but uses TRX instead of clean kernel
26 define Build/bcm53xx-tplink-safeloader
27         $(STAGING_DIR_HOST)/bin/trx \
28                 -o $@.trx \
29                 -m 33554432 \
30                 -f $(IMAGE_KERNEL) -a 1024
31         $(STAGING_DIR_HOST)/bin/tplink-safeloader \
32                 -B $(TPLINK_BOARD) \
33                 -k $@.trx \
34                 -r $@ \
35                 -j \
36                 -o $@.new
37         mv $@.new $@
38         rm $@.trx
39 endef
40
41 define Build/trx-serial
42         $(STAGING_DIR_HOST)/bin/trx \
43                 -o $@.new \
44                 -m 33554432 \
45                 -f $(IMAGE_KERNEL) -a 1024 \
46                 -f $@ -a 0x10000 -A $(KDIR)/fs_mark
47         mv $@.new $@
48 endef
49
50 define Build/trx-nand
51         # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
52         #         if it grows up between releases
53         # root: UBI with one extra block containing UBI mark to trigger erasing
54         #       rest of partition
55         $(STAGING_DIR_HOST)/bin/trx \
56                 -o $@.new \
57                 -m 33554432 \
58                 -f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \
59                 -f $@ \
60                 -A $(KDIR)/ubi_mark -a 0x20000
61         mv $@.new $@
62 endef
63
64 define Build/asus-trx
65         $(STAGING_DIR_HOST)/bin/asustrx \
66                 -p $(PRODUCTID) -i $@ -o $@.new
67         mv $@.new $@
68 endef
69
70 define Build/seama-nand
71         # Seama entity
72         $(STAGING_DIR_HOST)/bin/oseama \
73                 entity $@.entity \
74                 -m "dev=/dev/mtdblock/7" \
75                 -m "type=firmware" \
76                 -f $(IMAGE_KERNEL) \
77                 -b 0x400000 \
78                 -f $@ \
79                 -f $(KDIR)/ubi_mark
80         # Seama container
81         $(STAGING_DIR_HOST)/bin/seama \
82                 -s $@ \
83                 -m "signature=$(SIGNATURE)" \
84                 -i $@.entity
85 endef
86
87 DEVICE_VARS += PRODUCTID SIGNATURE NETGEAR_BOARD_ID NETGEAR_REGION TPLINK_BOARD
88
89 BRCMFMAC_43602A1 := kmod-brcmfmac brcmfmac-firmware-43602a1-pcie
90 BRCMFMAC_4366B1 := kmod-brcmfmac brcmfmac-firmware-4366b1-pcie
91 BRCMFMAC_4366C0 := kmod-brcmfmac
92 USB2_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-phy-bcm-ns-usb2
93 USB2_PACKAGES += kmod-usb-ledtrig-usbport
94 USB3_PACKAGES := $(USB2_PACKAGES) kmod-usb3 kmod-phy-bcm-ns-usb3
95
96 define Device/Default
97   # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
98   # extract the full dtb name based on the device info
99   DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
100   KERNEL := kernel-bin | append-dtb | lzma-d16
101   KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
102   FILESYSTEMS := squashfs
103   KERNEL_NAME := zImage
104   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
105   IMAGES := trx
106   BLOCKSIZE := 128k
107   PAGESIZE := 2048
108   IMAGE/trx := append-ubi | trx-nand
109 endef
110
111 define Device/asus
112   IMAGES := trx
113   IMAGE/trx := append-ubi | trx-nand | asus-trx
114 endef
115
116 define Device/asus-rt-ac56u
117   DEVICE_TITLE := Asus RT-AC56U
118   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
119 endef
120 TARGET_DEVICES += asus-rt-ac56u
121
122 define Device/asus-rt-ac68u
123   DEVICE_TITLE := Asus RT-AC68U
124   DEVICE_PACKAGES := $(USB3_PACKAGES)
125 endef
126 TARGET_DEVICES += asus-rt-ac68u
127
128 define Device/asus-rt-ac87u
129   DEVICE_TITLE := Asus RT-AC87U
130   DEVICE_PACKAGES := $(USB3_PACKAGES)
131 endef
132 TARGET_DEVICES += asus-rt-ac87u
133
134 define Device/asus-rt-n18u
135   DEVICE_TITLE := Asus RT-N18U
136   DEVICE_PACKAGES := $(USB3_PACKAGES)
137 endef
138 TARGET_DEVICES += asus-rt-n18u
139
140 define Device/buffalo-wxr-1900dhp
141   DEVICE_TITLE := Buffalo WXR-1900DHP
142   DEVICE_PACKAGES := $(USB3_PACKAGES)
143 endef
144 TARGET_DEVICES += buffalo-wxr-1900dhp
145
146 define Device/buffalo-wzr-600dhp2
147   DEVICE_TITLE := Buffalo WZR-600DHP2
148   DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
149 endef
150 TARGET_DEVICES += buffalo-wzr-600dhp2
151
152 define Device/buffalo-wzr-900dhp
153   DEVICE_TITLE := Buffalo WZR-900DHP
154   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
155 endef
156 TARGET_DEVICES += buffalo-wzr-900dhp
157
158 define Device/buffalo-wzr-1750dhp
159   DEVICE_TITLE := Buffalo WZR-1750DHP
160   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
161 endef
162 TARGET_DEVICES += buffalo-wzr-1750dhp
163
164 define Device/dlink
165   IMAGES := bin
166   IMAGE/bin := append-ubi | seama-nand
167 endef
168
169 define Device/dlink-dir-885l
170   DEVICE_TITLE := D-Link DIR-885L
171   DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
172   $(Device/dlink)
173   SIGNATURE := wrgac42_dlink.2015_dir885l
174 endef
175 TARGET_DEVICES += dlink-dir-885l
176
177 # Linksys devices are disabled due to problem with 2 TRX partitions
178
179 define Device/linksys-ea6300-v1
180   DEVICE_TITLE := Linksys EA6300 V1
181   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
182 endef
183 # TARGET_DEVICES += linksys-ea6300-v1
184
185 define Device/linksys-ea9200
186   DEVICE_TITLE := Linksys EA9200 V1
187   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
188 endef
189 # TARGET_DEVICES += linksys-ea9200
190
191 define Device/linksys-ea9500
192   DEVICE_TITLE := Linksys EA9500
193   DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
194   DEVICE_DTS := bcm47094-linksys-panamera
195 endef
196 # TARGET_DEVICES += linksys-ea9500
197
198 define Device/netgear
199   IMAGES := chk
200   IMAGE/chk := append-ubi | trx-nand | netgear-chk
201   NETGEAR_REGION := 1
202 endef
203
204 define Device/netgear-r6250
205   DEVICE_TITLE := Netgear R6250
206   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
207   $(Device/netgear)
208   NETGEAR_BOARD_ID := U12H245T00_NETGEAR
209 endef
210 TARGET_DEVICES += netgear-r6250
211
212 define Device/netgear-r6300-v2
213   DEVICE_TITLE := Netgear R6300 V2
214   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
215   $(Device/netgear)
216   NETGEAR_BOARD_ID := U12H240T00_NETGEAR
217 endef
218 TARGET_DEVICES += netgear-r6300-v2
219
220 define Device/netgear-r7000
221   DEVICE_TITLE := Netgear R7000
222   DEVICE_PACKAGES := $(USB3_PACKAGES)
223   $(Device/netgear)
224   NETGEAR_BOARD_ID := U12H270T00_NETGEAR
225 endef
226 TARGET_DEVICES += netgear-r7000
227
228 define Device/netgear-r7900
229   DEVICE_TITLE := Netgear R7900
230   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
231   $(Device/netgear)
232   NETGEAR_BOARD_ID := U12H315T30_NETGEAR
233 endef
234 TARGET_DEVICES += netgear-r7900
235
236 define Device/netgear-r8000
237   DEVICE_TITLE := Netgear R8000
238   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
239   $(Device/netgear)
240   NETGEAR_BOARD_ID := U12H315T00_NETGEAR
241 endef
242 TARGET_DEVICES += netgear-r8000
243
244 define Device/netgear-r8500
245   DEVICE_TITLE := Netgear R8500
246   DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
247   $(Device/netgear)
248   NETGEAR_BOARD_ID := U12H334T00_NETGEAR
249 endef
250 # TARGET_DEVICES += netgear-r8500
251
252 define Device/smartrg-sr400ac
253   DEVICE_TITLE := SmartRG SR400ac
254   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
255   IMAGES := trx
256   IMAGE/trx := append-rootfs | trx-serial
257 endef
258 TARGET_DEVICES += smartrg-sr400ac
259
260 define Device/tenda-ac9
261   DEVICE_TITLE := Tenda AC9
262   DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
263   IMAGES := trx
264   IMAGE/trx := append-rootfs | trx-serial
265 endef
266 TARGET_DEVICES += tenda-ac9
267
268 define Device/tplink-archer-c5-v2
269   DEVICE_TITLE := TP-LINK Archer C5 V2
270   DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
271   IMAGES := bin
272   IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
273   TPLINK_BOARD := ARCHER-C5-V2
274 endef
275 TARGET_DEVICES += tplink-archer-c5-v2
276
277 define Device/tplink-archer-c9-v1
278   DEVICE_TITLE := TP-LINK Archer C9 V1
279   DEVICE_PACKAGES := $(USB3_PACKAGES)
280   IMAGES := bin
281   IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
282   TPLINK_BOARD := ARCHERC9
283 endef
284 TARGET_DEVICES += tplink-archer-c9-v1
285
286 $(eval $(call BuildImage))