treewide: use DEFAULT := n to disable non-broken devices
[openwrt/staging/chunkeey.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 $(ASUS_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 += ASUS_PRODUCTID
111 DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
112 DEVICE_VARS += SIGNATURE
113 DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_REGION TPLINK_BOARD
114 DEVICE_VARS += LUXUL_BOARD
115
116 IEEE8021X := wpad-basic
117 B43 := $(IEEE8021X) kmod-b43
118 BRCMFMAC_43602A1 := $(IEEE8021X) kmod-brcmfmac brcmfmac-firmware-43602a1-pcie
119 BRCMFMAC_4366B1 := $(IEEE8021X) kmod-brcmfmac brcmfmac-firmware-4366b1-pcie
120 BRCMFMAC_4366C0 := $(IEEE8021X) kmod-brcmfmac brcmfmac-firmware-4366c0-pcie
121 USB2_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-phy-bcm-ns-usb2
122 USB2_PACKAGES += kmod-usb-ledtrig-usbport
123 USB3_PACKAGES := $(USB2_PACKAGES) kmod-usb3 kmod-phy-bcm-ns-usb3
124
125 define Device/Default
126 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
127 # extract the full dtb name based on the device info
128 DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
129 KERNEL := kernel-bin | append-dtb | lzma-d16
130 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
131 KERNEL_INITRAMFS_SUFFIX := .trx
132 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma-d16 | trx
133 FILESYSTEMS := squashfs
134 KERNEL_NAME := zImage
135 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
136 IMAGES := trx
137 BLOCKSIZE := 128k
138 PAGESIZE := 2048
139 IMAGE/trx := append-ubi | trx-nand
140 endef
141
142 define Device/asus
143 DEVICE_VENDOR := ASUS
144 IMAGES := trx
145 IMAGE/trx := append-ubi | trx-nand | asus-trx
146 endef
147
148 define Device/asus-rt-ac56u
149 $(call Device/asus)
150 DEVICE_MODEL := RT-AC56U
151 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
152 ASUS_PRODUCTID := RT-AC56U
153 endef
154 TARGET_DEVICES += asus-rt-ac56u
155
156 define Device/asus-rt-ac68u
157 $(call Device/asus)
158 DEVICE_MODEL := RT-AC68U
159 DEVICE_PACKAGES := $(USB3_PACKAGES)
160 ASUS_PRODUCTID := RT-AC68U
161 endef
162 TARGET_DEVICES += asus-rt-ac68u
163
164 define Device/asus-rt-ac87u
165 $(call Device/asus)
166 DEVICE_MODEL := RT-AC87U
167 DEVICE_PACKAGES := $(USB3_PACKAGES)
168 ASUS_PRODUCTID := RT-AC87U
169 endef
170 TARGET_DEVICES += asus-rt-ac87u
171
172 define Device/asus-rt-n18u
173 $(call Device/asus)
174 DEVICE_MODEL := RT-N18U
175 DEVICE_PACKAGES := $(USB3_PACKAGES)
176 ASUS_PRODUCTID := RT-N18U
177 endef
178 TARGET_DEVICES += asus-rt-n18u
179
180 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
181 # kernels.
182 # We should have two initramfs images for Buffalo: plain initramfs kernel and
183 # TRX with initramfs kernel. It's not possible right now so let's just build
184 # plain initramfs kernel as it may be more useful.
185 define Device/buffalo/Default
186 DEVICE_VENDOR := Buffalo
187 KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
188 KERNEL_INITRAMFS = $$(KERNEL)
189 endef
190
191 define Device/buffalo-wxr-1900dhp
192 $(call Device/buffalo/Default)
193 DEVICE_MODEL := WXR-1900DHP
194 DEVICE_PACKAGES := $(USB3_PACKAGES)
195 endef
196 TARGET_DEVICES += buffalo-wxr-1900dhp
197
198 define Device/buffalo-wzr-600dhp2
199 $(call Device/buffalo/Default)
200 DEVICE_MODEL := WZR-600DHP2
201 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
202 endef
203 TARGET_DEVICES += buffalo-wzr-600dhp2
204
205 define Device/buffalo-wzr-900dhp
206 $(call Device/buffalo/Default)
207 DEVICE_MODEL := WZR-900DHP
208 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
209 BUFFALO_TAG_PLATFORM := bcm
210 BUFFALO_TAG_VERSION := 9.99
211 BUFFALO_TAG_MINOR := 9.99
212 IMAGES += factory-DHP-EU.bin factory-DHP2-JP.bin
213 IMAGE/factory-DHP-EU.bin := \
214 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP EU | \
215 buffalo-enc WZR-900DHP $$(BUFFALO_TAG_VERSION) | \
216 buffalo-tag-dhp WZR-900DHP EU mlang20 | buffalo-enc-tag | \
217 buffalo-dhp-image
218 IMAGE/factory-DHP2-JP.bin := \
219 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP2 JP | \
220 buffalo-enc WZR-900DHP2 $$(BUFFALO_TAG_VERSION) | \
221 buffalo-tag-dhp WZR-900DHP2 JP jp | buffalo-enc-tag | \
222 buffalo-dhp-image
223 endef
224 TARGET_DEVICES += buffalo-wzr-900dhp
225
226 define Device/buffalo-wzr-1750dhp
227 $(call Device/buffalo/Default)
228 DEVICE_MODEL := WZR-1750DHP
229 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
230 endef
231 TARGET_DEVICES += buffalo-wzr-1750dhp
232
233 define Device/dlink
234 DEVICE_VENDOR := D-Link
235 IMAGES := bin
236 IMAGE/bin := append-ubi | seama-nand
237 endef
238
239 define Device/dlink-dir-885l
240 DEVICE_MODEL := DIR-885L
241 DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
242 $(Device/dlink)
243 SIGNATURE := wrgac42_dlink.2015_dir885l
244 endef
245 TARGET_DEVICES += dlink-dir-885l
246
247 # Linksys devices are disabled due to problem with 2 TRX partitions
248 define Device/linksys-ea6300-v1
249 DEVICE_VENDOR := Linksys
250 DEVICE_MODEL := EA6300
251 DEVICE_VARIANT := v1
252 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
253 endef
254 # TARGET_DEVICES += linksys-ea6300-v1
255
256 define Device/linksys-ea6500-v2
257 DEVICE_VENDOR := Linksys
258 DEVICE_MODEL := EA6500
259 DEVICE_VARIANT := v2
260 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
261 endef
262 TARGET_DEVICES += linksys-ea6500-v2
263
264 define Device/linksys-ea9200
265 DEVICE_VENDOR := Linksys
266 DEVICE_MODEL := EA9200
267 DEVICE_VARIANT := v1
268 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
269 endef
270 # TARGET_DEVICES += linksys-ea9200
271
272 define Device/linksys-ea9500
273 DEVICE_VENDOR := Linksys
274 DEVICE_MODEL := EA9500
275 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
276 DEVICE_DTS := bcm47094-linksys-panamera
277 endef
278 # TARGET_DEVICES += linksys-ea9500
279
280 define Device/luxul
281 DEVICE_VENDOR := Luxul
282 IMAGES := lxl
283 IMAGE/lxl := append-ubi | trx-nand | luxul-lxl
284 endef
285
286 define Device/luxul-abr-4500
287 $(Device/luxul)
288 DEVICE_MODEL := ABR-4500
289 DEVICE_PACKAGES := $(USB3_PACKAGES)
290 LUXUL_BOARD := ABR-4500
291 endef
292 TARGET_DEVICES += luxul-abr-4500
293
294 define Device/luxul-xap-1610
295 $(Device/luxul)
296 DEVICE_MODEL := XAP-1610
297 DEVICE_PACKAGES := $(BRCMFMAC_4366C0)
298 IMAGE/lxl := append-rootfs | trx-serial | luxul-lxl
299 LUXUL_BOARD := XAP-1610
300 endef
301 TARGET_DEVICES += luxul-xap-1610
302
303 define Device/luxul-xbr-4500
304 $(Device/luxul)
305 DEVICE_MODEL := XBR-4500
306 DEVICE_PACKAGES := $(USB3_PACKAGES)
307 LUXUL_BOARD := XBR-4500
308 endef
309 TARGET_DEVICES += luxul-xbr-4500
310
311 define Device/luxul-xwr-3150
312 $(Device/luxul)
313 DEVICE_MODEL := XWR-3150
314 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
315 DEVICE_DTS := bcm47094-luxul-xwr-3150-v1
316 LUXUL_BOARD := XWR-3150
317 endef
318 TARGET_DEVICES += luxul-xwr-3150
319
320 define Device/netgear
321 DEVICE_VENDOR := NETGEAR
322 IMAGES := chk
323 IMAGE/chk := append-ubi | trx-nand | netgear-chk
324 NETGEAR_REGION := 1
325 endef
326
327 define Device/netgear-r6250
328 DEVICE_MODEL := R6250
329 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
330 $(Device/netgear)
331 NETGEAR_BOARD_ID := U12H245T00_NETGEAR
332 endef
333 TARGET_DEVICES += netgear-r6250
334
335 define Device/netgear-r6300-v2
336 DEVICE_MODEL := R6300
337 DEVICE_VARIANT := v2
338 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
339 $(Device/netgear)
340 NETGEAR_BOARD_ID := U12H240T00_NETGEAR
341 endef
342 TARGET_DEVICES += netgear-r6300-v2
343
344 define Device/netgear-r7000
345 DEVICE_MODEL := R7000
346 DEVICE_PACKAGES := $(USB3_PACKAGES)
347 $(Device/netgear)
348 NETGEAR_BOARD_ID := U12H270T00_NETGEAR
349 endef
350 TARGET_DEVICES += netgear-r7000
351
352 define Device/netgear-r7900
353 DEVICE_MODEL := R7900
354 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
355 $(Device/netgear)
356 NETGEAR_BOARD_ID := U12H315T30_NETGEAR
357 endef
358 TARGET_DEVICES += netgear-r7900
359
360 define Device/netgear-r8000
361 DEVICE_MODEL := R8000
362 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
363 $(Device/netgear)
364 NETGEAR_BOARD_ID := U12H315T00_NETGEAR
365 endef
366 TARGET_DEVICES += netgear-r8000
367
368 define Device/netgear-r8500
369 DEVICE_MODEL := R8500
370 DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
371 $(Device/netgear)
372 NETGEAR_BOARD_ID := U12H334T00_NETGEAR
373 DEFAULT := n
374 endef
375 TARGET_DEVICES += netgear-r8500
376
377 define Device/smartrg-sr400ac
378 DEVICE_VENDOR := SmartRG
379 DEVICE_MODEL := SR400ac
380 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
381 IMAGES := trx
382 IMAGE/trx := append-rootfs | trx-serial
383 KERNEL_INITRAMFS_SUFFIX := .bin
384 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma-d16
385 endef
386 TARGET_DEVICES += smartrg-sr400ac
387
388 define Device/phicomm-k3
389 DEVICE_VENDOR := PHICOMM
390 DEVICE_MODEL := K3
391 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
392 IMAGES := trx
393 endef
394 TARGET_DEVICES += phicomm-k3
395
396 define Device/tenda-ac9
397 DEVICE_VENDOR := Tenda
398 DEVICE_MODEL := AC9
399 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
400 IMAGES := trx
401 IMAGE/trx := append-rootfs | trx-serial
402 endef
403 TARGET_DEVICES += tenda-ac9
404
405 define Device/tplink-archer-c5-v2
406 DEVICE_VENDOR := TP-LINK
407 DEVICE_MODEL := Archer C5
408 DEVICE_VARIANT := v2
409 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
410 IMAGES := bin
411 IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
412 TPLINK_BOARD := ARCHER-C5-V2
413 endef
414 #TARGET_DEVICES += tplink-archer-c5-v2
415
416 define Device/tplink-archer-c9-v1
417 DEVICE_VENDOR := TP-LINK
418 DEVICE_MODEL := Archer C9
419 DEVICE_VARIANT := v1
420 DEVICE_PACKAGES := $(USB3_PACKAGES)
421 IMAGES := bin
422 IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
423 TPLINK_BOARD := ARCHERC9
424 endef
425 #TARGET_DEVICES += tplink-archer-c9-v1
426
427 $(eval $(call BuildImage))