1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2013 OpenWrt.org
5 include $(TOPDIR
)/rules.mk
6 include $(INCLUDE_DIR
)/image.mk
10 echo
-ne
'\xde\xad\xc0\xde' > $(KDIR
)/fs_mark
11 $(call prepare_generic_squashfs
,$(KDIR
)/fs_mark
)
13 # For UBI we want only one extra block
14 rm -f
$(KDIR
)/ubi_mark
15 echo
-ne
'\xde\xad\xc0\xde' > $(KDIR
)/ubi_mark
19 $(STAGING_DIR_HOST
)/bin
/lzma e
$@
-d16
$(1) $@.new
23 # Similar to Build/tplink-safeloader but uses TRX instead of clean kernel
24 define Build
/bcm53xx-tplink-safeloader
25 $(STAGING_DIR_HOST
)/bin
/trx \
28 -f
$(IMAGE_KERNEL
) -a
1024
29 $(STAGING_DIR_HOST
)/bin
/tplink-safeloader \
39 define Build
/buffalo-wzr-header
40 $(eval product
=$(word 1,$(1)))
41 $(eval region
=$(word 2,$(1)))
43 echo
$(product
)_
$(BUFFALO_TAG_VERSION
)_
$(BUFFALO_TAG_MINOR
)_
$(region
)_
$(BUFFALO_TAG_PLATFORM
); \
44 echo filelen
=$$(stat
-c
%s
$@
); \
50 # TRX with only one (kernel) partition
52 $(STAGING_DIR_HOST
)/bin
/trx \
59 define Build
/trx-serial
60 $(STAGING_DIR_HOST
)/bin
/otrx create
$@.new \
61 -f
$(IMAGE_KERNEL
) -a
1024 \
62 -f
$@
-a
0x10000 -A
$(KDIR
)/fs_mark
67 # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
68 # if it grows up between releases
69 # root: UBI with one extra block containing UBI mark to trigger erasing
71 $(STAGING_DIR_HOST
)/bin
/otrx create
$@.new \
72 -f
$(IMAGE_KERNEL
) -a
0x20000 -b
0x400000 \
74 -A
$(KDIR
)/ubi_mark
-a
0x20000
79 $(STAGING_DIR_HOST
)/bin
/asustrx \
80 -p
$(ASUS_PRODUCTID
) -i
$@
-o
$@.new
84 define Build
/luxul-lxl
85 $(STAGING_DIR_HOST
)/bin
/lxlfw create
$@.new \
91 # Outputs a lzma compressed U-Boot that start at 0x00008000
92 # just like the D-Link boot loaders expect
93 define Build
/dlink-uboot-bin
94 $(STAGING_DIR_HOST
)/bin
/lzma e
$(STAGING_DIR_IMAGE
)/$(DEVICE_NAME
)-u-boot.bin
-d16
$@
97 define Build
/seama-nand
99 $(STAGING_DIR_HOST
)/bin
/oseama \
101 -m
"dev=/dev/mtdblock/7" \
108 $(STAGING_DIR_HOST
)/bin
/seama \
110 -m
"signature=$(SIGNATURE)" \
114 define Build
/dwl8610ap-image
116 # The DWL8610AP pretends to be a Broadcom reference design
117 echo
"bcm953012er" > $@.tmptar
/board
118 echo
"LVL7" > $@.tmptar
/model
119 # Something high beyond what D-Link has put out
120 echo
"5.0.0.0" > $@.tmptar
/version
121 # Create rootfs.bin, this is just a NAND image including everything
122 cp
$@
$@.tmptar
/rootfs.bin
123 # Hash the rootfs.bin
124 cat
$@.tmptar
/rootfs.bin | md5sum
> $@.tmptar
/rootfs.md5
125 cd
$@.tmptar
&& tar -c
-f
$@.new
*
130 DEVICE_VARS
+= ASUS_PRODUCTID
131 DEVICE_VARS
+= BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
132 DEVICE_VARS
+= SIGNATURE
133 DEVICE_VARS
+= NETGEAR_BOARD_ID NETGEAR_REGION TPLINK_BOARD
134 DEVICE_VARS
+= LUXUL_BOARD
136 IEEE8021X
:= wpad-basic-mbedtls
137 B43
:= $(IEEE8021X
) kmod-b43
138 BRCMFMAC_43602A1
:= $(IEEE8021X
) kmod-brcmfmac brcmfmac-firmware-43602a1-pcie
139 BRCMFMAC_4366B1
:= $(IEEE8021X
) kmod-brcmfmac brcmfmac-firmware-4366b1-pcie
140 BRCMFMAC_4366C0
:= $(IEEE8021X
) kmod-brcmfmac brcmfmac-firmware-4366c0-pcie
141 USB2_PACKAGES
:= kmod-usb-ohci kmod-usb2 kmod-phy-bcm-ns-usb2
142 USB2_PACKAGES
+= kmod-usb-ledtrig-usbport
143 USB3_PACKAGES
:= $(USB2_PACKAGES
) kmod-usb3 kmod-phy-bcm-ns-usb3
145 define Device
/Default
146 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
147 # extract the full dtb name based on the device info
148 DEVICE_DTS
:= $(patsubst %.dtb
,%,$(notdir $(wildcard $(if
$(IB
),$(KDIR
),$(DTS_DIR
))/*-$(subst _
,-,$(1)).dtb
)))
149 KERNEL
:= kernel-bin | append-dtb | lzma-d16
150 KERNEL_DEPENDS
= $$(wildcard $(DTS_DIR
)/$$(DEVICE_DTS
).dts
)
151 KERNEL_INITRAMFS_SUFFIX
:= .trx
152 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | lzma-d16 | trx
153 FILESYSTEMS
:= squashfs
154 KERNEL_NAME
:= zImage
155 DEVICE_IMG_NAME
= $$(DEVICE_IMG_PREFIX
)-$$(1).
$$(2)
159 IMAGE
/trx
:= append-ubi | trx-nand
163 DEVICE_VENDOR
:= ASUS
165 IMAGE
/trx
:= append-ubi | trx-nand | asus-trx
168 define Device
/asus_rt-ac3100
170 DEVICE_MODEL
:= RT-AC3100
171 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
172 ASUS_PRODUCTID
:= RT-AC3100
174 TARGET_DEVICES
+= asus_rt-ac3100
176 define Device
/asus_rt-ac56u
178 DEVICE_MODEL
:= RT-AC56U
179 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
180 ASUS_PRODUCTID
:= RT-AC56U
182 TARGET_DEVICES
+= asus_rt-ac56u
184 define Device
/asus_rt-ac68u
186 DEVICE_MODEL
:= RT-AC68U
187 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
188 ASUS_PRODUCTID
:= RT-AC68U
190 TARGET_DEVICES
+= asus_rt-ac68u
192 define Device
/asus_rt-ac87u
194 DEVICE_MODEL
:= RT-AC87U
195 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
196 ASUS_PRODUCTID
:= RT-AC87U
198 TARGET_DEVICES
+= asus_rt-ac87u
200 define Device
/asus_rt-ac88u
202 DEVICE_MODEL
:= RT-AC88U
203 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
204 ASUS_PRODUCTID
:= RT-AC88U
206 TARGET_DEVICES
+= asus_rt-ac88u
208 define Device
/asus_rt-n18u
210 DEVICE_MODEL
:= RT-N18U
211 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
212 ASUS_PRODUCTID
:= RT-N18U
214 TARGET_DEVICES
+= asus_rt-n18u
216 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
218 # We should have two initramfs images for Buffalo: plain initramfs kernel and
219 # TRX with initramfs kernel. It's not possible right now so let's just build
220 # plain initramfs kernel as it may be more useful.
221 define Device
/buffalo
/Default
222 DEVICE_VENDOR
:= Buffalo
223 KERNEL_INITRAMFS_SUFFIX
= $$(KERNEL_SUFFIX
)
224 KERNEL_INITRAMFS
= $$(KERNEL
)
227 define Device
/buffalo_wxr-1900dhp
228 $(call Device
/buffalo
/Default
)
229 DEVICE_MODEL
:= WXR-1900DHP
230 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
232 TARGET_DEVICES
+= buffalo_wxr-1900dhp
234 define Device
/buffalo_wzr-600dhp2
235 $(call Device
/buffalo
/Default
)
236 DEVICE_MODEL
:= WZR-600DHP2
237 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
239 TARGET_DEVICES
+= buffalo_wzr-600dhp2
241 define Device
/buffalo_wzr-900dhp
242 $(call Device
/buffalo
/Default
)
243 DEVICE_MODEL
:= WZR-900DHP
244 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
245 BUFFALO_TAG_PLATFORM
:= bcm
246 BUFFALO_TAG_VERSION
:= 9.99
247 BUFFALO_TAG_MINOR
:= 9.99
248 IMAGES
+= factory-DHP-EU.bin factory-DHP2-JP.bin
249 IMAGE
/factory-DHP-EU.bin
:= \
250 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP EU | \
251 buffalo-enc WZR-900DHP
$$(BUFFALO_TAG_VERSION
) | \
252 buffalo-tag-dhp WZR-900DHP EU mlang20 | buffalo-enc-tag | \
254 IMAGE
/factory-DHP2-JP.bin
:= \
255 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP2 JP | \
256 buffalo-enc WZR-900DHP2
$$(BUFFALO_TAG_VERSION
) | \
257 buffalo-tag-dhp WZR-900DHP2 JP jp | buffalo-enc-tag | \
260 TARGET_DEVICES
+= buffalo_wzr-900dhp
262 define Device
/buffalo_wzr-1750dhp
263 $(call Device
/buffalo
/Default
)
264 DEVICE_MODEL
:= WZR-1750DHP
265 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
267 TARGET_DEVICES
+= buffalo_wzr-1750dhp
270 DEVICE_VENDOR
:= D-Link
272 IMAGE
/bin
:= append-ubi | seama-nand
275 define Device
/dlink_dir-885l
276 DEVICE_MODEL
:= DIR-885L
277 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
279 SIGNATURE
:= wrgac42_dlink
.2015_dir885l
281 TARGET_DEVICES
+= dlink_dir-885l
283 define Device
/dlink_dir-890l
284 DEVICE_VENDOR
:= D-Link
285 DEVICE_MODEL
:= DIR-890L
286 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB2_PACKAGES
) $(USB3_PACKAGES
)
287 # Layout: U-boot (128kb max) followed by kernel and appended DTB.
288 # This is done because the boot loader will only read the first 2 MB
289 # from the flash and decompress the LZMA it finds there after the
290 # SEAMA header. Since the compressed kernel will not fit in 2 MB,
291 # we put U-Boot there and let U-Boot read and execute the kernel.
292 KERNEL
:= dlink-uboot-bin | pad-to
128k | append-kernel | append-dtb
294 SIGNATURE
:= wrgac36_dlink
.2013gui_dir890
296 TARGET_DEVICES
+= dlink_dir-890l
298 define Device
/dlink_dwl-8610ap
299 DEVICE_VENDOR
:= D-Link
300 DEVICE_MODEL
:= DWL-8610AP
301 DEVICE_PACKAGES
:= $(B43
)
302 IMAGES
:= factory.
tar
303 IMAGE
/factory.
tar := append-ubi | trx-nand | dwl8610ap-image
305 TARGET_DEVICES
+= dlink_dwl-8610ap
307 define Device
/linksys_ea6300-v1
308 DEVICE_VENDOR
:= Linksys
309 DEVICE_MODEL
:= EA6300
311 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
313 TARGET_DEVICES
+= linksys_ea6300-v1
315 define Device
/linksys_ea6500-v2
316 DEVICE_VENDOR
:= Linksys
317 DEVICE_MODEL
:= EA6500
319 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
321 TARGET_DEVICES
+= linksys_ea6500-v2
323 define Device
/linksys_ea9200
324 DEVICE_VENDOR
:= Linksys
325 DEVICE_MODEL
:= EA9200
327 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
329 TARGET_DEVICES
+= linksys_ea9200
331 define Device
/linksys_ea9500
332 DEVICE_VENDOR
:= Linksys
333 DEVICE_MODEL
:= EA9500
334 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
335 DEVICE_DTS
:= bcm47094-linksys-panamera
337 TARGET_DEVICES
+= linksys_ea9500
340 DEVICE_VENDOR
:= Luxul
342 IMAGE
/lxl
:= append-ubi | trx-nand | luxul-lxl
345 define Device
/luxul_abr-4500
347 DEVICE_MODEL
:= ABR-4500
348 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
349 LUXUL_BOARD
:= ABR-4500
351 TARGET_DEVICES
+= luxul_abr-4500
353 define Device
/luxul_xap-1610
355 DEVICE_MODEL
:= XAP-1610
356 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
)
357 IMAGE
/lxl
:= append-rootfs | trx-serial | luxul-lxl
358 LUXUL_BOARD
:= XAP-1610
360 TARGET_DEVICES
+= luxul_xap-1610
362 define Device
/luxul_xbr-4500
364 DEVICE_MODEL
:= XBR-4500
365 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
366 LUXUL_BOARD
:= XBR-4500
368 TARGET_DEVICES
+= luxul_xbr-4500
370 define Device
/luxul_xwr-3150
372 DEVICE_MODEL
:= XWR-3150
373 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
374 DEVICE_DTS
:= bcm47094-luxul-xwr-3150-v1
375 LUXUL_BOARD
:= XWR-3150
377 TARGET_DEVICES
+= luxul_xwr-3150
379 define Device
/meraki_mr26
380 DEVICE_VENDOR
:= Meraki
382 DEVICE_PACKAGES
:= $(B43
) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
383 kmod-hwmon-ina2xx kmod-leds-uleds nu801
384 DEVICE_DTS
:= bcm53015-meraki-mr26
385 # resize the initramfs to fit the size of the existing part.safe.
386 KERNEL_LOADADDR
:= 0x00008000
387 KERNEL_INITRAMFS_SUFFIX
:= .bin
388 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | gzip | uImage gzip | pad-to
9310208
389 # LZMA is not supported by the uboot
390 KERNEL
:= kernel-bin | append-dtb | gzip | uImage gzip
391 IMAGES
+= sysupgrade.bin
392 IMAGE
/sysupgrade.bin
:= sysupgrade-tar | append-metadata
394 TARGET_DEVICES
+= meraki_mr26
396 define Device
/meraki_mr32
397 DEVICE_VENDOR
:= Meraki
399 DEVICE_PACKAGES
:= $(B43
) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
400 kmod-leds-pwm kmod-hwmon-ina2xx kmod-bluetooth
401 DEVICE_DTS
:= bcm53016-meraki-mr32
402 # Meraki FW r23 tries to resize the part.safe partition before it will
403 # flash the image. This is a bit of a problem, since resizing will fail
404 # if the partition is smaller than the old one.
405 KERNEL_LOADADDR
:= 0x00008000
406 KERNEL_INITRAMFS_SUFFIX
:= .bin
407 DEVICE_DTS_DELIMITER
:= @
408 DEVICE_DTS_CONFIG
:= config@
1
409 KERNEL_INITRAMFS
:= kernel-bin | fit none
$$(DTS_DIR
)/$$(DEVICE_DTS
).dtb | \
411 KERNEL
:= kernel-bin | fit none
$$(DTS_DIR
)/$$(DEVICE_DTS
).dtb
412 IMAGES
+= sysupgrade.bin
413 IMAGE
/sysupgrade.bin
:= sysupgrade-tar | append-metadata
415 # The loader is specifically looking for fdt@2:
416 # [ 3.190000] find_itb_subimage: error finding fdt@2: FDT_ERR_NOTFOUND
417 # The image won't boot, if it isn't found. :(
420 TARGET_DEVICES
+= meraki_mr32
422 define Device
/netgear
423 DEVICE_VENDOR
:= NETGEAR
425 IMAGE
/chk
:= append-ubi | trx-nand | netgear-chk
429 define Device
/netgear_r6250
430 DEVICE_MODEL
:= R6250
431 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
433 NETGEAR_BOARD_ID
:= U12H245T00_NETGEAR
435 TARGET_DEVICES
+= netgear_r6250
437 define Device
/netgear_r6300-v2
438 DEVICE_MODEL
:= R6300
440 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
442 NETGEAR_BOARD_ID
:= U12H240T00_NETGEAR
444 TARGET_DEVICES
+= netgear_r6300-v2
446 define Device
/netgear_r7000
447 DEVICE_MODEL
:= R7000
448 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
450 NETGEAR_BOARD_ID
:= U12H270T00_NETGEAR
452 TARGET_DEVICES
+= netgear_r7000
454 define Device
/netgear_r7900
455 DEVICE_MODEL
:= R7900
456 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
458 NETGEAR_BOARD_ID
:= U12H315T30_NETGEAR
460 TARGET_DEVICES
+= netgear_r7900
462 define Device
/netgear_r8000
463 DEVICE_MODEL
:= R8000
464 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
466 NETGEAR_BOARD_ID
:= U12H315T00_NETGEAR
468 TARGET_DEVICES
+= netgear_r8000
470 define Device
/netgear_r8500
471 DEVICE_MODEL
:= R8500
472 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
474 NETGEAR_BOARD_ID
:= U12H334T00_NETGEAR
477 TARGET_DEVICES
+= netgear_r8500
479 define Device
/smartrg_sr400ac
480 DEVICE_VENDOR
:= SmartRG
481 DEVICE_MODEL
:= SR400ac
482 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
484 IMAGE
/trx
:= append-rootfs | trx-serial
485 KERNEL_INITRAMFS_SUFFIX
:= .bin
486 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | lzma-d16
488 TARGET_DEVICES
+= smartrg_sr400ac
490 define Device
/phicomm_k3
491 DEVICE_VENDOR
:= PHICOMM
493 DEVICE_ALT0_VENDOR
:= Wavlink
494 DEVICE_ALT0_MODEL
:= QUANTUM DAX
495 DEVICE_ALT1_VENDOR
:= Wavlink
496 DEVICE_ALT1_MODEL
:= WL-WN538A8
497 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
500 TARGET_DEVICES
+= phicomm_k3
502 define Device
/tenda_ac9
503 DEVICE_VENDOR
:= Tenda
505 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
507 IMAGE
/trx
:= append-rootfs | trx-serial
509 TARGET_DEVICES
+= tenda_ac9
511 define Device
/tplink_archer-c5-v2
512 DEVICE_VENDOR
:= TP-Link
513 DEVICE_MODEL
:= Archer C5
515 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
517 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
518 TPLINK_BOARD
:= ARCHER-C5-V2
521 #TARGET_DEVICES += tplink_archer-c5-v2
523 define Device
/tplink_archer-c9-v1
524 DEVICE_VENDOR
:= TP-Link
525 DEVICE_MODEL
:= Archer C9
527 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
529 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
530 TPLINK_BOARD
:= ARCHERC9
533 #TARGET_DEVICES += tplink_archer-c9-v1
535 $(eval
$(call BuildImage
))