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
$(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
+= 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
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
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)
137 IMAGE
/trx
:= append-ubi | trx-nand
142 IMAGE
/trx
:= append-ubi | trx-nand | asus-trx
145 define Device
/asus-rt-ac56u
146 DEVICE_VENDOR
:= ASUS
147 DEVICE_MODEL
:= RT-AC56U
148 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
150 TARGET_DEVICES
+= asus-rt-ac56u
152 define Device
/asus-rt-ac68u
153 DEVICE_VENDOR
:= ASUS
154 DEVICE_MODEL
:= RT-AC68U
155 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
157 TARGET_DEVICES
+= asus-rt-ac68u
159 define Device
/asus-rt-ac87u
160 DEVICE_VENDOR
:= ASUS
161 DEVICE_MODEL
:= RT-AC87U
162 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
164 TARGET_DEVICES
+= asus-rt-ac87u
166 define Device
/asus-rt-n18u
167 DEVICE_VENDOR
:= ASUS
168 DEVICE_MODEL
:= RT-N18U
169 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
171 TARGET_DEVICES
+= asus-rt-n18u
173 # Buffalo devices have TFTP recovery mode which can work nicely with initramfs
175 # We should have two initramfs images for Buffalo: plain initramfs kernel and
176 # TRX with initramfs kernel. It's not possible right now so let's just build
177 # plain initramfs kernel as it may be more useful.
178 define Device
/buffalo
/Default
179 DEVICE_VENDOR
:= Buffalo
180 KERNEL_INITRAMFS_SUFFIX
= $$(KERNEL_SUFFIX
)
181 KERNEL_INITRAMFS
= $$(KERNEL
)
184 define Device
/buffalo-wxr-1900dhp
185 $(call Device
/buffalo
/Default
)
186 DEVICE_MODEL
:= WXR-1900DHP
187 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
189 TARGET_DEVICES
+= buffalo-wxr-1900dhp
191 define Device
/buffalo-wzr-600dhp2
192 $(call Device
/buffalo
/Default
)
193 DEVICE_MODEL
:= WZR-600DHP2
194 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
196 TARGET_DEVICES
+= buffalo-wzr-600dhp2
198 define Device
/buffalo-wzr-900dhp
199 $(call Device
/buffalo
/Default
)
200 DEVICE_MODEL
:= WZR-900DHP
201 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
202 BUFFALO_TAG_PLATFORM
:= bcm
203 BUFFALO_TAG_VERSION
:= 9.99
204 BUFFALO_TAG_MINOR
:= 9.99
205 IMAGES
+= factory-DHP-EU.bin factory-DHP2-JP.bin
206 IMAGE
/factory-DHP-EU.bin
:= \
207 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP EU | \
208 buffalo-enc WZR-900DHP
$$(BUFFALO_TAG_VERSION
) | \
209 buffalo-tag-dhp WZR-900DHP EU mlang20 | buffalo-enc-tag | \
211 IMAGE
/factory-DHP2-JP.bin
:= \
212 append-ubi | trx-nand | buffalo-wzr-header WZR-900DHP2 JP | \
213 buffalo-enc WZR-900DHP2
$$(BUFFALO_TAG_VERSION
) | \
214 buffalo-tag-dhp WZR-900DHP2 JP jp | buffalo-enc-tag | \
217 TARGET_DEVICES
+= buffalo-wzr-900dhp
219 define Device
/buffalo-wzr-1750dhp
220 $(call Device
/buffalo
/Default
)
221 DEVICE_MODEL
:= WZR-1750DHP
222 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
224 TARGET_DEVICES
+= buffalo-wzr-1750dhp
227 DEVICE_VENDOR
:= D-Link
229 IMAGE
/bin
:= append-ubi | seama-nand
232 define Device
/dlink-dir-885l
233 DEVICE_MODEL
:= DIR-885L
234 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
236 SIGNATURE
:= wrgac42_dlink
.2015_dir885l
238 TARGET_DEVICES
+= dlink-dir-885l
240 # Linksys devices are disabled due to problem with 2 TRX partitions
241 define Device
/linksys-ea6300-v1
242 DEVICE_VENDOR
:= Linksys
243 DEVICE_MODEL
:= EA6300
245 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
247 # TARGET_DEVICES += linksys-ea6300-v1
249 define Device
/linksys-ea6500-v2
250 DEVICE_VENDOR
:= Linksys
251 DEVICE_MODEL
:= EA6500
253 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
255 TARGET_DEVICES
+= linksys-ea6500-v2
257 define Device
/linksys-ea9200
258 DEVICE_VENDOR
:= Linksys
259 DEVICE_MODEL
:= EA9200
261 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
263 # TARGET_DEVICES += linksys-ea9200
265 define Device
/linksys-ea9500
266 DEVICE_VENDOR
:= Linksys
267 DEVICE_MODEL
:= EA9500
268 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
269 DEVICE_DTS
:= bcm47094-linksys-panamera
271 # TARGET_DEVICES += linksys-ea9500
274 DEVICE_VENDOR
:= Luxul
276 IMAGE
/lxl
:= append-ubi | trx-nand | luxul-lxl
279 define Device
/luxul-abr-4500
281 DEVICE_MODEL
:= ABR-4500
282 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
283 LUXUL_BOARD
:= ABR-4500
285 TARGET_DEVICES
+= luxul-abr-4500
287 define Device
/luxul-xbr-4500
289 DEVICE_MODEL
:= XBR-4500
290 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
291 LUXUL_BOARD
:= XBR-4500
293 TARGET_DEVICES
+= luxul-xbr-4500
295 define Device
/netgear
296 DEVICE_VENDOR
:= NETGEAR
298 IMAGE
/chk
:= append-ubi | trx-nand | netgear-chk
302 define Device
/netgear-r6250
303 DEVICE_MODEL
:= R6250
304 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
306 NETGEAR_BOARD_ID
:= U12H245T00_NETGEAR
308 TARGET_DEVICES
+= netgear-r6250
310 define Device
/netgear-r6300-v2
311 DEVICE_MODEL
:= R6300
313 DEVICE_PACKAGES
:= $(B43
) $(USB3_PACKAGES
)
315 NETGEAR_BOARD_ID
:= U12H240T00_NETGEAR
317 TARGET_DEVICES
+= netgear-r6300-v2
319 define Device
/netgear-r7000
320 DEVICE_MODEL
:= R7000
321 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
323 NETGEAR_BOARD_ID
:= U12H270T00_NETGEAR
325 TARGET_DEVICES
+= netgear-r7000
327 define Device
/netgear-r7900
328 DEVICE_MODEL
:= R7900
329 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
331 NETGEAR_BOARD_ID
:= U12H315T30_NETGEAR
333 TARGET_DEVICES
+= netgear-r7900
335 define Device
/netgear-r8000
336 DEVICE_MODEL
:= R8000
337 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
339 NETGEAR_BOARD_ID
:= U12H315T00_NETGEAR
341 TARGET_DEVICES
+= netgear-r8000
343 define Device
/netgear-r8500
344 DEVICE_MODEL
:= R8500
345 DEVICE_PACKAGES
:= $(BRCMFMAC_4366B1
) $(USB3_PACKAGES
)
347 NETGEAR_BOARD_ID
:= U12H334T00_NETGEAR
349 # TARGET_DEVICES += netgear-r8500
351 define Device
/smartrg-sr400ac
352 DEVICE_VENDOR
:= SmartRG
353 DEVICE_MODEL
:= SR400ac
354 DEVICE_PACKAGES
:= $(BRCMFMAC_43602A1
) $(USB3_PACKAGES
)
356 IMAGE
/trx
:= append-rootfs | trx-serial
357 KERNEL_INITRAMFS_SUFFIX
:= .bin
358 KERNEL_INITRAMFS
:= kernel-bin | append-dtb | lzma-d16
360 TARGET_DEVICES
+= smartrg-sr400ac
362 define Device
/phicomm-k3
363 DEVICE_VENDOR
:= PHICOMM
365 DEVICE_PACKAGES
:= $(BRCMFMAC_4366C0
) $(USB3_PACKAGES
)
368 TARGET_DEVICES
+= phicomm-k3
370 define Device
/tenda-ac9
371 DEVICE_VENDOR
:= Tenda
373 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
375 IMAGE
/trx
:= append-rootfs | trx-serial
377 TARGET_DEVICES
+= tenda-ac9
379 define Device
/tplink-archer-c5-v2
380 DEVICE_VENDOR
:= TP-LINK
381 DEVICE_MODEL
:= Archer C5
383 DEVICE_PACKAGES
:= $(B43
) $(USB2_PACKAGES
)
385 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
386 TPLINK_BOARD
:= ARCHER-C5-V2
388 #TARGET_DEVICES += tplink-archer-c5-v2
390 define Device
/tplink-archer-c9-v1
391 DEVICE_VENDOR
:= TP-LINK
392 DEVICE_MODEL
:= Archer C9
394 DEVICE_PACKAGES
:= $(USB3_PACKAGES
)
396 IMAGE
/bin
:= append-rootfs | bcm53xx-tplink-safeloader
397 TPLINK_BOARD
:= ARCHERC9
399 #TARGET_DEVICES += tplink-archer-c9-v1
401 $(eval
$(call BuildImage
))