bcm53xx: add v5.4 support
[openwrt/openwrt.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/buffalo-wzr-header
42 $(eval product=$(word 1,$(1)))
43 $(eval region=$(word 2,$(1)))
44 ( \
45 echo $(product)_$(BUFFALO_TAG_VERSION)_$(BUFFALO_TAG_MINOR)_$(region)_$(BUFFALO_TAG_PLATFORM); \
46 echo filelen=$$(stat -c%s $@); \
47 cat $@ \
48 ) > $@.new
49 mv $@.new $@
50 endef
51
52 # TRX with only one (kernel) partition
53 define Build/trx
54 $(STAGING_DIR_HOST)/bin/trx \
55 -o $@.new \
56 -m 33554432 \
57 -f $@
58 mv $@.new $@
59 endef
60
61 define Build/trx-serial
62 $(STAGING_DIR_HOST)/bin/otrx create $@.new \
63 -f $(IMAGE_KERNEL) -a 1024 \
64 -f $@ -a 0x10000 -A $(KDIR)/fs_mark
65 mv $@.new $@
66 endef
67
68 define Build/trx-nand
69 # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
70 # if it grows up between releases
71 # root: UBI with one extra block containing UBI mark to trigger erasing
72 # rest of partition
73 $(STAGING_DIR_HOST)/bin/otrx create $@.new \
74 -f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \
75 -f $@ \
76 -A $(KDIR)/ubi_mark -a 0x20000
77 mv $@.new $@
78 endef
79
80 define Build/asus-trx
81 $(STAGING_DIR_HOST)/bin/asustrx \
82 -p $(PRODUCTID) -i $@ -o $@.new
83 mv $@.new $@
84 endef
85
86 define Build/luxul-lxl
87 $(STAGING_DIR_HOST)/bin/lxlfw create $@.new \
88 -i $@ \
89 -b $(LUXUL_BOARD)
90 mv $@.new $@
91 endef
92
93 define Build/seama-nand
94 # Seama entity
95 $(STAGING_DIR_HOST)/bin/oseama \
96 entity $@.entity \
97 -m "dev=/dev/mtdblock/7" \
98 -m "type=firmware" \
99 -f $(IMAGE_KERNEL) \
100 -b 0x400000 \
101 -f $@ \
102 -f $(KDIR)/ubi_mark
103 # Seama container
104 $(STAGING_DIR_HOST)/bin/seama \
105 -s $@ \
106 -m "signature=$(SIGNATURE)" \
107 -i $@.entity
108 endef
109
110 DEVICE_VARS += PRODUCTID SIGNATURE NETGEAR_BOARD_ID NETGEAR_REGION TPLINK_BOARD
111 DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
112 DEVICE_VARS += LUXUL_BOARD
113
114 IEEE8021X := wpad-basic
115 B43 := $(IEEE8021X) kmod-b43
116 BRCMFMAC_43602A1 := $(IEEE8021X) kmod-brcmfmac brcmfmac-firmware-43602a1-pcie
117 BRCMFMAC_4366B1 := $(IEEE8021X) kmod-brcmfmac brcmfmac-firmware-4366b1-pcie
118 BRCMFMAC_4366C0 := $(IEEE8021X) kmod-brcmfmac brcmfmac-firmware-4366c0-pcie
119 USB2_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-phy-bcm-ns-usb2
120 USB2_PACKAGES += kmod-usb-ledtrig-usbport
121 USB3_PACKAGES := $(USB2_PACKAGES) kmod-usb3 kmod-phy-bcm-ns-usb3
122
123 define Device/Default
124 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
125 # extract the full dtb name based on the device info
126 DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
127 KERNEL := kernel-bin | append-dtb | lzma-d16
128 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
129 KERNEL_INITRAMFS_SUFFIX := .trx
130 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma-d16 | trx
131 FILESYSTEMS := squashfs
132 KERNEL_NAME := zImage
133 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
134 IMAGES := trx
135 BLOCKSIZE := 128k
136 PAGESIZE := 2048
137 IMAGE/trx := append-ubi | trx-nand
138 endef
139
140 define Device/asus
141 IMAGES := trx
142 IMAGE/trx := append-ubi | trx-nand | asus-trx
143 endef
144
145 define Device/asus-rt-ac56u
146 DEVICE_VENDOR := ASUS
147 DEVICE_MODEL := RT-AC56U
148 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
149 endef
150 TARGET_DEVICES += asus-rt-ac56u
151
152 define Device/asus-rt-ac68u
153 DEVICE_VENDOR := ASUS
154 DEVICE_MODEL := RT-AC68U
155 DEVICE_PACKAGES := $(USB3_PACKAGES)
156 endef
157 TARGET_DEVICES += asus-rt-ac68u
158
159 define Device/asus-rt-ac87u
160 DEVICE_VENDOR := ASUS
161 DEVICE_MODEL := RT-AC87U
162 DEVICE_PACKAGES := $(USB3_PACKAGES)
163 endef
164 TARGET_DEVICES += asus-rt-ac87u
165
166 define Device/asus-rt-n18u
167 DEVICE_VENDOR := ASUS
168 DEVICE_MODEL := RT-N18U
169 DEVICE_PACKAGES := $(USB3_PACKAGES)
170 endef
171 TARGET_DEVICES += asus-rt-n18u
172
173 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
174 # kernels.
175 # We should have two initramfs images for Buffalo: plain initramfs kernel and
176 # TRX with initramfs kernel. It's not possible right now so let's just build
177 # plain initramfs kernel as it may be more useful.
178 define Device/buffalo/Default
179 DEVICE_VENDOR := Buffalo
180 KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
181 KERNEL_INITRAMFS = $$(KERNEL)
182 endef
183
184 define Device/buffalo-wxr-1900dhp
185 $(call Device/buffalo/Default)
186 DEVICE_MODEL := WXR-1900DHP
187 DEVICE_PACKAGES := $(USB3_PACKAGES)
188 endef
189 TARGET_DEVICES += buffalo-wxr-1900dhp
190
191 define Device/buffalo-wzr-600dhp2
192 $(call Device/buffalo/Default)
193 DEVICE_MODEL := WZR-600DHP2
194 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
195 endef
196 TARGET_DEVICES += buffalo-wzr-600dhp2
197
198 define Device/buffalo-wzr-900dhp
199 $(call Device/buffalo/Default)
200 DEVICE_MODEL := WZR-900DHP
201 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
202 BUFFALO_TAG_PLATFORM := bcm
203 BUFFALO_TAG_VERSION := 9.99
204 BUFFALO_TAG_MINOR := 9.99
205 IMAGES += factory-DHP-EU.bin factory-DHP2-JP.bin
206 IMAGE/factory-DHP-EU.bin := \
207 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP EU | \
208 buffalo-enc WZR-900DHP $$(BUFFALO_TAG_VERSION) | \
209 buffalo-tag-dhp WZR-900DHP EU mlang20 | buffalo-enc-tag | \
210 buffalo-dhp-image
211 IMAGE/factory-DHP2-JP.bin := \
212 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP2 JP | \
213 buffalo-enc WZR-900DHP2 $$(BUFFALO_TAG_VERSION) | \
214 buffalo-tag-dhp WZR-900DHP2 JP jp | buffalo-enc-tag | \
215 buffalo-dhp-image
216 endef
217 TARGET_DEVICES += buffalo-wzr-900dhp
218
219 define Device/buffalo-wzr-1750dhp
220 $(call Device/buffalo/Default)
221 DEVICE_MODEL := WZR-1750DHP
222 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
223 endef
224 TARGET_DEVICES += buffalo-wzr-1750dhp
225
226 define Device/dlink
227 DEVICE_VENDOR := D-Link
228 IMAGES := bin
229 IMAGE/bin := append-ubi | seama-nand
230 endef
231
232 define Device/dlink-dir-885l
233 DEVICE_MODEL := DIR-885L
234 DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
235 $(Device/dlink)
236 SIGNATURE := wrgac42_dlink.2015_dir885l
237 endef
238 TARGET_DEVICES += dlink-dir-885l
239
240 # Linksys devices are disabled due to problem with 2 TRX partitions
241 define Device/linksys-ea6300-v1
242 DEVICE_VENDOR := Linksys
243 DEVICE_MODEL := EA6300
244 DEVICE_VARIANT := v1
245 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
246 endef
247 # TARGET_DEVICES += linksys-ea6300-v1
248
249 define Device/linksys-ea6500-v2
250 DEVICE_VENDOR := Linksys
251 DEVICE_MODEL := EA6500
252 DEVICE_VARIANT := v2
253 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
254 endef
255 TARGET_DEVICES += linksys-ea6500-v2
256
257 define Device/linksys-ea9200
258 DEVICE_VENDOR := Linksys
259 DEVICE_MODEL := EA9200
260 DEVICE_VARIANT := v1
261 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
262 endef
263 # TARGET_DEVICES += linksys-ea9200
264
265 define Device/linksys-ea9500
266 DEVICE_VENDOR := Linksys
267 DEVICE_MODEL := EA9500
268 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
269 DEVICE_DTS := bcm47094-linksys-panamera
270 endef
271 # TARGET_DEVICES += linksys-ea9500
272
273 define Device/luxul
274 DEVICE_VENDOR := Luxul
275 IMAGES := lxl
276 IMAGE/lxl := append-ubi | trx-nand | luxul-lxl
277 endef
278
279 define Device/luxul-abr-4500
280 $(Device/luxul)
281 DEVICE_MODEL := ABR-4500
282 DEVICE_PACKAGES := $(USB3_PACKAGES)
283 LUXUL_BOARD := ABR-4500
284 endef
285 TARGET_DEVICES += luxul-abr-4500
286
287 define Device/luxul-xbr-4500
288 $(Device/luxul)
289 DEVICE_MODEL := XBR-4500
290 DEVICE_PACKAGES := $(USB3_PACKAGES)
291 LUXUL_BOARD := XBR-4500
292 endef
293 TARGET_DEVICES += luxul-xbr-4500
294
295 define Device/netgear
296 DEVICE_VENDOR := NETGEAR
297 IMAGES := chk
298 IMAGE/chk := append-ubi | trx-nand | netgear-chk
299 NETGEAR_REGION := 1
300 endef
301
302 define Device/netgear-r6250
303 DEVICE_MODEL := R6250
304 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
305 $(Device/netgear)
306 NETGEAR_BOARD_ID := U12H245T00_NETGEAR
307 endef
308 TARGET_DEVICES += netgear-r6250
309
310 define Device/netgear-r6300-v2
311 DEVICE_MODEL := R6300
312 DEVICE_VARIANT := v2
313 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
314 $(Device/netgear)
315 NETGEAR_BOARD_ID := U12H240T00_NETGEAR
316 endef
317 TARGET_DEVICES += netgear-r6300-v2
318
319 define Device/netgear-r7000
320 DEVICE_MODEL := R7000
321 DEVICE_PACKAGES := $(USB3_PACKAGES)
322 $(Device/netgear)
323 NETGEAR_BOARD_ID := U12H270T00_NETGEAR
324 endef
325 TARGET_DEVICES += netgear-r7000
326
327 define Device/netgear-r7900
328 DEVICE_MODEL := R7900
329 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
330 $(Device/netgear)
331 NETGEAR_BOARD_ID := U12H315T30_NETGEAR
332 endef
333 TARGET_DEVICES += netgear-r7900
334
335 define Device/netgear-r8000
336 DEVICE_MODEL := R8000
337 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
338 $(Device/netgear)
339 NETGEAR_BOARD_ID := U12H315T00_NETGEAR
340 endef
341 TARGET_DEVICES += netgear-r8000
342
343 define Device/netgear-r8500
344 DEVICE_MODEL := R8500
345 DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
346 $(Device/netgear)
347 NETGEAR_BOARD_ID := U12H334T00_NETGEAR
348 endef
349 # TARGET_DEVICES += netgear-r8500
350
351 define Device/smartrg-sr400ac
352 DEVICE_VENDOR := SmartRG
353 DEVICE_MODEL := SR400ac
354 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
355 IMAGES := trx
356 IMAGE/trx := append-rootfs | trx-serial
357 KERNEL_INITRAMFS_SUFFIX := .bin
358 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma-d16
359 endef
360 TARGET_DEVICES += smartrg-sr400ac
361
362 define Device/phicomm-k3
363 DEVICE_VENDOR := PHICOMM
364 DEVICE_MODEL := K3
365 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
366 IMAGES := trx
367 endef
368 TARGET_DEVICES += phicomm-k3
369
370 define Device/tenda-ac9
371 DEVICE_VENDOR := Tenda
372 DEVICE_MODEL := AC9
373 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
374 IMAGES := trx
375 IMAGE/trx := append-rootfs | trx-serial
376 endef
377 TARGET_DEVICES += tenda-ac9
378
379 define Device/tplink-archer-c5-v2
380 DEVICE_VENDOR := TP-LINK
381 DEVICE_MODEL := Archer C5
382 DEVICE_VARIANT := v2
383 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
384 IMAGES := bin
385 IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
386 TPLINK_BOARD := ARCHER-C5-V2
387 endef
388 #TARGET_DEVICES += tplink-archer-c5-v2
389
390 define Device/tplink-archer-c9-v1
391 DEVICE_VENDOR := TP-LINK
392 DEVICE_MODEL := Archer C9
393 DEVICE_VARIANT := v1
394 DEVICE_PACKAGES := $(USB3_PACKAGES)
395 IMAGES := bin
396 IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
397 TPLINK_BOARD := ARCHERC9
398 endef
399 #TARGET_DEVICES += tplink-archer-c9-v1
400
401 $(eval $(call BuildImage))