f5f2e6dbe60c035ef44d042b875c579d04634b3c
[openwrt/openwrt.git] / target / linux / ar71xx / image / Makefile
1 #
2 # Copyright (C) 2008-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 JFFS2_BLOCKSIZE = 64k 128k 256k
9
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/image.mk
12
13 IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default)
14
15 KERNEL_LOADADDR = 0x80060000
16
17 DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD_ID NETGEAR_HW_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS LOADER_TYPE
18
19 include ./tp-link.mk
20 include ./legacy.mk
21
22 define Build/netgear-squashfs
23 rm -rf $@.fs $@.squashfs
24 mkdir -p $@.fs/image
25 cp $@ $@.fs/image/uImage
26 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
27 $@.fs $@.squashfs \
28 -noappend -root-owned -be -b 65536 \
29 $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
30
31 dd if=/dev/zero bs=1k count=1 >> $@.squashfs
32 mkimage \
33 -A mips -O linux -T filesystem -C none \
34 -M $(NETGEAR_KERNEL_MAGIC) \
35 -a 0xbf070000 -e 0xbf070000 \
36 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
37 -d $@.squashfs $@
38 rm -rf $@.squashfs $@.fs
39 endef
40
41 define Build/netgear-uImage
42 $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
43 endef
44
45 define Build/loader-common
46 rm -rf $@.src
47 $(MAKE) -C lzma-loader \
48 PKG_BUILD_DIR="$@.src" \
49 TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
50 BOARD="$(BOARDNAME)" \
51 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
52 $(1) compile loader.$(LOADER_TYPE)
53 mv "$@.$(LOADER_TYPE)" "$@"
54 rm -rf $@.src
55 endef
56
57 define Build/loader-okli-compile
58 $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0 KERNEL_CMDLINE="$(CMDLINE)")
59 endef
60
61 define Build/loader-kernel
62 $(call Build/loader-common,LOADER_DATA="$@")
63 endef
64
65 define Build/loader-kernel-cmdline
66 $(call Build/loader-common,LOADER_DATA="$@" KERNEL_CMDLINE="$(CMDLINE)")
67 endef
68
69 define Build/loader-okli
70 dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
71 cat "$@" >> "$@.new"
72 mv "$@.new" "$@"
73 endef
74
75 define Build/copy-file
76 cat "$(1)" > "$@"
77 endef
78
79 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
80 # UBNT_TYPE e.g. one of (BZ, XM, XW)
81 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
82
83 # mkubntimage is using the kernel image direct
84 # routerboard creates partitions out of the ubnt header
85 define Build/mkubntimage
86 $(STAGING_DIR_HOST)/bin/mkfwimage \
87 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
88 -k $(word 1,$^) \
89 -r $@ \
90 -o $@
91 endef
92
93 # all UBNT XM device expect the kernel image to have 1024k while flash, when
94 # booting the image, the size doesn't matter.
95 define Build/mkubntimage-split
96 dd if=$@ of=$@.old1 bs=1024k count=1
97 dd if=$@ of=$@.old2 bs=1024k skip=1
98 $(STAGING_DIR_HOST)/bin/mkfwimage \
99 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
100 -k $@.old1 \
101 -r $@.old2 \
102 -o $@
103 rm $@.old1 $@.old2
104 endef
105
106 define Build/mkubntimage2
107 $(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
108 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
109 -p jffs2:0x50000:0xf60000:0:0:$@ \
110 -o $@.new
111 @mv $@.new $@
112 endef
113
114 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
115
116 define Device/Default
117 BOARDNAME :=
118 DEVICE_PROFILE = $$(BOARDNAME)
119 PROFILES = Default Minimal $$(DEVICE_PROFILE)
120 MTDPARTS :=
121 IMAGES := sysupgrade.bin
122 BLOCKSIZE := 64k
123 FILESYSTEMS = $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-$$(BLOCKSIZE)
124 CONSOLE = ttyS0,115200
125 CMDLINE = $$(if $$(BOARDNAME),board=$$(BOARDNAME)) $$(if $$(MTDPARTS),mtdparts=$$(MTDPARTS)) $$(if $$(CONSOLE),console=$$(CONSOLE))
126 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
127 COMPILE :=
128 IMAGES := sysupgrade.bin
129 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
130 endef
131
132 define Device/bsb
133 BOARDNAME = BSB
134 IMAGE_SIZE = 16000k
135 CONSOLE = ttyATH0,115200
136 MTDPARTS = spi0.0:128k(u-boot)ro,64k(u-boot-env)ro,16128k(firmware),64k(art)ro
137 endef
138 TARGET_DEVICES += bsb
139
140 define Device/carambola2
141 BOARDNAME = CARAMBOLA2
142 IMAGE_SIZE = 16000k
143 CONSOLE = ttyATH0,115200
144 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
145 endef
146 TARGET_DEVICES += carambola2
147
148 define Device/cf-e316n-v2
149 BOARDNAME = CF-E316N-V2
150 IMAGE_SIZE = 16192k
151 CONSOLE = ttyS0,115200
152 MTDPARTS = spi0.0:64k(u-boot)ro,64k(art)ro,16192k(firmware),64k(nvram)ro
153 endef
154 TARGET_DEVICES += cf-e316n-v2
155
156 define Device/weio
157 BOARDNAME = WEIO
158 IMAGE_SIZE = 16000k
159 CONSOLE = ttyATH0,115200
160 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
161 endef
162 TARGET_DEVICES += weio
163
164 define Device/gl-ar150
165 BOARDNAME = GL-AR150
166 IMAGE_SIZE = 16000k
167 CONSOLE = ttyATH0,115200
168 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
169 endef
170 TARGET_DEVICES += gl-ar150
171
172 define Device/gl-ar300
173 BOARDNAME = GL-AR300
174 IMAGE_SIZE = 16000k
175 CONSOLE = ttyS0,115200
176 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
177 endef
178 TARGET_DEVICES += gl-ar300
179
180 define Device/gl-domino
181 BOARDNAME = DOMINO
182 IMAGE_SIZE = 16000k
183 CONSOLE = ttyATH0,115200
184 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
185 endef
186 TARGET_DEVICES += gl-domino
187
188 define Device/wndr3700
189 BOARDNAME = WNDR3700
190 NETGEAR_KERNEL_MAGIC = 0x33373030
191 NETGEAR_BOARD_ID = WNDR3700
192 IMAGE_SIZE = 7680k
193 MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro
194 IMAGES := sysupgrade.bin factory.img factory-NA.img
195 KERNEL := kernel-bin | patch-cmdline | lzma -d20 | netgear-uImage lzma
196 IMAGE/default = append-kernel $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
197 IMAGE/sysupgrade.bin = $$(IMAGE/default) | check-size $$$$(IMAGE_SIZE)
198 IMAGE/factory.img = $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE)
199 IMAGE/factory-NA.img = $$(IMAGE/default) | netgear-dni NA | check-size $$$$(IMAGE_SIZE)
200 endef
201
202 define Device/wndr3700v2
203 $(Device/wndr3700)
204 NETGEAR_BOARD_ID = WNDR3700v2
205 NETGEAR_KERNEL_MAGIC = 0x33373031
206 NETGEAR_HW_ID = 29763654+16+64
207 IMAGE_SIZE = 15872k
208 MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro
209 IMAGES := sysupgrade.bin factory.img
210 endef
211
212 define Device/wndr3800
213 $(Device/wndr3700v2)
214 NETGEAR_BOARD_ID = WNDR3800
215 NETGEAR_HW_ID = 29763654+16+128
216 endef
217
218 define Device/wndr3800ch
219 $(Device/wndr3800)
220 NETGEAR_BOARD_ID = WNDR3800CH
221 endef
222
223 define Device/wndrmac
224 $(Device/wndr3700v2)
225 NETGEAR_BOARD_ID = WNDRMAC
226 endef
227
228 define Device/wndrmacv2
229 $(Device/wndr3800)
230 NETGEAR_BOARD_ID = WNDRMACv2
231 endef
232
233 TARGET_DEVICES += wndr3700 wndr3700v2 wndr3800 wndr3800ch wndrmac wndrmacv2
234
235 define Device/cap324
236 BOARDNAME := CAP324
237 DEVICE_PROFILE := CAP324
238 IMAGE_SIZE = 15296k
239 MTDPARTS = spi0.0:256k(u-boot),64k(u-boot-env)ro,15296k(firmware),640k(certs),64k(nvram),64k(art)
240 endef
241
242 TARGET_DEVICES += cap324
243
244 define Device/cap324-nocloud
245 BOARDNAME := CAP324
246 DEVICE_PROFILE := CAP324
247 IMAGE_SIZE = 16000k
248 MTDPARTS = spi0.0:256k(u-boot),64k(u-boot-env)ro,16000k(firmware),64k(art)
249 endef
250
251 TARGET_DEVICES += cap324-nocloud
252
253 define Device/cr3000
254 BOARDNAME := CR3000
255 DEVICE_PROFILE := CR3000
256 IMAGE_SIZE = 7104k
257 MTDPARTS = spi0.0:256k(u-boot),64k(u-boot-env)ro,7104k(firmware),640k(certs),64k(nvram),64k(art)
258 endef
259
260 TARGET_DEVICES += cr3000
261
262 define Device/cr3000-nocloud
263 BOARDNAME := CR3000
264 DEVICE_PROFILE := CR3000
265 IMAGE_SIZE = 7808k
266 MTDPARTS = spi0.0:256k(u-boot),64k(u-boot-env)ro,7808k(firmware),64k(art)
267 endef
268
269 TARGET_DEVICES += cr3000-nocloud
270
271 define Device/cr5000
272 BOARDNAME := CR5000
273 DEVICE_PROFILE := CR5000
274 IMAGE_SIZE = 7104k
275 MTDPARTS = spi0.0:256k(u-boot),64k(u-boot-env)ro,7104k(firmware),640k(certs),64k(nvram),64k(art)
276 endef
277
278 TARGET_DEVICES += cr5000
279
280 define Device/cr5000-nocloud
281 BOARDNAME := CR5000
282 DEVICE_PROFILE := CR5000
283 IMAGE_SIZE = 7808k
284 MTDPARTS = spi0.0:256k(u-boot),64k(u-boot-env)ro,7808k(firmware),64k(art)
285 endef
286
287 TARGET_DEVICES += cr5000-nocloud
288
289 define Device/antminer-s1
290 $(Device/tplink-8mlzma)
291 BOARDNAME := ANTMINER-S1
292 DEVICE_PROFILE := ANTMINERS1
293 TPLINK_HWID := 0x04440101
294 CONSOLE := ttyATH0,115200
295 endef
296
297 define Device/antminer-s3
298 $(Device/tplink-8mlzma)
299 BOARDNAME := ANTMINER-S3
300 DEVICE_PROFILE := ANTMINERS3
301 TPLINK_HWID := 0x04440301
302 CONSOLE := ttyATH0,115200
303 endef
304
305 define Device/antrouter-r1
306 $(Device/tplink-8mlzma)
307 BOARDNAME := ANTROUTER-R1
308 DEVICE_PROFILE := ANTROUTERR1
309 TPLINK_HWID := 0x44440101
310 CONSOLE := ttyATH0,115200
311 endef
312
313 define Device/el-m150
314 $(Device/tplink-8mlzma)
315 BOARDNAME := EL-M150
316 DEVICE_PROFILE := ELM150
317 TPLINK_HWID := 0x01500101
318 CONSOLE := ttyATH0,115200
319 endef
320
321 define Device/el-mini
322 $(Device/tplink-8mlzma)
323 BOARDNAME := EL-MINI
324 DEVICE_PROFILE := ELMINI
325 TPLINK_HWID := 0x01530001
326 CONSOLE := ttyATH0,115200
327 endef
328 TARGET_DEVICES += antminer-s1 antminer-s3 antrouter-r1 el-m150 el-mini
329
330 define Device/gl-inet-6408A-v1
331 $(Device/tplink-8mlzma)
332 BOARDNAME := GL-INET
333 DEVICE_PROFILE := GLINET
334 TPLINK_HWID := 0x08000001
335 CONSOLE := ttyATH0,115200
336 endef
337
338 define Device/gl-inet-6416A-v1
339 $(Device/tplink-16mlzma)
340 BOARDNAME := GL-INET
341 DEVICE_PROFILE := GLINET
342 TPLINK_HWID := 0x08000001
343 CONSOLE := ttyATH0,115200
344 endef
345 TARGET_DEVICES += gl-inet-6408A-v1 gl-inet-6416A-v1
346
347 define Device/rnx-n360rt
348 $(Device/tplink-4m)
349 BOARDNAME := TL-WR941ND
350 DEVICE_PROFILE := RNXN360RT
351 TPLINK_HWID := 0x09410002
352 TPLINK_HWREV := 0x00420001
353 endef
354 TARGET_DEVICES += rnx-n360rt
355
356 define Device/mc-mac1200r
357 $(Device/tplink-8mlzma)
358 BOARDNAME := MC-MAC1200R
359 DEVICE_PROFILE := MAC1200R
360 TPLINK_HWID := 0x12000001
361 endef
362 TARGET_DEVICES += mc-mac1200r
363
364 define Device/minibox-v1
365 $(Device/tplink-16mlzma)
366 BOARDNAME := MINIBOX-V1
367 DEVICE_PROFILE := MINIBOXV1
368 TPLINK_HWID := 0x3C000201
369 CONSOLE := ttyATH0,115200
370 endef
371 TARGET_DEVICES += minibox-v1
372
373 define Device/omy-g1
374 $(Device/tplink-16mlzma)
375 BOARDNAME := OMY-G1
376 DEVICE_PROFILE := OMYG1
377 TPLINK_HWID := 0x06660101
378 endef
379
380 define Device/omy-x1
381 $(Device/tplink-8mlzma)
382 BOARDNAME := OMY-X1
383 DEVICE_PROFILE := OMYX1
384 TPLINK_HWID := 0x06660201
385 endef
386 TARGET_DEVICES += omy-g1 omy-x1
387
388 define Device/onion-omega
389 $(Device/tplink-16mlzma)
390 BOARDNAME := ONION-OMEGA
391 DEVICE_PROFILE := OMEGA
392 TPLINK_HWID := 0x04700001
393 CONSOLE := ttyATH0,115200
394 endef
395 TARGET_DEVICES += onion-omega
396
397 define Device/smart-300
398 $(Device/tplink-8mlzma)
399 BOARDNAME := SMART-300
400 DEVICE_PROFILE := SMART-300
401 TPLINK_HWID := 0x93410001
402 endef
403 TARGET_DEVICES += smart-300
404
405 define Device/tellstick-znet-lite
406 $(Device/tplink-16mlzma)
407 BOARDNAME := TELLSTICK-ZNET-LITE
408 DEVICE_PROFILE := TELLSTICKZNETLITE
409 TPLINK_HWID := 0x00726001
410 CONSOLE := ttyATH0,115200
411 endef
412 TARGET_DEVICES += tellstick-znet-lite
413
414 define Device/oolite
415 $(Device/tplink-16mlzma)
416 BOARDNAME := GS-OOLITE
417 DEVICE_PROFILE := OOLITE
418 TPLINK_HWID := 0x3C000101
419 CONSOLE := ttyATH0,115200
420 endef
421 TARGET_DEVICES += oolite
422
423 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
424 # UBNT_TYPE e.g. one of (BZ, XM, XW)
425 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
426 define Device/ubnt-xm
427 DEVICE_PROFILE := UBNT
428 IMAGE_SIZE := 7552k
429 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
430 UBNT_TYPE := XM
431 UBNT_BOARD := XM
432 UBNT_CHIP := ar7240
433 IMAGES := sysupgrade.bin factory.bin
434 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
435 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
436 endef
437
438 define Device/ubnt-xw
439 DEVICE_PROFILE := UBNT
440 IMAGE_SIZE := 7552k
441 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
442 UBNT_TYPE := XW
443 UBNT_BOARD := XM
444 UBNT_CHIP := ar934x
445 IMAGES := sysupgrade.bin factory.bin
446 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
447 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
448 endef
449
450 define Device/ubnt-bz
451 DEVICE_PROFILE := UBNT
452 IMAGE_SIZE := 7552k
453 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
454 UBNT_TYPE := BZ
455 UBNT_BOARD := XM
456 UBNT_CHIP := ar934x
457 IMAGES := sysupgrade.bin factory.bin
458 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
459 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
460 endef
461
462 define Device/ubnt-unifiac
463 DEVICE_PROFILE := UBNT
464 IMAGE_SIZE := 7744k
465 MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
466 IMAGES := sysupgrade.bin
467 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
468 endef
469
470 define Device/rw2458n
471 $(Device/ubnt-xm)
472 BOARDNAME := RW2458N
473 endef
474
475 define Device/ubnt-airrouter
476 $(Device/ubnt-xm)
477 BOARDNAME := UBNT-AR
478 endef
479
480 define Device/ubnt-bullet-m
481 $(Device/ubnt-xm)
482 BOARDNAME := UBNT-BM
483 endef
484
485 define Device/ubnt-rocket-m
486 $(Device/ubnt-xm)
487 BOARDNAME := UBNT-RM
488 endef
489
490 define Device/ubnt-nano-m
491 $(Device/ubnt-xm)
492 BOARDNAME := UBNT-NM
493 endef
494 TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
495
496 define Device/ubnt-unifi
497 $(Device/ubnt-bz)
498 BOARDNAME := UBNT-UF
499 DEVICE_PROFILE := UBNT UBNTUNIFI
500 endef
501
502 define Device/ubnt-unifiac-lite
503 $(Device/ubnt-unifiac)
504 DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
505 BOARDNAME := UBNT-UF-AC-LITE
506 endef
507
508 define Device/ubnt-unifiac-pro
509 $(Device/ubnt-unifiac)
510 DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
511 BOARDNAME := UBNT-UF-AC-PRO
512 endef
513
514 define Device/ubnt-unifi-outdoor
515 $(Device/ubnt-bz)
516 BOARDNAME := UBNT-U20
517 DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
518 endef
519 TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-pro ubnt-unifi-outdoor
520
521 define Device/ubnt-nano-m-xw
522 $(Device/ubnt-xw)
523 BOARDNAME := UBNT-NM-XW
524 endef
525
526 define Device/ubnt-loco-m-xw
527 $(Device/ubnt-xw)
528 BOARDNAME := UBNT-LOCO-XW
529 endef
530
531 define Device/ubnt-rocket-m-xw
532 $(Device/ubnt-xw)
533 BOARDNAME := UBNT-RM-XW
534 endef
535
536 define Device/ubnt-rocket-m-ti
537 $(Device/ubnt-xw)
538 BOARDNAME := UBNT-RM-TI
539 UBNT_TYPE := TI
540 UBNT_BOARD := XM
541 endef
542 TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
543
544 define Device/ubnt-air-gateway
545 $(Device/ubnt-xm)
546 BOARDNAME := UBNT-AGW
547 UBNT_BOARD := XM
548 UBNT_TYPE := AirGW
549 UBNT_CHIP := ar933x
550 CONSOLE = ttyATH0,115200
551 endef
552 TARGET_DEVICES += ubnt-air-gateway
553
554 define Device/ubnt-air-gateway-pro
555 $(Device/ubnt-xm)
556 BOARDNAME := UBNT-AGWP
557 UBNT_TYPE := AirGWP
558 UBNT_CHIP := ar934x
559 CONSOLE = ttyS0,115200
560 endef
561 TARGET_DEVICES += ubnt-air-gateway-pro
562
563 define Device/ubdev01
564 $(Device/ubnt-xm)
565 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
566 BOARDNAME := UBNT-UF
567 UBNT_BOARD := UBDEV01
568 UBNT_TYPE := XM
569 UBNT_CHIP := ar7240
570 endef
571
572 TARGET_DEVICES += ubdev01
573
574 define Device/ubnt-routerstation
575 IMAGE_SIZE := 16128k
576 IMAGES := sysupgrade.bin factory.bin
577 IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
578 IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
579 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
580 endef
581
582 define Device/ubnt-rs
583 $(Device/ubnt-routerstation)
584 BOARDNAME := UBNT-RS
585 DEVICE_PROFILE := Madwifi UBNT UBNTRS
586 UBNT_BOARD := RS
587 UBNT_TYPE := RSx
588 UBNT_CHIP := ar7100
589 endef
590
591 define Device/ubnt-rspro
592 $(Device/ubnt-routerstation)
593 BOARDNAME := UBNT-RSPRO
594 DEVICE_PROFILE := Madwifi UBNT UBNTRSPRO
595 UBNT_BOARD := RSPRO
596 UBNT_TYPE := RSPRO
597 UBNT_CHIP := ar7100pro
598 endef
599
600 define Device/ubnt-ls-sr71
601 $(Device/ubnt-routerstation)
602 BOARDNAME := UBNT-LS-SR71
603 DEVICE_PROFILE := Madwifi UBNT
604 UBNT_BOARD := LS-SR71
605 UBNT_TYPE := LS-SR71
606 UBNT_CHIP := ar7100
607 endef
608
609 TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
610
611 define Device/ubnt-uap-pro
612 KERNEL_SIZE := 1536k
613 IMAGE_SIZE := 15744k
614 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
615 UBNT_TYPE := BZ
616 UBNT_CHIP := ar934x
617 BOARDNAME := UAP-PRO
618 DEVICE_PROFILE := UBNT UAPPRO
619 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
620 IMAGES := sysupgrade.bin factory.bin
621 IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
622 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
623 endef
624
625 define Device/ubnt-unifi-outdoor-plus
626 $(Device/ubnt-uap-pro)
627 UBNT_CHIP := ar7240
628 BOARDNAME := UBNT-UOP
629 DEVICE_PROFILE := UBNT
630 endef
631
632 TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus
633
634 define Device/NBG6616
635 BOARDNAME = NBG6616
636 KERNEL_SIZE = 2048k
637 IMAGE_SIZE = 15323k
638 MTDPARTS = spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware)
639 CMDLINE += mem=128M
640 IMAGES := sysupgrade.bin
641 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage
642 IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
643 # We cannot currently build a factory image. It is the sysupgrade image
644 # prefixed with a header (which is actually written into the MTD device).
645 # The header is 2kiB and is filled with 0xff. The format seems to be:
646 # 2 bytes: 0x0000
647 # 2 bytes: checksum of the data partition (big endian)
648 # 4 bytes: length of the contained image file (big endian)
649 # 32 bytes: Firmware Version string (NUL terminated, 0xff padded)
650 # 2 bytes: 0x0000
651 # 2 bytes: checksum over the header partition (big endian)
652 # 32 bytes: Model (e.g. "NBG6616", NUL termiated, 0xff padded)
653 # rest: 0xff padding
654 #
655 # The checksums are calculated by adding up all bytes and if a 16bit
656 # overflow occurs, one is added and the sum is masked to 16 bit:
657 # csum = csum + databyte; if (csum > 0xffff) { csum += 1; csum &= 0xffff };
658 # Should the file have an odd number of bytes then the byte len-0x800 is
659 # used additionally.
660 # The checksum for the header is calcualted over the first 2048 bytes with
661 # the firmware checksum as the placeholder during calculation.
662 #
663 # The header is padded with 0xff to the erase block size of the device.
664 endef
665
666 TARGET_DEVICES += NBG6616
667
668 ifeq ($(SUBTARGET),generic)
669 define Device/c-55
670 BOARDNAME = C-55
671 KERNEL_SIZE = 2048k
672 IMAGE_SIZE = 15872k
673 MTDPARTS = spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x60000(firmware)
674 IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
675 endef
676
677 TARGET_DEVICES += c-55
678
679 endif # ifeq ($(SUBTARGET),generic)
680
681 ifeq ($(SUBTARGET),nand)
682
683 define Build/MerakiNAND
684 -$(STAGING_DIR_HOST)/bin/mkmerakifw \
685 -B $(BOARDNAME) -s \
686 -i $@ \
687 -o $@.new
688 @mv $@.new $@
689 endef
690
691 define Device/mr18
692 BOARDNAME = MR18
693 BLOCKSIZE := 64k
694 CONSOLE = ttyS0,115200
695 MTDPARTS = ar934x-nfc:512k(nandloader)ro,8M(kernel),8M(recovery),113664k(ubi),128k@130944k(odm-caldata)ro
696 IMAGES := sysupgrade.tar
697 KERNEL := kernel-bin | patch-cmdline | MerakiNAND
698 KERNEL_INITRAMFS := kernel-bin | patch-cmdline | MerakiNAND
699 IMAGE/sysupgrade.tar := sysupgrade-nand
700 endef
701 TARGET_DEVICES += mr18
702
703 endif # ifeq ($(SUBTARGET),nand)
704
705 $(eval $(call BuildImage))