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 PROFILES
= Generic
$$(DEVICE_NAME
)
147 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
148 # extract the full dtb name based on the device info
149 DEVICE_DTS
:= $(patsubst %.dtb
,%,$(notdir $(wildcard $(if
$(IB
),$(KDIR
),$(DTS_DIR
))/*-$(subst _
,-,$(1)).dtb
)))
150 KERNEL
:= kernel-bin | append-dtb | lzma-d16
151 KERNEL_DEPENDS
= $$(wildcard $(DTS_DIR
)/$$(DEVICE_DTS
).dts
)
152 KERNEL_INITRAMFS_SUFFIX
:= .trx
153 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | lzma-d16 | trx
154 FILESYSTEMS
:= squashfs
155 KERNEL_NAME
:= zImage
156 DEVICE_IMG_NAME
= $$(DEVICE_IMG_PREFIX
)-$$(1).
$$(2)
160 IMAGE
/trx
:= append-ubi | trx-nand
164 DEVICE_VENDOR
:= ASUS
166 IMAGE
/trx
:= append-ubi | trx-nand | asus-trx
169 define Device
/asus_rt-ac3100
171 DEVICE_MODEL
:= RT-AC3100
172 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
173 ASUS_PRODUCTID
:= RT-AC3100
175 TARGET_DEVICES
+= asus_rt-ac3100
177 define Device
/asus_rt-ac56u
179 DEVICE_MODEL
:= RT-AC56U
180 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
181 ASUS_PRODUCTID
:= RT-AC56U
183 TARGET_DEVICES
+= asus_rt-ac56u
185 define Device
/asus_rt-ac68u
187 DEVICE_MODEL
:= RT-AC68U
188 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
189 ASUS_PRODUCTID
:= RT-AC68U
191 TARGET_DEVICES
+= asus_rt-ac68u
193 define Device
/asus_rt-ac87u
195 DEVICE_MODEL
:= RT-AC87U
196 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
197 ASUS_PRODUCTID
:= RT-AC87U
199 TARGET_DEVICES
+= asus_rt-ac87u
201 define Device
/asus_rt-ac88u
203 DEVICE_MODEL
:= RT-AC88U
204 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
205 ASUS_PRODUCTID
:= RT-AC88U
207 TARGET_DEVICES
+= asus_rt-ac88u
209 define Device
/asus_rt-n18u
211 DEVICE_MODEL
:= RT-N18U
212 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
213 ASUS_PRODUCTID
:= RT-N18U
215 TARGET_DEVICES
+= asus_rt-n18u
217 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
219 # We should have two initramfs images for Buffalo: plain initramfs kernel and
220 # TRX with initramfs kernel. It's not possible right now so let's just build
221 # plain initramfs kernel as it may be more useful.
222 define Device
/buffalo
/Default
223 DEVICE_VENDOR
:= Buffalo
224 KERNEL_INITRAMFS_SUFFIX
= $$(KERNEL_SUFFIX
)
225 KERNEL_INITRAMFS
= $$(KERNEL
)
228 define Device
/buffalo_wxr-1900dhp
229 $(call Device
/buffalo
/Default
)
230 DEVICE_MODEL
:= WXR-1900DHP
231 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
233 TARGET_DEVICES
+= buffalo_wxr-1900dhp
235 define Device
/buffalo_wzr-600dhp2
236 $(call Device
/buffalo
/Default
)
237 DEVICE_MODEL
:= WZR-600DHP2
238 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
240 TARGET_DEVICES
+= buffalo_wzr-600dhp2
242 define Device
/buffalo_wzr-900dhp
243 $(call Device
/buffalo
/Default
)
244 DEVICE_MODEL
:= WZR-900DHP
245 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
246 BUFFALO_TAG_PLATFORM
:= bcm
247 BUFFALO_TAG_VERSION
:= 9.99
248 BUFFALO_TAG_MINOR
:= 9.99
249 IMAGES
+= factory-DHP-EU.bin factory-DHP2-JP.bin
250 IMAGE
/factory-DHP-EU.bin
:= \
251 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP EU | \
252 buffalo-enc WZR-900DHP
$$(BUFFALO_TAG_VERSION
) | \
253 buffalo-tag-dhp WZR-900DHP EU mlang20 | buffalo-enc-tag | \
255 IMAGE
/factory-DHP2-JP.bin
:= \
256 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP2 JP | \
257 buffalo-enc WZR-900DHP2
$$(BUFFALO_TAG_VERSION
) | \
258 buffalo-tag-dhp WZR-900DHP2 JP jp | buffalo-enc-tag | \
261 TARGET_DEVICES
+= buffalo_wzr-900dhp
263 define Device
/buffalo_wzr-1750dhp
264 $(call Device
/buffalo
/Default
)
265 DEVICE_MODEL
:= WZR-1750DHP
266 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
268 TARGET_DEVICES
+= buffalo_wzr-1750dhp
271 DEVICE_VENDOR
:= D-Link
273 IMAGE
/bin
:= append-ubi | seama-nand
276 define Device
/dlink_dir-885l
277 DEVICE_MODEL
:= DIR-885L
278 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
280 SIGNATURE
:= wrgac42_dlink
.2015_dir885l
282 TARGET_DEVICES
+= dlink_dir-885l
284 define Device
/dlink_dir-890l
285 DEVICE_VENDOR
:= D-Link
286 DEVICE_MODEL
:= DIR-890L
287 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB2_PACKAGES
) $(USB3_PACKAGES
)
288 # Layout: U-boot (128kb max) followed by kernel and appended DTB.
289 # This is done because the boot loader will only read the first 2 MB
290 # from the flash and decompress the LZMA it finds there after the
291 # SEAMA header. Since the compressed kernel will not fit in 2 MB,
292 # we put U-Boot there and let U-Boot read and execute the kernel.
293 KERNEL
:= dlink-uboot-bin | pad-to
128k | append-kernel | append-dtb
295 SIGNATURE
:= wrgac36_dlink
.2013gui_dir890
297 TARGET_DEVICES
+= dlink_dir-890l
299 define Device
/dlink_dwl-8610ap
300 DEVICE_VENDOR
:= D-Link
301 DEVICE_MODEL
:= DWL-8610AP
302 DEVICE_PACKAGES
:= $(B43
)
303 IMAGES
:= factory.
tar
304 IMAGE
/factory.
tar := append-ubi | trx-nand | dwl8610ap-image
306 TARGET_DEVICES
+= dlink_dwl-8610ap
308 define Device
/linksys_ea6300-v1
309 DEVICE_VENDOR
:= Linksys
310 DEVICE_MODEL
:= EA6300
312 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
314 TARGET_DEVICES
+= linksys_ea6300-v1
316 define Device
/linksys_ea6500-v2
317 DEVICE_VENDOR
:= Linksys
318 DEVICE_MODEL
:= EA6500
320 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
322 TARGET_DEVICES
+= linksys_ea6500-v2
324 define Device
/linksys_ea9200
325 DEVICE_VENDOR
:= Linksys
326 DEVICE_MODEL
:= EA9200
328 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
330 TARGET_DEVICES
+= linksys_ea9200
332 define Device
/linksys_ea9500
333 DEVICE_VENDOR
:= Linksys
334 DEVICE_MODEL
:= EA9500
335 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
336 DEVICE_DTS
:= bcm47094-linksys-panamera
338 TARGET_DEVICES
+= linksys_ea9500
341 DEVICE_VENDOR
:= Luxul
343 IMAGE
/lxl
:= append-ubi | trx-nand | luxul-lxl
346 define Device
/luxul_abr-4500
348 DEVICE_MODEL
:= ABR-4500
349 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
350 LUXUL_BOARD
:= ABR-4500
352 TARGET_DEVICES
+= luxul_abr-4500
354 define Device
/luxul_xap-1610
356 DEVICE_MODEL
:= XAP-1610
357 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
)
358 IMAGE
/lxl
:= append-rootfs | trx-serial | luxul-lxl
359 LUXUL_BOARD
:= XAP-1610
361 TARGET_DEVICES
+= luxul_xap-1610
363 define Device
/luxul_xbr-4500
365 DEVICE_MODEL
:= XBR-4500
366 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
367 LUXUL_BOARD
:= XBR-4500
369 TARGET_DEVICES
+= luxul_xbr-4500
371 define Device
/luxul_xwr-3150
373 DEVICE_MODEL
:= XWR-3150
374 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
375 DEVICE_DTS
:= bcm47094-luxul-xwr-3150-v1
376 LUXUL_BOARD
:= XWR-3150
378 TARGET_DEVICES
+= luxul_xwr-3150
380 define Device
/meraki_mr26
381 DEVICE_VENDOR
:= Meraki
383 DEVICE_PACKAGES
:= $(B43
) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
384 kmod-hwmon-ina2xx kmod-leds-uleds nu801
385 DEVICE_DTS
:= bcm53015-meraki-mr26
386 # resize the initramfs to fit the size of the existing part.safe.
387 KERNEL_LOADADDR
:= 0x00008000
388 KERNEL_INITRAMFS_SUFFIX
:= .bin
389 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | gzip | uImage gzip | pad-to
9310208
390 # LZMA is not supported by the uboot
391 KERNEL
:= kernel-bin | append-dtb | gzip | uImage gzip
392 IMAGES
+= sysupgrade.bin
393 IMAGE
/sysupgrade.bin
:= sysupgrade-tar | append-metadata
395 TARGET_DEVICES
+= meraki_mr26
397 define Device
/meraki_mr32
398 DEVICE_VENDOR
:= Meraki
400 DEVICE_PACKAGES
:= $(B43
) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
401 kmod-leds-pwm kmod-hwmon-ina2xx kmod-bluetooth
402 DEVICE_DTS
:= bcm53016-meraki-mr32
403 # Meraki FW r23 tries to resize the part.safe partition before it will
404 # flash the image. This is a bit of a problem, since resizing will fail
405 # if the partition is smaller than the old one.
406 KERNEL_LOADADDR
:= 0x00008000
407 KERNEL_INITRAMFS_SUFFIX
:= .bin
408 DEVICE_DTS_DELIMITER
:= @
409 DEVICE_DTS_CONFIG
:= config@
1
410 KERNEL_INITRAMFS
:= kernel-bin | fit none
$$(DTS_DIR
)/$$(DEVICE_DTS
).dtb | \
412 KERNEL
:= kernel-bin | fit none
$$(DTS_DIR
)/$$(DEVICE_DTS
).dtb
413 IMAGES
+= sysupgrade.bin
414 IMAGE
/sysupgrade.bin
:= sysupgrade-tar | append-metadata
416 # The loader is specifically looking for fdt@2:
417 # [ 3.190000] find_itb_subimage: error finding fdt@2: FDT_ERR_NOTFOUND
418 # The image won't boot, if it isn't found. :(
421 TARGET_DEVICES
+= meraki_mr32
423 define Device
/netgear
424 DEVICE_VENDOR
:= NETGEAR
426 IMAGE
/chk
:= append-ubi | trx-nand | netgear-chk
430 define Device
/netgear_r6250
431 DEVICE_MODEL
:= R6250
432 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
434 NETGEAR_BOARD_ID
:= U12H245T00_NETGEAR
436 TARGET_DEVICES
+= netgear_r6250
438 define Device
/netgear_r6300-v2
439 DEVICE_MODEL
:= R6300
441 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
443 NETGEAR_BOARD_ID
:= U12H240T00_NETGEAR
445 TARGET_DEVICES
+= netgear_r6300-v2
447 define Device
/netgear_r7000
448 DEVICE_MODEL
:= R7000
449 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
451 NETGEAR_BOARD_ID
:= U12H270T00_NETGEAR
453 TARGET_DEVICES
+= netgear_r7000
455 define Device
/netgear_r7900
456 DEVICE_MODEL
:= R7900
457 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
459 NETGEAR_BOARD_ID
:= U12H315T30_NETGEAR
461 TARGET_DEVICES
+= netgear_r7900
463 define Device
/netgear_r8000
464 DEVICE_MODEL
:= R8000
465 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
467 NETGEAR_BOARD_ID
:= U12H315T00_NETGEAR
469 TARGET_DEVICES
+= netgear_r8000
471 define Device
/netgear_r8500
472 DEVICE_MODEL
:= R8500
473 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
475 NETGEAR_BOARD_ID
:= U12H334T00_NETGEAR
478 TARGET_DEVICES
+= netgear_r8500
480 define Device
/smartrg_sr400ac
481 DEVICE_VENDOR
:= SmartRG
482 DEVICE_MODEL
:= SR400ac
483 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
485 IMAGE
/trx
:= append-rootfs | trx-serial
486 KERNEL_INITRAMFS_SUFFIX
:= .bin
487 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | lzma-d16
489 TARGET_DEVICES
+= smartrg_sr400ac
491 define Device
/phicomm_k3
492 DEVICE_VENDOR
:= PHICOMM
494 DEVICE_ALT0_VENDOR
:= Wavlink
495 DEVICE_ALT0_MODEL
:= QUANTUM DAX
496 DEVICE_ALT1_VENDOR
:= Wavlink
497 DEVICE_ALT1_MODEL
:= WL-WN538A8
498 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
501 TARGET_DEVICES
+= phicomm_k3
503 define Device
/tenda_ac9
504 DEVICE_VENDOR
:= Tenda
506 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
508 IMAGE
/trx
:= append-rootfs | trx-serial
510 TARGET_DEVICES
+= tenda_ac9
512 define Device
/tplink_archer-c5-v2
513 DEVICE_VENDOR
:= TP-Link
514 DEVICE_MODEL
:= Archer C5
516 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
518 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
519 TPLINK_BOARD
:= ARCHER-C5-V2
522 #TARGET_DEVICES += tplink_archer-c5-v2
524 define Device
/tplink_archer-c9-v1
525 DEVICE_VENDOR
:= TP-Link
526 DEVICE_MODEL
:= Archer C9
528 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
530 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
531 TPLINK_BOARD
:= ARCHERC9
534 #TARGET_DEVICES += tplink_archer-c9-v1
536 $(eval
$(call BuildImage
))