2 # Copyright (C) 2013 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
12 echo
-ne
'\xde\xad\xc0\xde' > $(KDIR
)/fs_mark
13 $(call prepare_generic_squashfs
,$(KDIR
)/fs_mark
)
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
21 $(STAGING_DIR_HOST
)/bin
/lzma e
$@
-d16
$(1) $@.new
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 \
30 -f
$(IMAGE_KERNEL
) -a
1024
31 $(STAGING_DIR_HOST
)/bin
/tplink-safeloader \
41 define Build
/buffalo-wzr-header
42 $(eval product
=$(word 1,$(1)))
43 $(eval region
=$(word 2,$(1)))
45 echo
$(product
)_
$(BUFFALO_TAG_VERSION
)_
$(BUFFALO_TAG_MINOR
)_
$(region
)_
$(BUFFALO_TAG_PLATFORM
); \
46 echo filelen
=$$(stat
-c
%s
$@
); \
52 # TRX with only one (kernel) partition
54 $(STAGING_DIR_HOST
)/bin
/trx \
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
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
73 $(STAGING_DIR_HOST
)/bin
/otrx create
$@.new \
74 -f
$(IMAGE_KERNEL
) -a
0x20000 -b
0x400000 \
76 -A
$(KDIR
)/ubi_mark
-a
0x20000
81 $(STAGING_DIR_HOST
)/bin
/asustrx \
82 -p
$(ASUS_PRODUCTID
) -i
$@
-o
$@.new
86 define Build
/luxul-lxl
87 $(STAGING_DIR_HOST
)/bin
/lxlfw create
$@.new \
93 define Build
/seama-nand
95 $(STAGING_DIR_HOST
)/bin
/oseama \
97 -m
"dev=/dev/mtdblock/7" \
104 $(STAGING_DIR_HOST
)/bin
/seama \
106 -m
"signature=$(SIGNATURE)" \
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
116 IEEE8021X
:= wpad-basic-wolfssl
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
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
))/*-$(subst _
,-,$(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)
139 IMAGE
/trx
:= append-ubi | trx-nand
143 DEVICE_VENDOR
:= ASUS
145 IMAGE
/trx
:= append-ubi | trx-nand | asus-trx
148 define Device
/asus_rt-ac56u
150 DEVICE_MODEL
:= RT-AC56U
151 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
152 ASUS_PRODUCTID
:= RT-AC56U
154 TARGET_DEVICES
+= asus_rt-ac56u
156 define Device
/asus_rt-ac68u
158 DEVICE_MODEL
:= RT-AC68U
159 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
160 ASUS_PRODUCTID
:= RT-AC68U
162 TARGET_DEVICES
+= asus_rt-ac68u
164 define Device
/asus_rt-ac87u
166 DEVICE_MODEL
:= RT-AC87U
167 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
168 ASUS_PRODUCTID
:= RT-AC87U
170 TARGET_DEVICES
+= asus_rt-ac87u
172 define Device
/asus_rt-n18u
174 DEVICE_MODEL
:= RT-N18U
175 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
176 ASUS_PRODUCTID
:= RT-N18U
178 TARGET_DEVICES
+= asus_rt-n18u
180 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
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
)
191 define Device
/buffalo_wxr-1900dhp
192 $(call Device
/buffalo
/Default
)
193 DEVICE_MODEL
:= WXR-1900DHP
194 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
196 TARGET_DEVICES
+= buffalo_wxr-1900dhp
198 define Device
/buffalo_wzr-600dhp2
199 $(call Device
/buffalo
/Default
)
200 DEVICE_MODEL
:= WZR-600DHP2
201 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
203 TARGET_DEVICES
+= buffalo_wzr-600dhp2
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 | \
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 | \
224 TARGET_DEVICES
+= buffalo_wzr-900dhp
226 define Device
/buffalo_wzr-1750dhp
227 $(call Device
/buffalo
/Default
)
228 DEVICE_MODEL
:= WZR-1750DHP
229 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
231 TARGET_DEVICES
+= buffalo_wzr-1750dhp
234 DEVICE_VENDOR
:= D-Link
236 IMAGE
/bin
:= append-ubi | seama-nand
239 define Device
/dlink_dir-885l
240 DEVICE_MODEL
:= DIR-885L
241 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
243 SIGNATURE
:= wrgac42_dlink
.2015_dir885l
245 TARGET_DEVICES
+= dlink_dir-885l
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
252 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
255 TARGET_DEVICES
+= linksys_ea6300-v1
257 define Device
/linksys_ea6500-v2
258 DEVICE_VENDOR
:= Linksys
259 DEVICE_MODEL
:= EA6500
261 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
263 TARGET_DEVICES
+= linksys_ea6500-v2
265 define Device
/linksys_ea9200
266 DEVICE_VENDOR
:= Linksys
267 DEVICE_MODEL
:= EA9200
269 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
272 TARGET_DEVICES
+= linksys_ea9200
274 define Device
/linksys_ea9500
275 DEVICE_VENDOR
:= Linksys
276 DEVICE_MODEL
:= EA9500
277 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
278 DEVICE_DTS
:= bcm47094-linksys-panamera
281 TARGET_DEVICES
+= linksys_ea9500
284 DEVICE_VENDOR
:= Luxul
286 IMAGE
/lxl
:= append-ubi | trx-nand | luxul-lxl
289 define Device
/luxul_abr-4500
291 DEVICE_MODEL
:= ABR-4500
292 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
293 LUXUL_BOARD
:= ABR-4500
295 TARGET_DEVICES
+= luxul_abr-4500
297 define Device
/luxul_xap-1610
299 DEVICE_MODEL
:= XAP-1610
300 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
)
301 IMAGE
/lxl
:= append-rootfs | trx-serial | luxul-lxl
302 LUXUL_BOARD
:= XAP-1610
304 TARGET_DEVICES
+= luxul_xap-1610
306 define Device
/luxul_xbr-4500
308 DEVICE_MODEL
:= XBR-4500
309 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
310 LUXUL_BOARD
:= XBR-4500
312 TARGET_DEVICES
+= luxul_xbr-4500
314 define Device
/luxul_xwr-3150
316 DEVICE_MODEL
:= XWR-3150
317 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
318 DEVICE_DTS
:= bcm47094-luxul-xwr-3150-v1
319 LUXUL_BOARD
:= XWR-3150
321 TARGET_DEVICES
+= luxul_xwr-3150
323 define Device
/meraki_mr32
324 DEVICE_VENDOR
:= Meraki
326 DEVICE_PACKAGES
:= $(B43
) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
327 kmod-leds-pwm kmod-hwmon-ina2xx kmod-bluetooth
328 DEVICE_DTS
:= bcm53016-meraki-mr32
329 # Meraki FW r23 tries to resize the part.safe partition before it will
330 # flash the image. This is a bit of a problem, since resizing will fail
331 # if the partition is smaller than the old one.
332 KERNEL_LOADADDR
:= 0x00008000
333 KERNEL_INITRAMFS_SUFFIX
:= .bin
334 KERNEL_INITRAMFS
:= kernel-bin | fit none
$$(DTS_DIR
)/$$(DEVICE_DTS
).dtb | \
336 KERNEL
:= kernel-bin | fit none
$$(DTS_DIR
)/$$(DEVICE_DTS
).dtb
337 IMAGES
:= sysupgrade.bin
338 # Currently the only device that uses the new image check
339 IMAGE
/sysupgrade.bin
:= sysupgrade-tar | append-metadata
341 # The loader is specifically looking for fdt@2:
342 # [ 3.190000] find_itb_subimage: error finding fdt@2: FDT_ERR_NOTFOUND
343 # The image won't boot, if it isn't found. :(
346 TARGET_DEVICES
+= meraki_mr32
348 define Device
/netgear
349 DEVICE_VENDOR
:= NETGEAR
351 IMAGE
/chk
:= append-ubi | trx-nand | netgear-chk
355 define Device
/netgear_r6250
356 DEVICE_MODEL
:= R6250
357 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
359 NETGEAR_BOARD_ID
:= U12H245T00_NETGEAR
361 TARGET_DEVICES
+= netgear_r6250
363 define Device
/netgear_r6300-v2
364 DEVICE_MODEL
:= R6300
366 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
368 NETGEAR_BOARD_ID
:= U12H240T00_NETGEAR
370 TARGET_DEVICES
+= netgear_r6300-v2
372 define Device
/netgear_r7000
373 DEVICE_MODEL
:= R7000
374 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
376 NETGEAR_BOARD_ID
:= U12H270T00_NETGEAR
378 TARGET_DEVICES
+= netgear_r7000
380 define Device
/netgear_r7900
381 DEVICE_MODEL
:= R7900
382 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
384 NETGEAR_BOARD_ID
:= U12H315T30_NETGEAR
386 TARGET_DEVICES
+= netgear_r7900
388 define Device
/netgear_r8000
389 DEVICE_MODEL
:= R8000
390 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
392 NETGEAR_BOARD_ID
:= U12H315T00_NETGEAR
394 TARGET_DEVICES
+= netgear_r8000
396 define Device
/netgear_r8500
397 DEVICE_MODEL
:= R8500
398 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
400 NETGEAR_BOARD_ID
:= U12H334T00_NETGEAR
403 TARGET_DEVICES
+= netgear_r8500
405 define Device
/smartrg_sr400ac
406 DEVICE_VENDOR
:= SmartRG
407 DEVICE_MODEL
:= SR400ac
408 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
410 IMAGE
/trx
:= append-rootfs | trx-serial
411 KERNEL_INITRAMFS_SUFFIX
:= .bin
412 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | lzma-d16
414 TARGET_DEVICES
+= smartrg_sr400ac
416 define Device
/phicomm_k3
417 DEVICE_VENDOR
:= PHICOMM
419 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
422 TARGET_DEVICES
+= phicomm_k3
424 define Device
/tenda_ac9
425 DEVICE_VENDOR
:= Tenda
427 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
429 IMAGE
/trx
:= append-rootfs | trx-serial
431 TARGET_DEVICES
+= tenda_ac9
433 define Device
/tplink_archer-c5-v2
434 DEVICE_VENDOR
:= TP-Link
435 DEVICE_MODEL
:= Archer C5
437 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
439 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
440 TPLINK_BOARD
:= ARCHER-C5-V2
443 TARGET_DEVICES
+= tplink_archer-c5-v2
445 define Device
/tplink_archer-c9-v1
446 DEVICE_VENDOR
:= TP-Link
447 DEVICE_MODEL
:= Archer C9
449 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
451 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
452 TPLINK_BOARD
:= ARCHERC9
455 TARGET_DEVICES
+= tplink_archer-c9-v1
457 $(eval
$(call BuildImage
))