bcm53xx: build images for Luxul ABR-4500 and XBR-4500 routers
[openwrt/staging/jow.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_TITLE := Asus RT-AC56U
147 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
148 endef
149 TARGET_DEVICES += asus-rt-ac56u
150
151 define Device/asus-rt-ac68u
152 DEVICE_TITLE := Asus RT-AC68U
153 DEVICE_PACKAGES := $(USB3_PACKAGES)
154 endef
155 TARGET_DEVICES += asus-rt-ac68u
156
157 define Device/asus-rt-ac87u
158 DEVICE_TITLE := Asus RT-AC87U
159 DEVICE_PACKAGES := $(USB3_PACKAGES)
160 endef
161 TARGET_DEVICES += asus-rt-ac87u
162
163 define Device/asus-rt-n18u
164 DEVICE_TITLE := Asus RT-N18U
165 DEVICE_PACKAGES := $(USB3_PACKAGES)
166 endef
167 TARGET_DEVICES += asus-rt-n18u
168
169 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
170 # kernels.
171 # We should have two initramfs images for Buffalo: plain initramfs kernel and
172 # TRX with initramfs kernel. It's not possible right now so let's just build
173 # plain initramfs kernel as it may be more useful.
174 define Device/buffalo/Default
175 KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
176 KERNEL_INITRAMFS = $$(KERNEL)
177 endef
178
179 define Device/buffalo-wxr-1900dhp
180 $(call Device/buffalo/Default)
181 DEVICE_TITLE := Buffalo WXR-1900DHP
182 DEVICE_PACKAGES := $(USB3_PACKAGES)
183 endef
184 TARGET_DEVICES += buffalo-wxr-1900dhp
185
186 define Device/buffalo-wzr-600dhp2
187 $(call Device/buffalo/Default)
188 DEVICE_TITLE := Buffalo WZR-600DHP2
189 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
190 endef
191 TARGET_DEVICES += buffalo-wzr-600dhp2
192
193 define Device/buffalo-wzr-900dhp
194 $(call Device/buffalo/Default)
195 DEVICE_TITLE := Buffalo WZR-900DHP
196 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
197 BUFFALO_TAG_PLATFORM := bcm
198 BUFFALO_TAG_VERSION := 9.99
199 BUFFALO_TAG_MINOR := 9.99
200 IMAGES += factory-DHP-EU.bin factory-DHP2-JP.bin
201 IMAGE/factory-DHP-EU.bin := \
202 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP EU | \
203 buffalo-enc WZR-900DHP $$(BUFFALO_TAG_VERSION) | \
204 buffalo-tag-dhp WZR-900DHP EU mlang20 | buffalo-enc-tag | \
205 buffalo-dhp-image
206 IMAGE/factory-DHP2-JP.bin := \
207 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP2 JP | \
208 buffalo-enc WZR-900DHP2 $$(BUFFALO_TAG_VERSION) | \
209 buffalo-tag-dhp WZR-900DHP2 JP jp | buffalo-enc-tag | \
210 buffalo-dhp-image
211 endef
212 TARGET_DEVICES += buffalo-wzr-900dhp
213
214 define Device/buffalo-wzr-1750dhp
215 $(call Device/buffalo/Default)
216 DEVICE_TITLE := Buffalo WZR-1750DHP
217 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
218 endef
219 TARGET_DEVICES += buffalo-wzr-1750dhp
220
221 define Device/dlink
222 IMAGES := bin
223 IMAGE/bin := append-ubi | seama-nand
224 endef
225
226 define Device/dlink-dir-885l
227 DEVICE_TITLE := D-Link DIR-885L
228 DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
229 $(Device/dlink)
230 SIGNATURE := wrgac42_dlink.2015_dir885l
231 endef
232 TARGET_DEVICES += dlink-dir-885l
233
234 # Linksys devices are disabled due to problem with 2 TRX partitions
235 define Device/linksys-ea6300-v1
236 DEVICE_TITLE := Linksys EA6300 V1
237 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
238 endef
239 # TARGET_DEVICES += linksys-ea6300-v1
240
241 define Device/linksys-ea6500-v2
242 DEVICE_TITLE := Linksys EA6500 V2
243 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
244 endef
245 TARGET_DEVICES += linksys-ea6500-v2
246
247 define Device/linksys-ea9200
248 DEVICE_TITLE := Linksys EA9200 V1
249 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
250 endef
251 # TARGET_DEVICES += linksys-ea9200
252
253 define Device/linksys-ea9500
254 DEVICE_TITLE := Linksys EA9500
255 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
256 DEVICE_DTS := bcm47094-linksys-panamera
257 endef
258 # TARGET_DEVICES += linksys-ea9500
259
260 define Device/luxul
261 IMAGES := lxl
262 IMAGE/lxl := append-ubi | trx-nand | luxul-lxl
263 endef
264
265 define Device/luxul-abr-4500
266 $(Device/luxul)
267 DEVICE_TITLE := Luxul ABR-4500
268 DEVICE_PACKAGES := $(USB3_PACKAGES)
269 LUXUL_BOARD := ABR-4500
270 endef
271 TARGET_DEVICES += luxul-abr-4500
272
273 define Device/luxul-xbr-4500
274 $(Device/luxul)
275 DEVICE_TITLE := Luxul XBR-4500
276 DEVICE_PACKAGES := $(USB3_PACKAGES)
277 LUXUL_BOARD := XBR-4500
278 endef
279 TARGET_DEVICES += luxul-xbr-4500
280
281 define Device/netgear
282 IMAGES := chk
283 IMAGE/chk := append-ubi | trx-nand | netgear-chk
284 NETGEAR_REGION := 1
285 endef
286
287 define Device/netgear-r6250
288 DEVICE_TITLE := Netgear R6250
289 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
290 $(Device/netgear)
291 NETGEAR_BOARD_ID := U12H245T00_NETGEAR
292 endef
293 TARGET_DEVICES += netgear-r6250
294
295 define Device/netgear-r6300-v2
296 DEVICE_TITLE := Netgear R6300 V2
297 DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES)
298 $(Device/netgear)
299 NETGEAR_BOARD_ID := U12H240T00_NETGEAR
300 endef
301 TARGET_DEVICES += netgear-r6300-v2
302
303 define Device/netgear-r7000
304 DEVICE_TITLE := Netgear R7000
305 DEVICE_PACKAGES := $(USB3_PACKAGES)
306 $(Device/netgear)
307 NETGEAR_BOARD_ID := U12H270T00_NETGEAR
308 endef
309 TARGET_DEVICES += netgear-r7000
310
311 define Device/netgear-r7900
312 DEVICE_TITLE := Netgear R7900
313 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
314 $(Device/netgear)
315 NETGEAR_BOARD_ID := U12H315T30_NETGEAR
316 endef
317 TARGET_DEVICES += netgear-r7900
318
319 define Device/netgear-r8000
320 DEVICE_TITLE := Netgear R8000
321 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
322 $(Device/netgear)
323 NETGEAR_BOARD_ID := U12H315T00_NETGEAR
324 endef
325 TARGET_DEVICES += netgear-r8000
326
327 define Device/netgear-r8500
328 DEVICE_TITLE := Netgear R8500
329 DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
330 $(Device/netgear)
331 NETGEAR_BOARD_ID := U12H334T00_NETGEAR
332 endef
333 # TARGET_DEVICES += netgear-r8500
334
335 define Device/smartrg-sr400ac
336 DEVICE_TITLE := SmartRG SR400ac
337 DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
338 IMAGES := trx
339 IMAGE/trx := append-rootfs | trx-serial
340 KERNEL_INITRAMFS_SUFFIX := .bin
341 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma-d16
342 endef
343 TARGET_DEVICES += smartrg-sr400ac
344
345 define Device/phicomm-k3
346 DEVICE_TITLE := PHICOMM K3
347 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES)
348 IMAGES := trx
349 endef
350 TARGET_DEVICES += phicomm-k3
351
352 define Device/tenda-ac9
353 DEVICE_TITLE := Tenda AC9
354 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
355 IMAGES := trx
356 IMAGE/trx := append-rootfs | trx-serial
357 endef
358 TARGET_DEVICES += tenda-ac9
359
360 define Device/tplink-archer-c5-v2
361 DEVICE_TITLE := TP-LINK Archer C5 V2
362 DEVICE_PACKAGES := $(B43) $(USB2_PACKAGES)
363 IMAGES := bin
364 IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
365 TPLINK_BOARD := ARCHER-C5-V2
366 endef
367 TARGET_DEVICES += tplink-archer-c5-v2
368
369 define Device/tplink-archer-c9-v1
370 DEVICE_TITLE := TP-LINK Archer C9 V1
371 DEVICE_PACKAGES := $(USB3_PACKAGES)
372 IMAGES := bin
373 IMAGE/bin := append-rootfs | bcm53xx-tplink-safeloader
374 TPLINK_BOARD := ARCHERC9
375 endef
376 TARGET_DEVICES += tplink-archer-c9-v1
377
378 $(eval $(call BuildImage))