0e46194e751161ec079a447bdb6e4f857cdbf3e9
[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 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default)
11
12 JFFS2_BLOCKSIZE = 64k 128k 256k
13
14 KERNEL_LOADADDR = 0x80060000
15
16 DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD NETGEAR_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS
17
18 define Build/netgear-squashfs
19 rm -rf $@.fs $@.squashfs
20 mkdir -p $@.fs/image
21 cp $@ $@.fs/image/uImage
22 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
23 $@.fs $@.squashfs \
24 -noappend -root-owned -be -b 65536
25 dd if=/dev/zero bs=1k count=1 >> $@.squashfs
26 mkimage \
27 -A mips -O linux -T filesystem -C none \
28 -M $(NETGEAR_KERNEL_MAGIC) \
29 -a 0xbf070000 -e 0xbf070000 \
30 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
31 -d $@.squashfs $@
32 rm -rf $@.squashfs $@.fs
33 endef
34
35 define Build/netgear-uImage
36 $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
37 endef
38
39 define Build/netgear-image
40 $(STAGING_DIR_HOST)/bin/mkdniimg \
41 -B $(NETGEAR_BOARD) -v OpenWrt.$(REVISION) \
42 $(if $(NETGEAR_ID),-H $(NETGEAR_ID)) \
43 -r "$(1)" \
44 -i $@ -o $@.new
45 mv $@.new $@
46 endef
47
48 # combine kernel and rootfs into one image
49 # -a align the rootfs start on an <align> bytes boundary
50 # -j add jffs2 end-of-filesystem markers
51 # -s strip padding from end of the image
52 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
53 define Build/mktplinkfw
54 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
55 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
56 -k $(word 1,$^) \
57 -r $@ \
58 -o $@.new \
59 -j -X 0x40000 \
60 -a $(call rootfs_align,$(FILESYSTEM)) \
61 $(if $(findstring sysupgrade,$1),-s) && mv $@.new $@ || rm -f $@
62 endef
63
64 # -c combined image
65 define Build/mktplinkfw-initramfs
66 $(STAGING_DIR_HOST)/bin/mktplinkfw \
67 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
68 -k $@ \
69 -o $@.new \
70 -s -S \
71 -c
72 @mv $@.new $@
73 endef
74
75 define Build/loader-common
76 rm -rf $@.src
77 $(MAKE) -C lzma-loader \
78 PKG_BUILD_DIR="$@.src" \
79 TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
80 KERNEL_CMDLINE="$(CMDLINE)" BOARD="$(BOARDNAME)" \
81 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
82 $(1) compile loader.gz
83 mv "$@.gz" "$@"
84 rm -rf $@.src
85 endef
86
87 define Build/loader-okli-compile
88 $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
89 endef
90
91 define Build/loader-kernel
92 $(call Build/loader-common,LOADER_DATA="$@")
93 endef
94
95 define Build/loader-okli
96 dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
97 cat "$@" >> "$@.new"
98 mv "$@.new" "$@"
99 endef
100
101 define Build/copy-file
102 cat "$(1)" > "$@"
103 endef
104
105 DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT
106
107 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
108 # UBNT_TYPE e.g. one of (BZ, XM, XW)
109 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
110
111 # mkubntimage is using the kernel image direct
112 # routerboard creates partitions out of the ubnt header
113 define Build/mkubntimage
114 $(STAGING_DIR_HOST)/bin/mkfwimage \
115 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
116 -k $(word 1,$^) \
117 -r $@ \
118 -o $@
119 endef
120
121 # all UBNT XM device expect the kernel image to have 1024k while flash, when
122 # booting the image, the size doesn't matter.
123 define Build/mkubntimage-split
124 dd if=$@ of=$@.old1 bs=1024k count=1
125 dd if=$@ of=$@.old2 bs=1024k skip=1
126 $(STAGING_DIR_HOST)/bin/mkfwimage \
127 -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
128 -k $@.old1 \
129 -r $@.old2 \
130 -o $@
131 rm $@.old1 $@.old2
132 endef
133
134 define Build/mkubntimage2
135 $(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
136 -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
137 -p jffs2:0x50000:0xf60000:0:0:$@ \
138 -o $@.new
139 @mv $@.new $@
140 endef
141
142 DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
143
144 define Build/mkubntkernelimage
145 rm -rf $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image && \
146 mkdir -p $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image && \
147 cp $@ $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image/kernel0 && \
148 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
149 --pad --big-endian --squash-uids -v -e 64KiB \
150 -o $@.new \
151 -d $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image \
152 2>&1 && \
153 $(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J 64
154 -rm -rf $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image
155 @mv $@.new $@
156 endef
157
158 define Device/Default
159 BOARDNAME :=
160 DEVICE_PROFILE = $$(BOARDNAME)
161 PROFILES = Default Minimal $$(DEVICE_PROFILE)
162 MTDPARTS :=
163 IMAGES := sysupgrade.bin
164 BLOCKSIZE := 64k
165 FILESYSTEMS = $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-$$(BLOCKSIZE)
166 CONSOLE = ttyS0,115200
167 CMDLINE = $$(if $$(BOARDNAME),board=$$(BOARDNAME)) $$(if $$(MTDPARTS),mtdparts=$$(MTDPARTS)) $$(if $$(CONSOLE),console=$$(CONSOLE))
168 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
169 COMPILE :=
170 IMAGES := sysupgrade.bin
171 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
172 endef
173
174 define Device/carambola2
175 BOARDNAME = CARAMBOLA2
176 IMAGE_SIZE = 16000k
177 CONSOLE = ttyATH0,115200
178 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
179 endef
180 TARGET_DEVICES += carambola2
181
182 define Device/wndr3700
183 BOARDNAME = WNDR3700
184 NETGEAR_KERNEL_MAGIC = 0x33373030
185 NETGEAR_BOARD = WNDR3700
186 IMAGE_SIZE = 7680k
187 MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro
188 IMAGES := sysupgrade.bin factory.img factory-NA.img
189 KERNEL := kernel-bin | patch-cmdline | lzma -d20 | netgear-uImage lzma
190 IMAGE/default = append-kernel $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
191 IMAGE/sysupgrade.bin = $$(IMAGE/default) | check-size $$$$(IMAGE_SIZE)
192 IMAGE/factory.img = $$(IMAGE/default) | netgear-image | check-size $$$$(IMAGE_SIZE)
193 IMAGE/factory-NA.img = $$(IMAGE/default) | netgear-image NA | check-size $$$$(IMAGE_SIZE)
194 endef
195
196 define Device/wndr3700v2
197 $(Device/wndr3700)
198 NETGEAR_BOARD = WNDR3700v2
199 NETGEAR_KERNEL_MAGIC = 0x33373031
200 NETGEAR_ID = 29763654+16+64
201 IMAGE_SIZE = 15872k
202 MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro
203 IMAGES := sysupgrade.bin factory.img
204 endef
205
206 define Device/wndr3800
207 $(Device/wndr3700v2)
208 NETGEAR_BOARD = WNDR3800
209 NETGEAR_ID = 29763654+16+128
210 endef
211
212 define Device/wndr3800ch
213 $(Device/wndr3800)
214 NETGEAR_BOARD = WNDR3800CH
215 endef
216
217 define Device/wndrmac
218 $(Device/wndr3700v2)
219 NETGEAR_BOARD = WNDRMAC
220 endef
221
222 define Device/wndrmacv2
223 $(Device/wndr3800)
224 NETGEAR_BOARD = WNDRMACv2
225 endef
226
227 TARGET_DEVICES += wndr3700 wndr3700v2 wndr3800 wndr3800ch wndrmac wndrmacv2
228
229 define Device/tplink
230 TPLINK_HWREV := 0x1
231 KERNEL := kernel-bin | patch-cmdline | lzma
232 KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-initramfs
233 IMAGES := sysupgrade.bin factory.bin
234 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
235 IMAGE/factory.bin := append-rootfs | mktplinkfw factory
236 endef
237
238 define Device/tplink-nolzma
239 $(Device/tplink)
240 LOADER_FLASH_OFFS := 0x22000
241 COMPILE := loader-$(1).gz
242 COMPILE/loader-$(1).gz := loader-okli-compile
243 KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1)
244 KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel | mktplinkfw-initramfs
245 endef
246
247 define Device/tplink-4m
248 $(Device/tplink-nolzma)
249 TPLINK_FLASHLAYOUT := 4M
250 IMAGE_SIZE := 3904k
251 endef
252
253 define Device/tplink-8m
254 $(Device/tplink-nolzma)
255 TPLINK_FLASHLAYOUT := 8M
256 IMAGE_SIZE := 7936k
257 endef
258
259 define Device/tplink-4mlzma
260 $(Device/tplink)
261 TPLINK_FLASHLAYOUT := 4Mlzma
262 IMAGE_SIZE := 3904k
263 endef
264
265 define Device/tplink-8mlzma
266 $(Device/tplink)
267 TPLINK_FLASHLAYOUT := 8Mlzma
268 IMAGE_SIZE := 7936k
269 endef
270
271 define Device/tplink-16mlzma
272 $(Device/tplink)
273 TPLINK_FLASHLAYOUT := 16Mlzma
274 IMAGE_SIZE := 15872k
275 endef
276
277 define Device/tl-wdr4300-v1
278 $(Device/tplink-8mlzma)
279 BOARDNAME = TL-WDR4300
280 DEVICE_PROFILE = TLWDR4300
281 TPLINK_HWID := 0x43000001
282 endef
283
284 define Device/tl-wdr3500-v1
285 $(Device/tl-wdr4300-v1)
286 BOARDNAME = TL-WDR3500
287 TPLINK_HWID := 0x35000001
288 endef
289
290 define Device/tl-wdr3600-v1
291 $(Device/tl-wdr4300-v1)
292 TPLINK_HWID := 0x36000001
293 endef
294
295 define Device/tl-wdr4300-v1-il
296 $(Device/tl-wdr4300-v1)
297 TPLINK_HWID := 0x43008001
298 endef
299
300 define Device/tl-wdr4310-v1
301 $(Device/tl-wdr4300-v1)
302 TPLINK_HWID := 0x43100001
303 endef
304
305 define Device/mw4530r-v1
306 $(Device/tl-wdr4300-v1)
307 TPLINK_HWID := 0x45300001
308 endef
309 TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1
310
311 define Device/archer-c5
312 $(Device/tplink-16mlzma)
313 BOARDNAME := ARCHER-C5
314 DEVICE_PROFILE := ARCHERC7
315 TPLINK_HWID := 0xc5000001
316 endef
317
318 define Device/archer-c7-v1
319 $(Device/tplink-8mlzma)
320 BOARDNAME := ARCHER-C7
321 DEVICE_PROFILE := ARCHERC7
322 TPLINK_HWID := 0x75000001
323 endef
324
325 define Device/archer-c7-v2
326 $(Device/tplink-16mlzma)
327 BOARDNAME := ARCHER-C7
328 DEVICE_PROFILE := ARCHERC7
329 TPLINK_HWID := 0xc7000002
330 endef
331 TARGET_DEVICES += archer-c5 archer-c7-v1 archer-c7-v2
332
333 define Device/el-m150
334 $(Device/tplink-8mlzma)
335 BOARDNAME := EL-M150
336 DEVICE_PROFILE := ELM150
337 TPLINK_HWID := 0x01500101
338 CONSOLE := ttyATH0,115200
339 endef
340
341 define Device/el-mini
342 $(Device/tplink-8mlzma)
343 BOARDNAME := EL-MINI
344 DEVICE_PROFILE := ELMINI
345 TPLINK_HWID := 0x01530001
346 CONSOLE := ttyATH0,115200
347 endef
348 TARGET_DEVICES += el-m150 el-mini
349
350 define Device/gl-inet-6408A-v1
351 $(Device/tplink-8mlzma)
352 BOARDNAME := GL-INET
353 DEVICE_PROFILE := GLINET
354 TPLINK_HWID := 0x08000001
355 CONSOLE := ttyATH0,115200
356 endef
357
358 define Device/gl-inet-6416A-v1
359 $(Device/tplink-16mlzma)
360 BOARDNAME := GL-INET
361 DEVICE_PROFILE := GLINET
362 TPLINK_HWID := 0x08000001
363 CONSOLE := ttyATH0,115200
364 endef
365 TARGET_DEVICES += gl-inet-6408A-v1 gl-inet-6416A-v1
366
367 define Device/mc-mac1200r
368 $(Device/tplink-8mlzma)
369 BOARDNAME := MC-MAC1200R
370 DEVICE_PROFILE := MAC1200R
371 TPLINK_HWID := 0x12000001
372 endef
373 TARGET_DEVICES += mc-mac1200r
374
375 define Device/tl-mr10u-v1
376 $(Device/tplink-4mlzma)
377 BOARDNAME := TL-MR10U
378 DEVICE_PROFILE := TLMR10U
379 TPLINK_HWID := 0x00100101
380 CONSOLE := ttyATH0,115200
381 endef
382
383 define Device/tl-mr11u-v1
384 $(Device/tplink-4mlzma)
385 BOARDNAME := TL-MR11U
386 DEVICE_PROFILE := TLMR11U
387 TPLINK_HWID := 0x00110101
388 CONSOLE := ttyATH0,115200
389 endef
390
391 define Device/tl-mr11u-v2
392 $(Device/tplink-4mlzma)
393 BOARDNAME := TL-MR11U
394 DEVICE_PROFILE := TLMR11U
395 TPLINK_HWID := 0x00110102
396 CONSOLE := ttyATH0,115200
397 endef
398
399 define Device/tl-mr12u-v1
400 $(Device/tplink-4mlzma)
401 BOARDNAME := TL-MR13U
402 DEVICE_PROFILE := TLMR12U
403 TPLINK_HWID := 0x00120101
404 CONSOLE := ttyATH0,115200
405 endef
406
407 define Device/tl-mr13u-v1
408 $(Device/tplink-4mlzma)
409 BOARDNAME := TL-MR13U
410 DEVICE_PROFILE := TLMR13U
411 TPLINK_HWID := 0x00130101
412 CONSOLE := ttyATH0,115200
413 endef
414 TARGET_DEVICES += tl-mr10u-v1 tl-mr11u-v1 tl-mr11u-v2 tl-mr12u-v1 tl-mr13u-v1
415
416 define Device/tl-mr3020-v1
417 $(Device/tplink-4mlzma)
418 BOARDNAME := TL-MR3020
419 DEVICE_PROFILE := TLMR3020
420 TPLINK_HWID := 0x30200001
421 CONSOLE := ttyATH0,115200
422 endef
423
424 define Device/tl-mr3040-v1
425 $(Device/tplink-4mlzma)
426 BOARDNAME := TL-MR3040
427 DEVICE_PROFILE := TLMR3040
428 TPLINK_HWID := 0x30400001
429 CONSOLE := ttyATH0,115200
430 endef
431
432 define Device/tl-mr3040-v2
433 $(Device/tplink-4mlzma)
434 BOARDNAME := TL-MR3040-v2
435 DEVICE_PROFILE := TLMR3040
436 TPLINK_HWID := 0x30400002
437 CONSOLE := ttyATH0,115200
438 endef
439
440 define Device/tl-mr3220-v2
441 $(Device/tplink-4mlzma)
442 BOARDNAME := TL-MR3220-v2
443 DEVICE_PROFILE := TLMR3220V2
444 TPLINK_HWID := 0x32200002
445 CONSOLE := ttyATH0,115200
446 endef
447
448 define Device/tl-mr3420-v2
449 $(Device/tplink-4mlzma)
450 BOARDNAME := TL-MR3420-v2
451 DEVICE_PROFILE := TLMR3420
452 TPLINK_HWID := 0x34200002
453 endef
454 TARGET_DEVICES += tl-mr3020-v1 tl-mr3040-v1 tl-mr3040-v2 tl-mr3220-v2 tl-mr3420-v2
455
456 define Device/tl-wr703n-v1
457 $(Device/tplink-4mlzma)
458 BOARDNAME := TL-WR703N
459 DEVICE_PROFILE := TLWR703
460 TPLINK_HWID := 0x07030101
461 CONSOLE := ttyATH0,115200
462 endef
463
464 define Device/tl-wr710n-v1
465 $(Device/tplink-8mlzma)
466 BOARDNAME := TL-WR710N
467 DEVICE_PROFILE := TLWR710
468 TPLINK_HWID := 0x07100001
469 CONSOLE := ttyATH0,115200
470 endef
471
472 define Device/tl-wr710n-v2
473 $(Device/tplink-4mlzma)
474 BOARDNAME := TL-WR710N
475 DEVICE_PROFILE := TLWR710
476 TPLINK_HWID := 0x07100002
477 CONSOLE := ttyATH0,115200
478 endef
479
480 define Device/tl-wr720n-v3
481 $(Device/tplink-4mlzma)
482 BOARDNAME := TL-WR720N-v3
483 DEVICE_PROFILE := TLWR720
484 TPLINK_HWID := 0x07200103
485 CONSOLE := ttyATH0,115200
486 endef
487 TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3
488
489 define Device/tl-wr740n-v4
490 $(Device/tplink-4mlzma)
491 BOARDNAME := TL-WR741ND-v4
492 DEVICE_PROFILE := TLWR740
493 TPLINK_HWID := 0x07400004
494 CONSOLE := ttyATH0,115200
495 endef
496
497 define Device/tl-wr741nd-v1
498 $(Device/tplink-4m)
499 BOARDNAME := TL-WR741ND
500 DEVICE_PROFILE := TLWR741
501 TPLINK_HWID := 0x07410001
502 endef
503
504 define Device/tl-wr741nd-v2
505 $(Device/tplink-4m)
506 BOARDNAME := TL-WR741ND
507 DEVICE_PROFILE := TLWR741
508 TPLINK_HWID := 0x07410001
509 endef
510
511 define Device/tl-wr741nd-v4
512 $(Device/tplink-4mlzma)
513 BOARDNAME := TL-WR741ND-v4
514 DEVICE_PROFILE := TLWR741
515 TPLINK_HWID := 0x07410004
516 CONSOLE := ttyATH0,115200
517 endef
518
519 define Device/tl-wr743nd-v2
520 $(Device/tplink-4mlzma)
521 BOARDNAME := TL-WR741ND-v4
522 DEVICE_PROFILE := TLWR743
523 TPLINK_HWID := 0x07430002
524 CONSOLE := ttyATH0,115200
525 endef
526 TARGET_DEVICES += tl-wr740n-v4 tl-wr741nd-v1 tl-wr741nd-v2 tl-wr741nd-v4 tl-wr743nd-v2
527
528 define Device/tl-wr841n-v8
529 $(Device/tplink-4mlzma)
530 BOARDNAME := TL-WR841N-v8
531 DEVICE_PROFILE := TLWR841
532 TPLINK_HWID := 0x08410008
533 endef
534
535 define Device/tl-wr841n-v9
536 $(Device/tplink-4mlzma)
537 BOARDNAME := TL-WR841N-v9
538 DEVICE_PROFILE := TLWR841
539 TPLINK_HWID := 0x08410009
540 endef
541
542 define Device/tl-wr842n-v2
543 $(Device/tplink-8mlzma)
544 BOARDNAME := TL-WR842N-v2
545 DEVICE_PROFILE := TLWR842
546 TPLINK_HWID := 0x8420002
547 endef
548
549 define Device/tl-wr843nd-v1
550 $(Device/tplink-4mlzma)
551 BOARDNAME := TL-WR841N-v8
552 DEVICE_PROFILE := TLWR843
553 TPLINK_HWID := 0x08430001
554 endef
555
556 define Device/tl-wr847n-v8
557 $(Device/tplink-4mlzma)
558 BOARDNAME := TL-WR841N-v8
559 DEVICE_PROFILE := TLWR841
560 TPLINK_HWID := 0x08470008
561 endef
562 TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
563
564 define Device/tl-wr941nd-v5
565 $(Device/tplink-4mlzma)
566 BOARDNAME := TL-WR941ND-v5
567 DEVICE_PROFILE := TLWR941
568 TPLINK_HWID := 0x09410005
569 endef
570
571 define Device/tl-wr941nd-v6
572 $(Device/tplink-4mlzma)
573 BOARDNAME := TL-WDR3500
574 DEVICE_PROFILE := TLWR941
575 TPLINK_HWID := 0x09410006
576 endef
577 TARGET_DEVICES += tl-wr941nd-v5 tl-wr941nd-v6
578
579 define Device/tl-wr1041n-v2
580 $(Device/tplink-4mlzma)
581 BOARDNAME := TL-WR1041N-v2
582 DEVICE_PROFILE := TLWR1041
583 TPLINK_HWID := 0x10410002
584 endef
585 TARGET_DEVICES += tl-wr1041n-v2
586
587 define Device/tl-wdr4900-v2
588 $(Device/tplink-8mlzma)
589 BOARDNAME := TL-WDR4900-v2
590 DEVICE_PROFILE := TLWDR4900V2
591 TPLINK_HWID := 0x49000002
592 endef
593 TARGET_DEVICES += tl-wdr4900-v2
594
595 define Device/tl-wa701nd-v2
596 $(Device/tplink-4mlzma)
597 BOARDNAME := TL-WA701ND-v2
598 DEVICE_PROFILE := TLWA701
599 TPLINK_HWID := 0x07010002
600 CONSOLE := ttyATH0,115200
601 endef
602
603 define Device/tl-wa750re-v1
604 $(Device/tplink-4mlzma)
605 BOARDNAME := TL-WA750RE
606 DEVICE_PROFILE := TLWA750
607 TPLINK_HWID := 0x07500001
608 endef
609 TARGET_DEVICES += tl-wa701nd-v2 tl-wa750re-v1
610
611 define Device/tl-wa801nd-v2
612 $(Device/tplink-4mlzma)
613 BOARDNAME := TL-WA801ND-v2
614 DEVICE_PROFILE := TLWA801
615 TPLINK_HWID := 0x08010002
616 endef
617
618 define Device/tl-wa830re-v2
619 $(Device/tplink-4mlzma)
620 BOARDNAME := TL-WA830RE-v2
621 DEVICE_PROFILE := TLWA830
622 TPLINK_HWID := 0x08300002
623 endef
624
625 define Device/tl-wa850re-v1
626 $(Device/tplink-4mlzma)
627 BOARDNAME := TL-WA850RE
628 DEVICE_PROFILE := TLWA850
629 TPLINK_HWID := 0x08500001
630 endef
631
632 define Device/tl-wa860re-v1
633 $(Device/tplink-4mlzma)
634 BOARDNAME := TL-WA860RE
635 DEVICE_PROFILE := TLWA860
636 TPLINK_HWID := 0x08600001
637 endef
638 TARGET_DEVICES += tl-wa801nd-v2 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
639
640 define Device/tl-wa901nd-v3
641 $(Device/tplink-4mlzma)
642 BOARDNAME := TL-WA901ND-v3
643 DEVICE_PROFILE := TLWA901
644 TPLINK_HWID := 0x09010003
645 endef
646 TARGET_DEVICES += tl-wa901nd-v3
647
648 define Device/tl-wa7210n-v2
649 $(Device/tplink-4mlzma)
650 BOARDNAME := TL-WA7210N-v2
651 DEVICE_PROFILE := TLWA7210
652 TPLINK_HWID := 0x72100002
653 CONSOLE := ttyATH0,115200
654 endef
655 TARGET_DEVICES += tl-wa7210n-v2
656
657 define Device/smart-300
658 $(Device/tplink-8mlzma)
659 BOARDNAME := SMART-300
660 DEVICE_PROFILE := SMART-300
661 TPLINK_HWID := 0x93410001
662 endef
663 TARGET_DEVICES += smart-300
664
665 define Device/oolite
666 $(Device/tplink-16mlzma)
667 BOARDNAME := GS-OOLITE
668 DEVICE_PROFILE := OOLITE
669 TPLINK_HWID := 0x3C000101
670 CONSOLE := ttyATH0,115200
671 endef
672 TARGET_DEVICES += oolite
673
674 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
675 # UBNT_TYPE e.g. one of (BZ, XM, XW)
676 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
677 define Device/ubnt-xm
678 DEVICE_PROFILE := UBNT
679 IMAGE_SIZE := 7552k
680 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
681 UBNT_TYPE := XM
682 UBNT_BOARD := XM
683 UBNT_CHIP := ar7240
684 IMAGES := sysupgrade.bin factory.bin
685 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
686 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
687 endef
688
689 define Device/ubnt-xw
690 DEVICE_PROFILE := UBNT
691 IMAGE_SIZE := 7552k
692 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
693 UBNT_TYPE := XW
694 UBNT_BOARD := XM
695 UBNT_CHIP := ar934x
696 IMAGES := sysupgrade.bin factory.bin
697 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
698 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
699 endef
700
701 define Device/ubnt-bz
702 DEVICE_PROFILE := UBNT
703 IMAGE_SIZE := 7552k
704 MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
705 UBNT_TYPE := BZ
706 UBNT_BOARD := XM
707 UBNT_CHIP := ar934x
708 IMAGES := sysupgrade.bin factory.bin
709 IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
710 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
711 endef
712
713 define Device/rw2458n
714 $(Device/ubnt-xm)
715 BOARDNAME := RW2458N
716 endef
717
718 define Device/ubnt-airrouter
719 $(Device/ubnt-xm)
720 BOARDNAME := UBNT-AR
721 endef
722
723 define Device/ubnt-bullet-m
724 $(Device/ubnt-xm)
725 BOARDNAME := UBNT-BM
726 endef
727
728 define Device/ubnt-rocket-m
729 $(Device/ubnt-xm)
730 BOARDNAME := UBNT-RM
731 endef
732
733 define Device/ubnt-nano-m
734 $(Device/ubnt-xm)
735 BOARDNAME := UBNT-NM
736 endef
737 TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
738
739 define Device/ubnt-unifi
740 $(Device/ubnt-bz)
741 BOARDNAME := UBNT-UF
742 DEVICE_PROFILE := UBNT UBNTUNIFI
743 endef
744
745 define Device/ubnt-unifi-outdoor
746 $(Device/ubnt-bz)
747 BOARDNAME := UBNT-U20
748 DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
749 endef
750 TARGET_DEVICES += ubnt-unifi ubnt-unifi-outdoor
751
752 define Device/ubnt-nano-m-xw
753 $(Device/ubnt-xw)
754 BOARDNAME := UBNT-NM-XW
755 endef
756
757 define Device/ubnt-loco-m-xw
758 $(Device/ubnt-xw)
759 BOARDNAME := UBNT-LOCO-XW
760 endef
761
762 define Device/ubnt-rocket-m-xw
763 $(Device/ubnt-xw)
764 BOARDNAME := UBNT-RM-XW
765 endef
766 TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw
767
768 define Device/ubnt-air-gateway
769 $(Device/ubnt-xm)
770 BOARDNAME := UBNT-AGW
771 UBNT_BOARD := XM
772 UBNT_TYPE := AirGW
773 UBNT_CHIP := ar933x
774 CONSOLE = ttyATH0,115200
775 endef
776 TARGET_DEVICES += ubnt-air-gateway
777
778 define Device/ubdev01
779 $(Device/ubnt-xm)
780 MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
781 BOARDNAME := UBNT-UF
782 UBNT_BOARD := XM
783 UBNT_TYPE := XM
784 UBNT_CHIP := ar7240
785 endef
786
787 TARGET_DEVICES += ubdev01
788
789 define Device/ubnt-routerstation
790 IMAGE_SIZE := 16128k
791 IMAGES := sysupgrade.bin factory.bin
792 IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
793 IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
794 KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
795 endef
796
797 define Device/ubnt-rs
798 $(Device/ubnt-routerstation)
799 BOARDNAME := UBNT-RS
800 DEVICE_PROFILE := Madwifi UBNT UBNTRS
801 UBNT_BOARD := RS
802 UBNT_TYPE := RSx
803 UBNT_CHIP := ar7100
804 endef
805
806 define Device/ubnt-rspro
807 $(Device/ubnt-routerstation)
808 BOARDNAME := UBNT-RSPRO
809 DEVICE_PROFILE := Madwifi UBNT UBNTRSPRO
810 UBNT_BOARD := RSPRO
811 UBNT_TYPE := RSPRO
812 UBNT_CHIP := ar7100pro
813 endef
814
815 define Device/ubnt-ls-sr71
816 $(Device/ubnt-routerstation)
817 BOARDNAME := UBNT-LS-SR71
818 DEVICE_PROFILE := Madwifi UBNT
819 UBNT_BOARD := LS-SR71
820 UBNT_TYPE := LS-SR71
821 UBNT_CHIP := ar7100
822 endef
823
824 TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
825
826 define Device/ubnt-uap-pro
827 IMAGE_SIZE := 15744k
828 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)
829 UBNT_TYPE := BZ
830 UBNT_CHIP := ar934x
831 BOARD_NAME := UAP-PRO
832 DEVICE_PROFILE := UBNT UAPPRO
833 KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | mkubntkernelimage
834 IMAGES := sysupgrade.bin factory.bin
835 IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
836 IMAGE/factory.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage2
837 endef
838
839 define Device/ubnt-unifi-outdoor-plus
840 $(Device/ubnt-uap-pro)
841 UBNT_CHIP := ar7240
842 BOARD_NAME := UBNT-UOP
843 DEVICE_PROFILE := UBNT
844 endef
845
846 TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus
847
848 rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
849
850 # $(1): rootfs type.
851 # $(2): board name.
852 define imgname
853 $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(call rootfs_type,$(1))
854 endef
855
856 define rootfs_align
857 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
858 endef
859
860 define sysupname
861 $(call imgname,$(1),$(2))-sysupgrade.bin
862 endef
863
864 define factoryname
865 $(call imgname,$(1),$(2))-factory.bin
866 endef
867
868 COMMA:=,
869
870 define mkcmdline
871 $(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3))
872 endef
873
874 define mtdpartsize
875 $(shell sz=`echo '$(2)' | sed -ne 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/p'`; [ -n "$$sz" ] && echo $$(($$sz * 1024)))
876 endef
877
878 SINGLE_PROFILES:=
879
880 # $(1) : name of image build method to be used, e.g., TPLINK-LZMA, AthLzma.
881 # $(2) : name of the build template to be used, e.g. 64k, 64kraw, 128k, etc.
882 # $(3) : name of the profile to be defined.
883 # $(4) : board name.
884 # $(5)~$(7) : arguments for $(mkcmdline)
885 # board=$(1) console=$(2),$(3)
886 # $(8)~$(14): extra arguments.
887 define SingleProfile
888 # $(1): action name, e.g. loader, buildkernel, squashfs, etc.
889 define Image/Build/Profile/$(3)
890 $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12),$(13),$(14))
891 endef
892 SINGLE_PROFILES += $(3)
893 endef
894
895 # $(1), name of the MultiProfile to be added.
896 # $(2), name of Profiles to be included in the MultiProfile.
897 define MultiProfile
898 define Image/Build/Profile/$(1)
899 $(foreach p,$(2),
900 $$(call Image/Build/Profile/$p,$$(1))
901 )
902 endef
903 endef
904
905 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
906
907 KDIR_TMP:=$(KDIR)/tmp
908 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
909 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
910
911 # $(1): input file.
912 # $(2): output file.
913 # $(3): extra arguments for lzma.
914 define CompressLzma
915 $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(3) $(2)
916 endef
917
918 define PatchKernel
919 cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
920 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) "$(strip $(2))"
921 endef
922
923 define PatchKernel/initramfs
924 $(call PatchKernel,$(1),$(2),-initramfs)
925 cp $(KDIR_TMP)/vmlinux-initramfs-$(1) $(call imgname,initramfs,$(1)).bin
926 endef
927
928 # $(1): board name.
929 # $(2): kernel command line.
930 # $(3): extra argumetns for lzma.
931 # $(4): name suffix, e.g. "-initramfs".
932 define PatchKernelLzma
933 cp $(KDIR)/vmlinux$(4) $(KDIR_TMP)/vmlinux$(4)-$(1)
934 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(4)-$(1) "$(strip $(2))"
935 $(call CompressLzma,$(KDIR_TMP)/vmlinux$(4)-$(1),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(3))
936 endef
937
938 define PatchKernelGzip
939 cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
940 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) "$(strip $(2))"
941 gzip -9 -c $(KDIR_TMP)/vmlinux$(3)-$(1) > $(KDIR_TMP)/vmlinux$(3)-$(1).bin.gz
942 endef
943
944 ifneq ($(SUBTARGET),mikrotik)
945 # $(1): compression method of the data.
946 # $(2): extra arguments.
947 # $(3): input data file.
948 # $(4): output file.
949 define MkuImage
950 mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
951 -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
952 -d $(3) $(4)
953 endef
954
955 # $(1): board name.
956 # $(2): kernel command line.
957 # $(3): extra arguments for lzma.
958 # $(4): name suffix, e.g. "-initramfs".
959 # $(5): extra arguments for mkimage.
960 define MkuImageLzma
961 $(call PatchKernelLzma,$(1),$(2),$(3),$(4))
962 $(call MkuImage,lzma,$(5),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(KDIR_TMP)/vmlinux$(4)-$(1).uImage)
963 endef
964
965 define MkuImageLzma/initramfs
966 $(call PatchKernelLzma,$(1),$(2),$(3),-initramfs)
967 $(call MkuImage,lzma,$(4),$(KDIR_TMP)/vmlinux-initramfs-$(1).bin.lzma,$(call imgname,initramfs,$(1))-uImage.bin)
968 endef
969
970 define MkuImageGzip
971 $(call PatchKernelGzip,$(1),$(2))
972 $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(KDIR_TMP)/vmlinux-$(1).uImage)
973 endef
974
975 define MkuImageGzip/initramfs
976 $(call PatchKernelGzip,$(1),$(2),-initramfs)
977 $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-initramfs-$(1).bin.gz,$(call imgname,initramfs,$(1))-uImage.bin)
978 endef
979
980 define MkuImageOKLI
981 $(call MkuImage,lzma,-M 0x4f4b4c49,$(KDIR)/vmlinux.bin.lzma,$(KDIR_TMP)/vmlinux-$(1).okli)
982 endef
983 endif
984
985 # $(1): name of the 1st file.
986 # $(2): size limit of the 1st file if it is greater than 262144, or
987 # the erase size of the flash if it is greater than zero and less
988 # than 262144
989 # $(3): name of the 2nd file.
990 # $(4): size limit of the 2nd file if $(2) is greater than 262144, otherwise
991 # it is the size limit of the output file
992 # $(5): name of the output file.
993 # $(6): padding size.
994 define CatFiles
995 if [ $(2) -eq 0 ]; then \
996 filename="$(3)"; fstype=$$$${filename##*\.}; \
997 case "$$$${fstype}" in \
998 "jffs2-64k") bs=65536;; \
999 "jffs2-128k") bs=131072;; \
1000 "jffs2-256k") bs=262144;; \
1001 *) bs=`stat -c%s $(1)`;; \
1002 esac; \
1003 ( dd if=$(1) bs=$$$${bs} conv=sync; cat $(3) ) > $(5); \
1004 if [ -n "$(6)" ]; then \
1005 case "$$$${fstype}" in \
1006 squashfs*) \
1007 padjffs2 $(5) $(6); \
1008 ;; \
1009 esac; \
1010 fi; \
1011 if [ `stat -c%s $(5)` -gt $(4) ]; then \
1012 echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
1013 rm -f $(5); \
1014 fi; \
1015 else if [ $(2) -gt 262144 ]; then \
1016 if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
1017 echo "Warning: $(1) is too big (> $(2) bytes)" >&2; \
1018 else if [ `stat -c%s $(3)` -gt $(4) ]; then \
1019 echo "Warning: $(3) is too big (> $(4) bytes)" >&2; \
1020 else \
1021 ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
1022 fi; fi; \
1023 else \
1024 ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
1025 if [ `stat -c%s $(5)` -gt $(4) ]; then \
1026 echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
1027 rm -f $(5); \
1028 fi; \
1029 fi; fi
1030 endef
1031
1032 # $(1): rootfs type.
1033 # $(2): board name.
1034 # $(3): kernel image size limit.
1035 # $(4): rootfs image size limit.
1036 # $(5): padding argument for padjffs2.
1037 Sysupgrade/KR=$(call CatFiles,$(2),$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(5)))
1038 Sysupgrade/KRuImage=$(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(2)),$(5))
1039 Sysupgrade/RKuImage=$(call CatFiles,$(KDIR)/root.$(1),$(4),$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(call sysupname,$(1),$(2)))
1040
1041 # $(1): ubinize ini file
1042 # $(2): working directory
1043 # $(3): output file
1044 # $(4): physical erase block size
1045 # $(5): minimum I/O unit size
1046 # $(6): custom options
1047 define ubinize
1048 $(CP) $(1) $(2)
1049 ( cd $(2); $(STAGING_DIR_HOST)/bin/ubinize -o $(3) -p $(4) -m $(5) $(6) $(1))
1050 endef
1051
1052 #
1053 # Embed lzma-compressed kernel inside lzma-loader.
1054 #
1055 # $(1), suffix of output filename, e.g. generic, lowercase board name, etc.
1056 # $(2), suffix of target file to build, e.g. bin, gz, elf
1057 # $(3), kernel command line to pass from lzma-loader to kernel
1058 # $(4), unused here
1059 # $(5), suffix of kernel filename, e.g. -initramfs, or empty
1060 define Image/BuildLoader
1061 -rm -rf $(KDIR)/lzma-loader
1062 $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)"\
1063 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
1064 LOADER_DATA="$(KDIR)/vmlinux$(5).bin.lzma" BOARD="$(1)" \
1065 compile loader.$(2)
1066 -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)
1067 endef
1068
1069 #
1070 # Embed patched lzma-compressed kernel inside lzma-loader.
1071 #
1072 # Specifying the command line via the lzma-loader doesn't work with some
1073 # models (like the TP-LINK CPE series), so this version first patches the
1074 # command line in the image and then builds the loader around it.
1075 #
1076 # $(1), suffix of output filename, e.g. generic, lowercase board name, etc.
1077 # $(2), suffix of target file to build, e.g. bin, gz, elf
1078 # $(3), kernel command line to pass from lzma-loader to kernel
1079 # $(4), unused here
1080 # $(5), suffix of kernel filename, e.g. -initramfs, or empty
1081 define Image/BuildLoaderPatched
1082 $(call PatchKernelLzma,$(1),$(3))
1083 -rm -rf $(KDIR)/lzma-loader
1084 $(LOADER_MAKE) LOADER=loader-$(1).$(2) \
1085 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
1086 LOADER_DATA="$(KDIR_TMP)/vmlinux-$(1)$(5).bin.lzma" BOARD="$(1)" \
1087 compile loader.$(2)
1088 -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)
1089 endef
1090
1091 #
1092 # Build lzma-loader alone which will search for lzma-compressed kernel identified by
1093 # uImage header with magic "OKLI" at boot time.
1094 #
1095 # $(4), offset into the flash space to start searching uImage magic "OKLI".
1096 # $(5), size of search range starting at $(4). With 0 as the value, uImage
1097 # header is expected to be at precisely $(4)
1098 define Image/BuildLoaderAlone
1099 -rm -rf $(KDIR)/lzma-loader
1100 $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)" \
1101 LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
1102 BOARD="$(1)" FLASH_OFFS=$(4) FLASH_MAX=$(5) \
1103 compile loader.$(2)
1104 endef
1105
1106 define Build/Clean
1107 $(LOADER_MAKE) clean
1108 endef
1109
1110
1111 alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
1112 alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
1113 alfa_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15936k(firmware),64k(nvram),64k(art)ro
1114 all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)
1115 all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),13568k(firmware),2048k(failsafe),256k(art)ro
1116 ap81_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,5120k(rootfs),2688k(kernel),64k(art)ro,7808k@0x50000(firmware)
1117 ap83_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,4096k(rootfs),3648k(kernel),64k(art)ro,7744k@0x60000(firmware)
1118 ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware)
1119 ap113_mtd_layout=mtdparts=spi0.0:64k(u-boot),3008k(rootfs),896k(uImage),64k(NVRAM),64k(ART),3904k@0x10000(firmware)
1120 ap121_mtdlayout_2M=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware)
1121 ap121_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
1122 ap132_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),6400k(rootfs),64k(art),7808k@0x50000(firmware)
1123 ap135_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
1124 ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(mib0),64k(art)ro,7744k@0x50000(firmware)
1125 bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro
1126 cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro
1127 cameo_ap91_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3712k(firmware),64k(mac)ro,64k(art)ro
1128 cameo_ap99_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3520k(firmware),64k(mac)ro,192k(lp)ro,64k(art)ro
1129 cameo_ap121_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,3648k(firmware)
1130 cameo_ap121_mtdlayout_8M=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)ro,7680k@0x80000(firmware)
1131 cameo_db120_mtdlayout=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,15936k(firmware),192k(lang)ro,64k(mac)ro,64k(art)ro
1132 cameo_db120_mtdlayout_8M=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,7872k(firmware),128k(lang)ro,64k(art)ro
1133 cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,1536k(kernel),12096k(rootfs),2048k(failsafe),64k(art),13632k@0xa0000(firmware)
1134 cpe510_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),6144k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware)
1135 eap300v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),320k(custom),13632k(firmware),2048k(failsafe),64k(art)ro
1136 db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
1137 dgl_5500_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,15296k(firmware),192k(lang)ro,512k(my-dlink)ro,64k(mac)ro,64k(art)ro
1138 cameo_ap94_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,1600k(unknown)ro,64k@0x7f0000(caldata_copy)
1139 cameo_ap94_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7808k(firmware),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
1140 esr900_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
1141 esr1750_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
1142 ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),3712k(firmware),64k(art)
1143 ew-dorin_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro
1144 f9k1115v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14464k(rootfs),1408k(kernel),64k(nvram)ro,64k(envram)ro,64k(art)ro,15872k@0x50000(firmware)
1145 dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,640k(certs),960k(unknown)ro,64k@0x7f0000(caldata_copy)
1146 dlrtdev_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7168k(firmware),640k(certs),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
1147 dragino2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,16000k(firmware),64k(config)ro,64k(art)ro
1148 hiwifi_hc6361_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(bdinfo)ro,1280k(kernel),14848k(rootfs),64k(backup)ro,64k(art)ro,16128k@0x20000(firmware)
1149 mr12_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2304k(kernel),128k(art)ro,15744k@0x80000(firmware)
1150 mr16_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2304k(kernel),128k(art)ro,15744k@0x80000(firmware)
1151 pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
1152 planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),128k(art)ro
1153 ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
1154 uap_pro_mtdlayout=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)
1155 ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
1156 whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
1157 wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k@0x40000(firmware)
1158 wpj344_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
1159 wpj558_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
1160 wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware)
1161 wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro
1162 wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro
1163 wnr2000v4_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro
1164 r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata),256k(caldata-backup),512k(config),512k(pot),2048k(kernel),122240k(ubi),25600k@0x1a0000(firmware),2048k(language),3072k(traffic_meter)
1165 wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),2048k(kernel),23552k(ubi),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)
1166 zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)
1167 mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
1168 mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
1169 zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
1170 qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
1171
1172
1173 define Image/BuildKernel
1174 cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
1175 cp $(KDIR)/vmlinux $(VMLINUX).bin
1176 dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
1177 dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
1178 $(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
1179 $(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
1180 cp $(KDIR)/loader-generic.elf $(VMLINUX)-lzma.elf
1181 -mkdir -p $(KDIR_TMP)
1182 $(call Image/Build/Profile/$(IMAGE_PROFILE),buildkernel)
1183 endef
1184
1185 define Image/BuildKernel/Initramfs
1186 cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
1187 cp $(KDIR)/vmlinux-initramfs $(VMLINUX)-initramfs.bin
1188 dd if=$(KDIR)/vmlinux-initramfs.bin.lzma of=$(VMLINUX)-initramfs.lzma bs=65536 conv=sync
1189 dd if=$(KDIR)/vmlinux-initramfs.bin.gz of=$(VMLINUX)-initramfs.gz bs=65536 conv=sync
1190 $(call MkuImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(UIMAGE)-initramfs-gzip.bin)
1191 $(call MkuImage,lzma,,$(KDIR)/vmlinux-initramfs.bin.lzma,$(UIMAGE)-initramfs-lzma.bin)
1192 cp $(KDIR)/loader-generic-initramfs.elf $(VMLINUX)-initramfs-lzma.elf
1193 $(call Image/Build/Initramfs)
1194 endef
1195
1196 Image/Build/WRT400N/buildkernel=$(call MkuImageLzma,$(2),$(3))
1197
1198 define Image/Build/WRT400N
1199 $(call Sysupgrade/KRuImage,$(1),$(2),1310720,6488064)
1200 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1201 wrt400n $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call factoryname,$(1),$(2)); \
1202 fi
1203 endef
1204
1205
1206 define Image/Build/CameoAP94/buildkernel
1207 $(call MkuImageLzma,$(2),$(3) $(4))
1208 $(call MkuImageLzma,$(2)-fat,$(3) $(5))
1209 endef
1210
1211 define Image/Build/CameoAP94
1212 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1213 $(eval fwsize_fat=$(call mtdpartsize,firmware,$(5)))
1214 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1215 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1216 ( \
1217 dd if=$(call sysupname,$(1),$(2)); \
1218 echo -n "$(6)"; \
1219 ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
1220 if [ `stat -c%s $(call sysupname,$(1),$(2))` -gt 4194304 ]; then \
1221 echo "Warning: $(call sysupname,$(1),$(2)) is too big" >&2; \
1222 else \
1223 ( \
1224 dd if=$(call sysupname,$(1),$(2)) bs=4096k conv=sync; \
1225 echo -n "$(7)"; \
1226 ) > $(call factoryname,$(1),$(2)); \
1227 fi; \
1228 fi
1229 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,0,$(KDIR)/root.$(1),$$$$(($(fwsize_fat)-4*64*1024)),$(KDIR_TMP)/$(2)-fat.bin,64)
1230 if [ -e "$(KDIR_TMP)/$(2)-fat.bin" ]; then \
1231 echo -n "" > $(KDIR_TMP)/$(2)-fat.dummy; \
1232 sh $(TOPDIR)/scripts/combined-image.sh \
1233 "$(KDIR_TMP)/$(2)-fat.bin" \
1234 "$(KDIR_TMP)/$(2)-fat.dummy" \
1235 $(call sysupname,$(1),$(2)-fat); \
1236 fi
1237 endef
1238
1239 define Image/Build/WZRHP
1240 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(3)-4*$(4)*1024)),$(4))
1241 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1242 ( \
1243 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
1244 dd if=$(call sysupname,$(1),$(2)); \
1245 ) > $(call imgname,$(1),$(2))-tftp.bin; \
1246 buffalo-enc -p $(5) -v 1.99 \
1247 -i $(call sysupname,$(1),$(2)) \
1248 -o $(KDIR_TMP)/$(2).enc; \
1249 buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
1250 -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
1251 -i $(KDIR_TMP)/$(2).enc \
1252 -o $(call factoryname,$(1),$(2)); \
1253 fi
1254 endef
1255
1256 Image/Build/WZRHP64K/buildkernel=$(call MkuImageLzma,$(2),$(3))
1257 Image/Build/WZRHP64K/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1258 Image/Build/WZRHP64K=$(call Image/Build/WZRHP,$(1),$(2),33095680,64,$(4))
1259
1260 Image/Build/WZRHP128K/buildkernel=$(call MkuImageLzma,$(2),$(3))
1261 Image/Build/WZRHP128K/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1262 Image/Build/WZRHP128K=$(call Image/Build/WZRHP,$(1),$(2),33030144,128,$(4))
1263
1264
1265 Image/Build/WHRHPG300N/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1266 Image/Build/WHRHPG300N/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1267
1268 define Image/Build/WHRHPG300N
1269 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1270 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1271 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1272 ( \
1273 echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
1274 dd if=$(call sysupname,$(1),$(2)); \
1275 ) > $(call imgname,$(1),$(2))-tftp.bin; \
1276 buffalo-enc -p $(5) -v 1.99 \
1277 -i $(call sysupname,$(1),$(2)) \
1278 -o $(KDIR_TMP)/$(2).enc; \
1279 buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
1280 -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
1281 -i $(KDIR_TMP)/$(2).enc \
1282 -o $(call factoryname,$(1),$(2)); \
1283 fi
1284 endef
1285
1286
1287 define Image/Build/Cameo
1288 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1289 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1290 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1291 factory_size=$$$$(($(fwsize) - $(6))); \
1292 ( \
1293 dd if=$(call sysupname,$(1),$(2)) bs=$$$${factory_size} conv=sync; \
1294 echo -n $(5); \
1295 ) > $(call factoryname,$(1),$(2)); \
1296 fi
1297 endef
1298
1299 Image/Build/CameoAP81/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap81_mtdlayout))
1300 Image/Build/CameoAP81=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap81_mtdlayout),$(4),65536)
1301 Image/Build/CameoAP81/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap81_mtdlayout))
1302
1303 Image/Build/CameoAP91/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap91_mtdlayout))
1304 Image/Build/CameoAP91=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap91_mtdlayout),$(4),65536)
1305 Image/Build/CameoAP91/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap91_mtdlayout))
1306
1307 Image/Build/CameoAP99/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap99_mtdlayout))
1308 Image/Build/CameoAP99=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap99_mtdlayout),$(4),65536)
1309 Image/Build/CameoAP99/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap99_mtdlayout))
1310
1311 Image/Build/CameoAP135/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1312 Image/Build/CameoAP135=$(call Image/Build/Cameo,$(1),$(2),$(3),$(4),$(5),26)
1313 Image/Build/CameoAP135/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1314
1315 Image/Build/CameoDB120/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_db120_mtdlayout))
1316 Image/Build/CameoDB120=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_db120_mtdlayout),$(4),26)
1317 Image/Build/CameoDB120/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_db120_mtdlayout))
1318
1319 Image/Build/CameoDB120_8M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_db120_mtdlayout_8M))
1320 Image/Build/CameoDB120_8M=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_db120_mtdlayout_8M),$(4),26)
1321 Image/Build/CameoDB120_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_db120_mtdlayout_8M))
1322
1323 define Image/Build/CameoHornet
1324 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1325 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1326 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1327 for r in $(7); do \
1328 [ -n "$$$$r" ] && dashr="-$$$$r" || dashr=; \
1329 [ -z "$$$$r" ] && r="DEF"; \
1330 mkcameofw -M HORNET -R "$$$$r" -S $(5) -V $(6) -c \
1331 -K $(8) -I $(fwsize) \
1332 -k "$(call sysupname,$(1),$(2))" \
1333 -o $(call imgname,$(1),$(2))-factory$$$$dashr.bin; \
1334 true; \
1335 done; \
1336 fi
1337 endef
1338
1339 Image/Build/CameoAP121/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap121_mtdlayout))
1340 Image/Build/CameoAP121=$(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo_ap121_mtdlayout),$(4),$(5),$(6),0xe0000)
1341 Image/Build/CameoAP121/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap121_mtdlayout))
1342
1343 Image/Build/CameoAP121_8M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap121_mtdlayout_8M))
1344 Image/Build/CameoAP121_8M=$(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo_ap121_mtdlayout_8M),$(4),$(5),$(6),0x100000)
1345 Image/Build/CameoAP121_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap121_mtdlayout_8M))
1346
1347
1348 define Image/Build/Ath
1349 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1350 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1351 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1352 $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
1353 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1354 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1355 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
1356 dd if=$(KDIR)/root.$(1) \
1357 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
1358 fi
1359 endef
1360
1361 Image/Build/AthGzip/buildkernel=$(call MkuImageGzip,$(2),$(3) $(4))
1362 Image/Build/AthGzip=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1363 Image/Build/AthGzip/initramfs=$(call MkuImageGzip/initramfs,$(2),$(3) $(4))
1364
1365 Image/Build/AthLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1366 Image/Build/AthLzma=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1367 Image/Build/AthLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1368
1369
1370 Image/Build/Belkin/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1371 Image/Build/Belkin/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1372
1373 define Image/Build/Belkin
1374 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1375 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1376 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1377 $(call Sysupgrade/RKuImage,$(1),$(2),$(kernsize),$(rootsize))
1378 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1379 edimax_fw_header -m $(5) -v "OpenWrt$(REVISION)" \
1380 -n "uImage" \
1381 -i $(KDIR_TMP)/vmlinux-$(2).uImage \
1382 -o $(KDIR_TMP)/$(2)-uImage; \
1383 edimax_fw_header -m $(5) -v "OpenWrt$(REVISION)" \
1384 -n "rootfs" \
1385 -i $(KDIR)/root.$(1) \
1386 -o $(KDIR_TMP)/$(2)-rootfs; \
1387 ( \
1388 dd if=$(KDIR_TMP)/$(2)-rootfs; \
1389 dd if=$(KDIR_TMP)/$(2)-uImage; \
1390 ) > "$(call factoryname,$(1),$(2))"; \
1391 fi
1392 endef
1393
1394 define Image/Build/EnGenius
1395 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1396 $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
1397 $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
1398 $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
1399 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1400 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1401 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
1402 dd if=$(KDIR)/root.$(1) \
1403 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
1404 mksenaofw -e $(call sysupname,$(1),$(2)) \
1405 -o $(call imgname,$(1),$(2))-factory.dlf \
1406 -r 0x101 -p $(7) -t 2; \
1407 fi
1408 endef
1409
1410 Image/Build/EnGenius/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1411 Image/Build/EnGenius/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1412
1413
1414 define MkuImageHiWiFi
1415 # Field ih_name needs to start with "tw150v1"
1416 mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
1417 -e 0x80060000 -n 'tw150v1 MIPS OpenWrt Linux-$(LINUX_VERSION)' \
1418 -d $(3) $(4)
1419 endef
1420
1421 define MkuImageLzmaHiWiFi
1422 $(call PatchKernelLzma,$(1),$(2),$(3),$(4))
1423 $(call MkuImageHiWiFi,lzma,$(5),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(KDIR_TMP)/vmlinux$(4)-$(1).uImage)
1424 endef
1425
1426 Image/Build/HiWiFi/buildkernel=$(call MkuImageLzmaHiWiFi,$(2),$(3) $(4))
1427 Image/Build/HiWiFi=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
1428 Image/Build/HiWiFi/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1429
1430 Image/Build/PB4X/buildkernel=$(call PatchKernelLzma,$(2),$(3))
1431
1432 define Image/Build/PB4X
1433 dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
1434 of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
1435 dd if=$(KDIR)/root.$(1) \
1436 of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
1437 -sh $(TOPDIR)/scripts/combined-image.sh \
1438 "$(call imgname,kernel,$(2)).bin" \
1439 "$(call imgname,$(1),$(2)-rootfs).bin" \
1440 $(call sysupname,$(1),$(2))
1441 endef
1442
1443
1444 Image/Build/MyLoader/buildkernel=$(call PatchKernelLzma,$(2),$(3))
1445 Image/Build/MyLoader/initramfs=$(call PatchKernel/initramfs,$(2),$(3))
1446
1447 define Image/Build/MyLoader
1448 $(eval fwsize=$(shell echo $$(($(4)-0x30000-4*64*1024))))
1449 $(eval fwimage=$(KDIR_TMP)/$(2)-$(5)-firmware.bin)
1450 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).bin.lzma,65536,$(KDIR)/root.$(1),$(fwsize),$(fwimage))
1451 if [ -e "$(fwimage)" ]; then \
1452 $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(4) -v \
1453 -p0x00030000:0:al:0x80060000:firmware:$(fwimage) \
1454 $(call imgname,$(1),$(2))-$(5)-factory.img; \
1455 echo -n "" > $(KDIR_TMP)/empty.bin; \
1456 sh $(TOPDIR)/scripts/combined-image.sh \
1457 $(fwimage) $(KDIR_TMP)/empty.bin \
1458 $(call imgname,$(1),$(2))-$(5)-sysupgrade.bin; \
1459 fi
1460 endef
1461
1462 Image/Build/Planex/initramfs=$(call MkuImageGzip/initramfs,$(2),$(3) $(planex_mtdlayout))
1463 Image/Build/Planex/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2) $(planex_mtdlayout),0x52000,0)
1464
1465 define Image/Build/Planex/buildkernel
1466 [ -e "$(KDIR)/loader-$(2).gz" ]
1467 $(call MkuImageOKLI,$(2))
1468 ( \
1469 dd if=$(KDIR)/loader-$(2).gz bs=8128 count=1 conv=sync; \
1470 dd if=$(KDIR_TMP)/vmlinux-$(2).okli; \
1471 ) > $(KDIR_TMP)/kernel-$(2).bin
1472 $(call MkuImage,gzip,,$(KDIR_TMP)/kernel-$(2).bin,$(KDIR_TMP)/vmlinux-$(2).uImage)
1473 endef
1474
1475 define Image/Build/Planex
1476 $(eval fwsize=$(call mtdpartsize,firmware,$(planex_mtdlayout)))
1477 $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
1478 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1479 $(STAGING_DIR_HOST)/bin/mkplanexfw \
1480 -B $(2) \
1481 -v 2.00.00 \
1482 -i $(call sysupname,$(1),$(2)) \
1483 -o $(call factoryname,$(1),$(2)); \
1484 fi
1485 endef
1486
1487
1488 Image/Build/ALFA/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1489 Image/Build/ALFA/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1490
1491 define Image/Build/ALFA
1492 $(call Sysupgrade/RKuImage,$(1),$(2),$(5),$(6))
1493 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1494 rm -rf $(KDIR)/$(1); \
1495 mkdir -p $(KDIR)/$(1); \
1496 cd $(KDIR)/$(1); \
1497 cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/$(1)/$(7); \
1498 cp $(KDIR)/root.$(1) $(KDIR)/$(1)/$(8); \
1499 $(TAR) zcf $(call factoryname,$(1),$(2)) -C $(KDIR)/$(1) $(7) $(8); \
1500 ( \
1501 echo WRM7222C | dd bs=32 count=1 conv=sync; \
1502 echo -ne '\xfe'; \
1503 ) >> $(call factoryname,$(1),$(2)); \
1504 fi
1505 endef
1506
1507
1508 Image/Build/Seama/loader=$(call Image/BuildLoader,$(1),bin,$(2) $(3),0x80060000)
1509
1510 define Image/Build/Seama
1511 [ -e "$(KDIR)/loader-$(2).bin" ]
1512 $(call CompressLzma,$(KDIR)/loader-$(2).bin,$(KDIR_TMP)/loader-$(2).bin.lzma)
1513 -rm -f $(KDIR_TMP)/image-$(2).tmp
1514 $(call CatFiles,$(KDIR_TMP)/loader-$(2).bin.lzma,$$$$(($(6) - 64)),$(KDIR)/root.$(1),$(7),$(KDIR_TMP)/image-$(2).tmp)
1515 [ -e "$(KDIR_TMP)/image-$(2).tmp" ] && { \
1516 head -c -4 "$(KDIR_TMP)/image-$(2).tmp" > "$(KDIR_TMP)/image-$(2).no-jffs2mark.tmp"; \
1517 $(STAGING_DIR_HOST)/bin/seama \
1518 -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp \
1519 -m "dev=/dev/mtdblock/1" -m "type=firmware"; \
1520 $(STAGING_DIR_HOST)/bin/seama \
1521 -s $(call imgname,$(1),$(2))-factory.bin \
1522 -m "signature=$(5)" \
1523 -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp.seama; \
1524 tail -c 4 "$(KDIR_TMP)/image-$(2).tmp" >> $(call imgname,$(1),$(2))-factory.bin; \
1525 }
1526 cat $(KDIR_TMP)/loader-$(2).bin.lzma > $(KDIR_TMP)/image-$(2)-sysupgrade.tmp
1527 $(STAGING_DIR_HOST)/bin/seama \
1528 -i $(KDIR_TMP)/image-$(2)-sysupgrade.tmp \
1529 -m "dev=/dev/mtdblock/1" -m "type=firmware"
1530 $(call CatFiles,$(KDIR_TMP)/image-$(2)-sysupgrade.tmp.seama,$(6),$(KDIR)/root.$(1),$(7),$(call sysupname,$(1),$(2)))
1531 endef
1532
1533 define Image/Build/Seama/initramfs
1534 $(call PatchKernelLzma,$(2),$(3) $(4),,-initramfs)
1535 $(STAGING_DIR_HOST)/bin/seama \
1536 -i $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma \
1537 -m "dev=/dev/mtdblock/1" -m "type=firmware"
1538 cat $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma.seama > $(call imgname,initramfs,$(2))-seama.bin
1539 endef
1540
1541 Image/Build/Senao/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1542 Image/Build/Senao/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1543
1544 define Image/Build/Senao
1545 mkdir -p $(KDIR_TMP)/$(2)/
1546 touch $(KDIR_TMP)/$(2)/FWINFO-OpenWrt-$(REVISION)-$(2)
1547 -$(CP) ./$(2)/* $(KDIR_TMP)/$(2)/
1548 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
1549 of=$(KDIR_TMP)/$(2)/openwrt-senao-$(2)-uImage-lzma.bin bs=64k conv=sync
1550 dd if=$(KDIR)/root.$(1) \
1551 of=$(KDIR_TMP)/$(2)/openwrt-senao-$(2)-root.$(1) bs=64k conv=sync
1552 ( \
1553 cd $(KDIR_TMP)/$(2)/; \
1554 $(TAR) -cz -f $(call factoryname,$(1),$(2)) * \
1555 )
1556 -rm -rf $(KDIR_TMP)/$(2)/
1557 -sh $(TOPDIR)/scripts/combined-image.sh \
1558 $(KDIR_TMP)/vmlinux-$(2).uImage \
1559 $(KDIR)/root.$(1) \
1560 $(call sysupname,$(1),$(2))
1561 endef
1562
1563 Image/Build/TPLINKOLD/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
1564
1565 define Image/Build/TPLINKOLD
1566 [ -e "$(KDIR)/loader-$(2).gz" ]
1567 $(call MkuImageOKLI,$(2))
1568 ( \
1569 dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
1570 dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
1571 ) > $(KDIR_TMP)/kernel-$(2).bin
1572 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
1573 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
1574 -X 0x40000 \
1575 -k $(KDIR_TMP)/kernel-$(2).bin \
1576 -r $(KDIR)/root.$(1) \
1577 -o $(call factoryname,$(1),$(2))
1578 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
1579 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
1580 -X 0x40000 \
1581 -k $(KDIR_TMP)/kernel-$(2).bin \
1582 -r $(KDIR)/root.$(1) \
1583 -o $(call sysupname,$(1),$(2))
1584 endef
1585
1586 define Image/Build/TPLINKOLD/initramfs
1587 $(call Image/BuildLoader,$(2),gz,$(3),0x80060000,-initramfs)
1588 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
1589 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
1590 -k $(KDIR)/loader-$(2)-initramfs.gz \
1591 -o $(call imgname,$(1),$(2))-initramfs-uImage.bin
1592 endef
1593
1594
1595 Image/Build/TPLINK/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
1596
1597 define Image/Build/TPLINK
1598 [ -e "$(KDIR)/loader-$(2).gz" ]
1599 $(call MkuImageOKLI,$(2))
1600 ( \
1601 dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
1602 dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
1603 ) > $(KDIR_TMP)/kernel-$(2).bin
1604 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
1605 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
1606 -X 0x40000 \
1607 -k $(KDIR_TMP)/kernel-$(2).bin \
1608 -r $(KDIR)/root.$(1) \
1609 -a $(call rootfs_align,$(1)) -j \
1610 -o $(call factoryname,$(1),$(2))
1611 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
1612 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
1613 -X 0x40000 \
1614 -k $(KDIR_TMP)/kernel-$(2).bin \
1615 -r $(KDIR)/root.$(1) \
1616 -a $(call rootfs_align,$(1)) -j \
1617 -o $(call sysupname,$(1),$(2))
1618 endef
1619
1620 define Image/Build/TPLINK/initramfs
1621 $(call Image/BuildLoader,$(2),gz,$(3),0x80060000,-initramfs)
1622 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
1623 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
1624 -k $(KDIR)/loader-$(2)-initramfs.gz \
1625 -o $(call imgname,$(1),$(2))-uImage.bin
1626 endef
1627
1628
1629 Image/Build/TPLINK-LZMA/buildkernel=$(call PatchKernelLzma,$(2),$(3))
1630
1631 define Image/Build/TPLINK-LZMA
1632 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
1633 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
1634 -X 0x40000 \
1635 -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
1636 -r $(KDIR)/root.$(1) \
1637 -a $(call rootfs_align,$(1)) -j \
1638 -o $(call factoryname,$(1),$(2))
1639 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
1640 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
1641 -X 0x40000 \
1642 -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
1643 -r $(KDIR)/root.$(1) \
1644 -a $(call rootfs_align,$(1)) -j \
1645 -o $(call sysupname,$(1),$(2))
1646 endef
1647
1648 define Image/Build/TPLINK-LZMA/initramfs
1649 $(call PatchKernelLzma,$(2),$(3),,-initramfs)
1650 -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
1651 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
1652 -k $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma \
1653 -o $(call imgname,$(1),$(2))-uImage.bin
1654 endef
1655
1656
1657 Image/Build/TPLINK-SAFELOADER/loader = $(call Image/BuildLoaderPatched,$(1),elf,$(2) $(3))
1658
1659 define Image/Build/TPLINK-SAFELOADER
1660 [ -e "$(KDIR)/loader-$(2).elf" ]
1661
1662 -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
1663 -B $(5) \
1664 -k $(KDIR)/loader-$(2).elf \
1665 -r $(KDIR)/root.$(1) \
1666 -V $(REVISION) \
1667 -j \
1668 -o $(call factoryname,$(1),$(2))
1669 -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
1670 -B $(5) \
1671 -k $(KDIR)/loader-$(2).elf \
1672 -r $(KDIR)/root.$(1) \
1673 -V $(REVISION) \
1674 -j -S \
1675 -o $(call sysupname,$(1),$(2))
1676 endef
1677
1678
1679 define Image/Build/CyberTAN
1680 echo -n '' > $(KDIR_TMP)/empty.bin
1681 $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp \
1682 -f $(KDIR_TMP)/vmlinux-$(2).uImage -F $(KDIR_TMP)/empty.bin \
1683 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
1684 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(5) \
1685 -i $(KDIR)/image.tmp \
1686 -o $(call sysupname,$(1),$(2))
1687 $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR_TMP)/vmlinux-$(2).uImage \
1688 -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
1689 -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(5) -g \
1690 -i $(KDIR)/image.tmp \
1691 -o $(call factoryname,$(1),$(2))
1692 rm $(KDIR)/image.tmp
1693 endef
1694
1695 Image/Build/CyberTANGZIP/loader=$(call Image/BuildLoader,$(1),gz,$(2),0x80060000)
1696 Image/Build/CyberTANGZIP/buildkernel=$(call MkuImage,gzip,,$(KDIR)/loader-$(2).gz,$(KDIR_TMP)/vmlinux-$(2).uImage)
1697 Image/Build/CyberTANGZIP=$(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4),$(5))
1698
1699 Image/Build/CyberTANLZMA/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1700 Image/Build/CyberTANLZMA=$(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4),$(5))
1701
1702
1703 Image/Build/Netgear/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
1704
1705 define Image/Build/Netgear/buildkernel
1706 $(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
1707 -rm -rf $(KDIR_TMP)/$(2)
1708 mkdir -p $(KDIR_TMP)/$(2)/image
1709 cat $(KDIR_TMP)/vmlinux-$(2).uImage > $(KDIR_TMP)/$(2)/image/uImage
1710 $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
1711 $(KDIR_TMP)/$(2) $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1 \
1712 -noappend -root-owned -be -b 65536
1713 ( \
1714 cat $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1; \
1715 dd if=/dev/zero bs=1k count=1 \
1716 ) > $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2
1717 mkimage -A mips -O linux -T filesystem -C none -M $(5) \
1718 -a 0xbf070000 -e 0xbf070000 \
1719 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
1720 -d $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2 \
1721 $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs
1722 endef
1723
1724 define Image/Build/Netgear
1725 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1726 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
1727 if [ -e $(call sysupname,$(1),$(2)) ]; then \
1728 for r in $(7) ; do \
1729 [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
1730 $(STAGING_DIR_HOST)/bin/mkdniimg \
1731 -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
1732 -i $(call sysupname,$(1),$(2)) \
1733 -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
1734 done; \
1735 fi
1736 endef
1737
1738
1739 Image/Build/NetgearLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
1740 Image/Build/NetgearLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
1741
1742 define Image/Build/NetgearLzma
1743 $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
1744 $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
1745 endef
1746
1747
1748 Image/Build/NetgearNAND/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
1749
1750 # $(1): (empty)
1751 # $(2): Board name (small caps)
1752 # $(3): Kernel board specific cmdline
1753 # $(4): Kernel mtdparts definition
1754 # $(5): U-Boot magic
1755 define Image/Build/NetgearNAND/buildkernel
1756 $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
1757 $(call PatchKernelLzma,$(2),$(3) $(4),-d20)
1758 dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
1759 of=$(KDIR_TMP)/vmlinux-$(2).bin.tmp \
1760 bs=$$$$(($(kernelsize)-131072-2*64-1)) \
1761 count=1 conv=sync
1762 $(call MkuImage,lzma,-M $(5),$(KDIR_TMP)/vmlinux-$(2).bin.tmp,$(KDIR_TMP)/vmlinux-$(2).uImage)
1763 echo -ne '\xff' >> $(KDIR_TMP)/vmlinux-$(2).uImage
1764 # create a fake rootfs image
1765 dd if=/dev/zero of=$(KDIR_TMP)/fakeroot-$(2) bs=131072 count=1
1766 mkimage -A mips -O linux -T filesystem -C none \
1767 -a 0xbf070000 -e 0xbf070000 \
1768 -n 'MIPS OpenWrt fakeroot' \
1769 -d $(KDIR_TMP)/fakeroot-$(2) \
1770 -M $(5) \
1771 $(KDIR_TMP)/fakeroot-$(2).uImage
1772 # append the fake rootfs image to the kernel, it will reside in the last
1773 # erase block of the kernel partition
1774 cat $(KDIR_TMP)/fakeroot-$(2).uImage >> $(KDIR_TMP)/vmlinux-$(2).uImage
1775 endef
1776
1777
1778 # $(1): rootfs image suffix
1779 # $(2): Board name (small caps)
1780 # $(3): Kernel board specific cmdline
1781 # $(4): Kernel mtdparts definition
1782 # $(5): U-Boot magic
1783 # $(6): Board name (upper caps)
1784 # $(7): firmware region code (not used yet)
1785 # $(8): DNI Hardware version
1786 # $(9): suffix of the configuration file for ubinize
1787 define Image/Build/NetgearNAND
1788 $(eval firmwaresize=$(call mtdpartsize,firmware,$(4)))
1789 $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
1790 $(eval imageraw=$(KDIR_TMP)/$(2)-raw.img)
1791 $(CP) $(KDIR)/root.squashfs-raw $(KDIR_TMP)/root.squashfs
1792 echo -ne '\xde\xad\xc0\xde' > $(KDIR_TMP)/jffs2.eof
1793 $(call ubinize,ubinize-$(9).ini,$(KDIR_TMP),$(KDIR_TMP)/$(2)-root.ubi,128KiB,2048,-E 5)
1794 ( \
1795 dd if=$(KDIR_TMP)/vmlinux-$(2).uImage; \
1796 dd if=$(KDIR_TMP)/$(2)-root.ubi \
1797 ) > $(imageraw)
1798 $(STAGING_DIR_HOST)/bin/mkdniimg \
1799 -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
1800 -i $(imageraw) \
1801 -o $(call imgname,ubi,$(2))-factory.img
1802
1803 $(call Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/vmlinux-$(2).uImage)
1804 endef
1805
1806
1807 ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
1808 Image/Build/ZyXEL/buildkernel=$(call MkuImageLzma,$(2),$(3))
1809
1810 define Image/Build/ZyXEL
1811 $(call Sysupgrade/KRuImage,$(1),$(2),917504,2752512)
1812 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1813 if [ ! -f $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin ]; then \
1814 echo "Warning: $(IMG_PREFIX)-$(2)-u-boot.bin not found" >&2; \
1815 else \
1816 $(STAGING_DIR_HOST)/bin/mkzynfw \
1817 -B $(4) \
1818 -b $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin \
1819 -r $(call sysupname,$(1),$(2)):0x10000 \
1820 -o $(call factoryname,$(1),$(2)); \
1821 fi; fi
1822 endef
1823 endif
1824
1825
1826 define Image/Build/ZyXELNAND/buildkernel
1827 $(eval kernelsize=$(call mtdpartsize,kernel,$(5)))
1828 $(call MkuImageLzma,$(2),$(3) $(5) $(6))
1829 mkdir -p $(KDIR_TMP)/$(2)/image/boot
1830 cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/boot/vmlinux.lzma.uImage
1831 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
1832 --pad=$(kernelsize) --big-endian --squash-uids -v -e 128KiB \
1833 -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
1834 -d $(KDIR_TMP)/$(2)/image \
1835 2>&1 1>/dev/null | awk '/^.+$$$$/'
1836 -rm -rf $(KDIR_TMP)/$(2)
1837 endef
1838
1839 define Image/Build/ZyXELNAND
1840 if [ "$(1)" != "squashfs" ]; then \
1841 echo Only squashfs is supported; \
1842 return 0; \
1843 fi
1844 $(eval firmwaresize=$(call mtdpartsize,firmware,$(4)))
1845 $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
1846 $(eval imageraw=$(KDIR_TMP)/$(2)-raw.img)
1847 $(CP) $(KDIR)/root.$(1) $(KDIR_TMP)/ubi_root.img
1848 $(call ubinize,ubinize-$(2).ini,$(KDIR_TMP),$(KDIR_TMP)/$(2)-root.ubi,128KiB,2048,-E 5)
1849 ( \
1850 dd if=$(KDIR_TMP)/$(2)-kernel.jffs2; \
1851 dd if=$(KDIR_TMP)/$(2)-root.ubi \
1852 ) > $(imageraw)
1853 dd if=$(imageraw) of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.bin \
1854 bs=128k conv=sync
1855 $(call Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/$(2)-kernel.jffs2)
1856 endef
1857
1858
1859 Image/Build/OpenMesh/buildkernel=$(call MkuImageLzma,$(2))
1860
1861 define Image/Build/OpenMesh
1862 -sh $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
1863 "$(4)" \
1864 "$(BUILD_DIR)/fwupgrade.cfg-$(4)" \
1865 "$(KDIR_TMP)/vmlinux-$(2).uImage" \
1866 "$(KDIR)/root.$(1)"
1867 -sh $(TOPDIR)/scripts/combined-ext-image.sh \
1868 "$(4)" "$(call factoryname,$(1),$(2))" \
1869 "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \
1870 "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
1871 "$(KDIR)/root.$(1)" "rootfs"
1872 endef
1873
1874
1875 Image/Build/Zcomax/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
1876 Image/Build/Zcomax/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
1877
1878 define Image/Build/Zcomax
1879 $(call Sysupgrade/RKuImage,$(1),$(2),1507328,6356992)
1880 if [ -e "$(call sysupname,$(1),$(2))" ]; then \
1881 $(STAGING_DIR_HOST)/bin/mkzcfw \
1882 -B $(2) \
1883 -k $(KDIR_TMP)/vmlinux-$(2).uImage \
1884 -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
1885 -o $(call imgname,$(1),$(2))-factory.img; \
1886 fi
1887 endef
1888
1889
1890 # $(1): template name to be defined, etc. squashfs-only, 64k, 64kraw, etc.
1891 # $(2): jffs2 blocksize.
1892 define Jffs2Template
1893 define Image/Build/Template/$(1)/jffs2-$(2)
1894 $$(call Image/Build/$$(1),jffs2-$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
1895 endef
1896 endef
1897
1898 # $(1): template name to be defined.
1899 # $(2): squashfs suffix to be used.
1900 # $(3): jffs2 suffix to be used.
1901 define BuildTemplate
1902 # $(1) : name of build method.
1903 # $(2) : board name.
1904 # $(3) : kernel command line.
1905 # $(4)~$(8): extra arguments.
1906 define Image/Build/Template/$(1)/initramfs
1907 $$(call Image/Build/$$(1)/initramfs,initramfs,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
1908 endef
1909 define Image/Build/Template/$(1)/loader
1910 $$(call Image/Build/$$(1)/loader,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
1911 endef
1912 define Image/Build/Template/$(1)/buildkernel
1913 $$(call Image/Build/$$(1)/buildkernel,,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
1914 endef
1915 define Image/Build/Template/$(1)/squashfs
1916 $$(call Image/Build/$$(1),squashfs$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
1917 endef
1918 $(if $(3),$(foreach bs,$(3),$(eval $(call Jffs2Template,$(1),$(bs)))))
1919 endef
1920
1921 $(eval $(call BuildTemplate,squashfs-only))
1922 $(eval $(call BuildTemplate,64k,-64k,64k))
1923 $(eval $(call BuildTemplate,64kraw,-raw,64k))
1924 $(eval $(call BuildTemplate,64kraw-nojffs,-raw))
1925 $(eval $(call BuildTemplate,128k,,128k))
1926 $(eval $(call BuildTemplate,128kraw,-raw,128k))
1927 $(eval $(call BuildTemplate,256k,,256k))
1928 $(eval $(call BuildTemplate,all,,64k 128k 256k))
1929
1930 ifeq ($(SUBTARGET),generic)
1931 $(eval $(call SingleProfile,ALFA,64k,ALFANX,alfa-nx,ALFA-NX,ttyS0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,vmlinux.gz.uImage,pb9x-2.6.31-jffs2))
1932 $(eval $(call SingleProfile,ALFA,64k,HORNETUB,hornet-ub,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel_image,rootfs_image))
1933 $(eval $(call SingleProfile,ALFA,64k,TUBE2H8M,tube2h-8M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel.image,rootfs.image))
1934
1935 $(eval $(call SingleProfile,AthGzip,64k,AP81,ap81,AP81,ttyS0,115200,$$(ap81_mtdlayout),RKuImage))
1936 $(eval $(call SingleProfile,AthGzip,64k,AP83,ap83,AP83,ttyS0,115200,$$(ap83_mtdlayout),RKuImage))
1937 $(eval $(call SingleProfile,AthGzip,64k,AP96,ap96,AP96,ttyS0,115200,$$(ap96_mtdlayout),RKuImage))
1938 $(eval $(call SingleProfile,AthGzip,64k,WNDAP360,wndap360,WNDAP360,ttyS0,9600,$$(wndap360_mtdlayout),KRuImage))
1939
1940 $(eval $(call SingleProfile,AthLzma,64k,ALFAAP96,alfa-ap96,ALFA-AP96,ttyS0,115200,$$(alfa_ap96_mtdlayout),RKuImage))
1941 $(eval $(call SingleProfile,AthLzma,64k,ALL0258N,all0258n,ALL0258N,ttyS0,115200,$$(all0258n_mtdlayout),KRuImage,65536))
1942 $(eval $(call SingleProfile,AthLzma,256k,ALL0315N,all0315n,ALL0315N,ttyS0,115200,$$(all0315n_mtdlayout),KRuImage,262144))
1943 $(eval $(call SingleProfile,AthLzma,64k,AP113,ap113,AP113,ttyS0,115200,$$(ap113_mtd_layout),RK))
1944 $(eval $(call SingleProfile,AthLzma,64k,AP121_2M,ap121-2M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_2M),RKuImage))
1945 $(eval $(call SingleProfile,AthLzma,64k,AP121_4M,ap121-4M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage))
1946 $(eval $(call SingleProfile,AthLzma,64k,AP121MINI,ap121-mini,AP121-MINI,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage))
1947 $(eval $(call SingleProfile,AthLzma,64k,AP132,ap132,AP132,ttyS0,115200,$$(ap132_mtdlayout),KRuImage))
1948 $(eval $(call SingleProfile,AthLzma,64k,AP135,ap135-020,AP135-020,ttyS0,115200,$$(ap135_mtdlayout),RKuImage))
1949 $(eval $(call SingleProfile,AthLzma,64k,AP136_010,ap136-010,AP136-010,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
1950 $(eval $(call SingleProfile,AthLzma,64k,AP136_020,ap136-020,AP136-020,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
1951 $(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage))
1952 $(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage))
1953 $(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))
1954 $(eval $(call SingleProfile,AthLzma,64k,DRAGINO2,dragino2,DRAGINO2,ttyATH0,115200,$$(dragino2_mtdlayout),KRuImage,65536))
1955 $(eval $(call SingleProfile,AthLzma,64k,EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
1956 $(eval $(call SingleProfile,AthLzma,64k,EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
1957 $(eval $(call SingleProfile,AthLzma,64k,EWDORIN16M,ew-dorin-16M,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_16M),KRuImage,65536))
1958 $(eval $(call SingleProfile,AthLzma,64k,HORNETUBx2,hornet-ub-x2,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536))
1959 $(eval $(call SingleProfile,AthLzma,64k,MR12,mr12,MR12,ttyS0,115200,$$(mr12_mtdlayout),RKuImage))
1960 $(eval $(call SingleProfile,AthLzma,64k,MR16,mr16,MR16,ttyS0,115200,$$(mr16_mtdlayout),RKuImage))
1961 $(eval $(call SingleProfile,AthLzma,64k,PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),KRuImage))
1962 $(eval $(call SingleProfile,AthLzma,64k,TUBE2H16M,tube2h-16M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536))
1963 $(eval $(call SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(wlr8100_mtdlayout),KRuImage))
1964 $(eval $(call SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
1965 $(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
1966
1967 $(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
1968
1969 $(eval $(call SingleProfile,CameoAP91,64kraw,DIR600A1,dir-600-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-00"))
1970 $(eval $(call SingleProfile,CameoAP91,64kraw,DIR601A1,dir-601-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-02"))
1971 $(eval $(call SingleProfile,CameoAP91,64kraw,FR54RTR,fr-54rtr,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-01"))
1972
1973 $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E1,dir-615-e1,DIR-615-E1,ttyS0,115200,"AP93-AR7240-RT-081028-00"))
1974 $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E4,dir-615-e4,DIR-615-E4,ttyS0,115200,"AP99-AR7240-RT-091105-05"))
1975
1976 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,A02RBW300N,a02-rb-w300n,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-03"))
1977 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,DIR615C1,dir-615-c1,DIR-615-C1,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
1978 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW632BRP,tew-632brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-00"))
1979 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW652BRP_FW,tew-652brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-080609-05"))
1980 $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW652BRP_RECOVERY,tew-652brp-recovery,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
1981
1982 $(eval $(call SingleProfile,CameoAP121,64kraw-nojffs,TEW712BR,tew-712br,TEW-712BR,ttyATH0,115200,"HORNET-RT-TEW712BR-3",1.99,""))
1983 $(eval $(call SingleProfile,CameoAP121,64kraw-nojffs,DIR601B1,dir-601-b1,TEW-712BR,ttyATH0,115200,"HORNET-RT-DIR601B1-3",2.99.99,"" "NA"))
1984 $(eval $(call SingleProfile,CameoAP121_8M,64kraw-nojffs,DIR505A1,dir-505-a1,DIR-505-A1,ttyATH0,115200,"HORNET-PACKET-DIR505A1-3",1.99.99,""))
1985
1986 $(eval $(call SingleProfile,CameoAP135,64kraw,DGL5500A1,dgl-5500-a1,DGL-5500-A1,ttyS0,115200,$$(dgl_5500_mtdlayout),"00AP135AR9558-RT-130508-00"))
1987
1988 $(eval $(call SingleProfile,CameoDB120,64kraw,DHP1565A1,dhp-1565-a1,DHP-1565-A1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
1989 $(eval $(call SingleProfile,CameoDB120,64kraw,DIR825C1,dir-825-c1,DIR-825-C1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
1990 $(eval $(call SingleProfile,CameoDB120,64kraw,DIR835A1,dir-835-a1,DIR-835-A1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
1991
1992 $(eval $(call SingleProfile,CameoDB120_8M,64kraw,TEW732BR,tew-732br,TEW-732BR,ttyS0,115200,"00DB120AR9341-RT-120906-NA"))
1993
1994 $(eval $(call SingleProfile,CyberTANGZIP,64k,WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,,1.00.01))
1995
1996 $(eval $(call SingleProfile,CyberTANLZMA,64k,MYNETREXT,mynet-rext,MYNET-REXT,ttyS0,115200,$$(mynet_rext_mtdlayout) root=31:2,1.00.01))
1997
1998 $(eval $(call SingleProfile,CameoAP94,64kraw,DIR825B1,dir-825-b1,DIR-825-B1,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
1999 $(eval $(call SingleProfile,CameoAP94,64kraw,TEW673GRU,tew-673gru,TEW-673GRU,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01))
2000 $(eval $(call SingleProfile,CameoAP94,64kraw,DLRTDEV01,dlrtdev01,DIR-825-B1,ttyS0,115200,$$(dlrtdev_mtdlayout),$$(dlrtdev_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
2001
2002 $(eval $(call SingleProfile,EnGenius,64k,ESR900,esr900,ESR900,ttyS0,115200,$$(esr900_mtdlayout),KRuImage,,0x4e))
2003 $(eval $(call SingleProfile,EnGenius,64k,ESR1750,esr1750,ESR1750,ttyS0,115200,$$(esr1750_mtdlayout),KRuImage,,0x61))
2004
2005 $(eval $(call SingleProfile,HiWiFi,64k,HIWIFI_HC6361,hiwifi-hc6361,HiWiFi-HC6361,ttyATH0,115200,$$(hiwifi_hc6361_mtdlayout),KRuImage))
2006
2007 $(eval $(call SingleProfile,MyLoader,64k,WP543_2M,wp543,,ttyS0,115200,0x200000,2M))
2008 $(eval $(call SingleProfile,MyLoader,64k,WP543_4M,wp543,,ttyS0,115200,0x400000,4M))
2009 $(eval $(call SingleProfile,MyLoader,64k,WP543_8M,wp543,,ttyS0,115200,0x800000,8M))
2010 $(eval $(call SingleProfile,MyLoader,64k,WP543_16M,wp543,,ttyS0,115200,0x1000000,16M))
2011 $(eval $(call SingleProfile,MyLoader,64k,WPE72_4M,wpe72,,ttyS0,115200,0x400000,4M))
2012 $(eval $(call SingleProfile,MyLoader,64k,WPE72_8M,wpe72,,ttyS0,115200,0x800000,8M))
2013 $(eval $(call SingleProfile,MyLoader,64k,WPE72_16M,wpe72,,ttyS0,115200,0x1000000,16M))
2014
2015 $(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,"" NA,-H 29763551+04+32))
2016 $(eval $(call SingleProfile,NetgearLzma,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"" NA,))
2017 $(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,WNR2200,"" NA,))
2018 $(eval $(call SingleProfile,Netgear,64kraw,REALWNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,WNR612V2,"",))
2019 $(eval $(call SingleProfile,Netgear,64kraw,N150R,n150r,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,N150R,"",))
2020 $(eval $(call SingleProfile,Netgear,64kraw,REALWNR1000V2,wnr1000v2,WNR1000V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x31303031,WNR1000V2,"",))
2021 $(eval $(call SingleProfile,Netgear,64kraw,WNR1000V2_VC,wnr1000v2-vc,WNR1000V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x31303030,WNR1000V2-VC,"",))
2022
2023 $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P))
2024 $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P))
2025 $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600))
2026 $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900))
2027
2028 $(eval $(call SingleProfile,PB4X,128k,ALL0305,all0305,ALL0305,ttyS0,115200))
2029 $(eval $(call SingleProfile,PB4X,128k,EAP7660D,eap7660d,EAP7660D,ttyS0,115200))
2030 $(eval $(call SingleProfile,PB4X,64k,JA76PF,ja76pf,JA76PF,ttyS0,115200))
2031 $(eval $(call SingleProfile,PB4X,64k,JA76PF2,ja76pf2,JA76PF2,ttyS0,115200))
2032 $(eval $(call SingleProfile,PB4X,64k,JWAP003,jwap003,JWAP003,ttyS0,115200))
2033 $(eval $(call SingleProfile,PB4X,64k,PB42,pb42,PB42,ttyS0,115200))
2034 $(eval $(call SingleProfile,PB4X,64k,PB44,pb44,PB44,ttyS0,115200))
2035
2036 $(eval $(call SingleProfile,Planex,64kraw,MZKW04NU,mzk-w04nu,MZK-W04NU,ttyS0,115200))
2037 $(eval $(call SingleProfile,Planex,64kraw,MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,115200))
2038
2039 $(eval $(call SingleProfile,Seama,64k,MYNETN600,mynet-n600,MYNET-N600,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd16_wd_db600,1310720,16187392))
2040 $(eval $(call SingleProfile,Seama,64k,MYNETN750,mynet-n750,MYNET-N750,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd13_wd_av,1310720,16187392))
2041
2042 $(eval $(call SingleProfile,Seama,64k,QIHOO360,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,1310720,16121856))
2043
2044 $(eval $(call SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0,115200,$$(eap300v2_mtdlayout)))
2045
2046 $(eval $(call SingleProfile,TPLINKOLD,squashfs-only,TLWR841NV15,tl-wr841nd-v1.5,TL-WR841N-v1.5,ttyS0,115200,0x08410002,2,4M))
2047
2048 $(eval $(call SingleProfile,TPLINK,64kraw,RNXN360RT,rnx-n360rt,TL-WR941ND,ttyS0,115200,0x09410002,0x00420001,4M))
2049 $(eval $(call SingleProfile,TPLINK,64kraw,TLMR3220V1,tl-mr3220-v1,TL-MR3220,ttyS0,115200,0x32200001,1,4M))
2050 $(eval $(call SingleProfile,TPLINK,64kraw,TLMR3420V1,tl-mr3420-v1,TL-MR3420,ttyS0,115200,0x34200001,1,4M))
2051 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA701NV1,tl-wa701n-v1,TL-WA901ND,ttyS0,115200,0x07010001,1,4M))
2052 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA730REV1,tl-wa730rev1,TL-WA901ND,ttyS0,115200,0x07300001,1,4M))
2053 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA7510NV1,tl-wa7510n,TL-WA7510N,ttyS0,115200,0x75100001,1,4M))
2054 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA801NV1,tl-wa801nd-v1,TL-WA901ND,ttyS0,115200,0x08010001,1,4M))
2055 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA830RV1,tl-wa830re-v1,TL-WA901ND,ttyS0,115200,0x08300010,1,4M))
2056 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA901NV1,tl-wa901nd-v1,TL-WA901ND,ttyS0,115200,0x09010001,1,4M))
2057 $(eval $(call SingleProfile,TPLINK,64kraw,TLWA901NV2,tl-wa901nd-v2,TL-WA901ND-v2,ttyS0,115200,0x09010002,1,4M))
2058 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR740NV1,tl-wr740n-v1,TL-WR741ND,ttyS0,115200,0x07400001,1,4M))
2059 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR740NV3,tl-wr740n-v3,TL-WR741ND,ttyS0,115200,0x07400003,1,4M))
2060 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR743NV1,tl-wr743nd-v1,TL-WR741ND,ttyS0,115200,0x07430001,1,4M))
2061 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV3,tl-wr841nd-v3,TL-WR941ND,ttyS0,115200,0x08410003,3,4M))
2062 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV5,tl-wr841nd-v5,TL-WR741ND,ttyS0,115200,0x08410005,1,4M))
2063 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV7,tl-wr841nd-v7,TL-WR841N-v7,ttyS0,115200,0x08410007,1,4M))
2064 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR842V1,tl-wr842n-v1,TL-MR3420,ttyS0,115200,0x08420001,1,8M))
2065 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV2,tl-wr941nd-v2,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
2066 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV3,tl-wr941nd-v3,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
2067 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV4,tl-wr941nd-v4,TL-WR741ND,ttyS0,115200,0x09410004,1,4M))
2068 $(eval $(call SingleProfile,TPLINK,64kraw,TLWR1043V1,tl-wr1043nd-v1,TL-WR1043ND,ttyS0,115200,0x10430001,1,8M))
2069
2070 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR1043ND-v2,ttyS0,115200,0x10430002,1,8M))
2071 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
2072
2073 $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
2074
2075 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
2076 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPG300N,whr-hp-g300n,WHR-HP-G300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-G300N))
2077 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPGN,whr-hp-gn,WHR-HP-GN,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-GN))
2078 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WLAEAG300N,wlae-ag300n,WLAE-AG300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WLAE-AG300N))
2079
2080 $(eval $(call SingleProfile,WRT400N,64k,WRT400N,wrt400n,WRT400N,ttyS0,115200))
2081
2082 $(eval $(call SingleProfile,WZRHP128K,128kraw,WZRHPG300NH,wzr-hp-g300nh,WZR-HP-G300NH,ttyS0,115200,WZR-HP-G300NH))
2083 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG300NH2,wzr-hp-g300nh2,WZR-HP-G300NH2,ttyS0,115200,WZR-HP-G300NH2))
2084 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPAG300H,wzr-hp-ag300h,WZR-HP-AG300H,ttyS0,115200,WZR-HP-AG300H))
2085 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG450H,wzr-hp-g450h,WZR-HP-G450H,ttyS0,115200,WZR-HP-AG450H))
2086 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZR600DHP,wzr-600dhp,WZR-HP-AG300H,ttyS0,115200,WZR-600DHP))
2087 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZR450HP2,wzr-450hp2,WZR-450HP2,ttyS0,115200,WZR-450HP2))
2088
2089 $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H28,zcn-1523h-2-8,ZCN-1523H-2,ttyS0,115200,$$(zcn1523h_mtdlayout)))
2090 $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H516,zcn-1523h-5-16,ZCN-1523H-5,ttyS0,115200,$$(zcn1523h_mtdlayout)))
2091
2092 $(eval $(call SingleProfile,ZyXEL,64k,NBG_460N_550N_550NH,nbg460n_550n_550nh,NBG460N,ttyS0,115200,NBG-460N))
2093
2094 $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M))
2095 $(eval $(call MultiProfile,AP136,AP136_010 AP136_020))
2096 $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M))
2097 $(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900))
2098 $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))
2099 $(eval $(call MultiProfile,TLMR3220,TLMR3220V1))
2100 $(eval $(call MultiProfile,TLMR3420,TLMR3420V1))
2101 $(eval $(call MultiProfile,TLWA701,TLWA701NV1))
2102 $(eval $(call MultiProfile,TLWA730RE,TLWA730REV1))
2103 $(eval $(call MultiProfile,TLWA801,TLWA801NV1))
2104 $(eval $(call MultiProfile,TLWA830,TLWA830RV1))
2105 $(eval $(call MultiProfile,TLWA901,TLWA901NV1 TLWA901NV2))
2106 $(eval $(call MultiProfile,TLWA7510,TLWA7510NV1))
2107 $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3))
2108 $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2))
2109 $(eval $(call MultiProfile,TLWR743,TLWR743NV1))
2110 $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7))
2111 $(eval $(call MultiProfile,TLWR842,TLWR842V1))
2112 $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
2113 $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2))
2114 $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
2115 $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
2116 $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
2117 $(eval $(call MultiProfile,WNR1000V2,REALWNR1000V2 WNR1000V2_VC))
2118 $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M))
2119 $(eval $(call MultiProfile,WPE72,WPE72_4M WPE72_8M WPE72_16M))
2120 $(eval $(call MultiProfile,WPJ344,WPJ344_16M))
2121 $(eval $(call MultiProfile,WPJ558,WPJ558_16M))
2122
2123 $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
2124 $(eval $(call MultiProfile,Madwifi,EAP7660D WP543))
2125 endif # ifeq ($(SUBTARGET),generic)
2126
2127 ifeq ($(SUBTARGET),nand)
2128 $(eval $(call SingleProfile,NetgearNAND,64k,WNDR3700V4,wndr3700v4,WNDR3700_V4,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR3700v4,"",-H 29763948+128+128,wndr4300))
2129 $(eval $(call SingleProfile,NetgearNAND,64k,WNDR4300V1,wndr4300,WNDR4300,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR4300,"",-H 29763948+0+128+128+2x2+3x3,wndr4300))
2130 $(eval $(call SingleProfile,NetgearNAND,64k,R6100,r6100,R6100,ttyS0,115200,$$(r6100_mtdlayout),0x36303030,R6100,"",-H 29764434+0+128+128+2x2+2x2,wndr4300))
2131
2132 $(eval $(call SingleProfile,ZyXELNAND,128k,NBG6716,nbg6716,NBG6716,ttyS0,115200,NBG6716,$$(zyx_nbg6716_mtdlayout),mem=256M))
2133
2134 $(eval $(call MultiProfile,WNDR4300,WNDR3700V4 WNDR4300V1))
2135 endif # ifeq ($(SUBTARGET),nand)
2136
2137
2138 $(eval $(call MultiProfile,Default,$(SINGLE_PROFILES)))
2139
2140 define Image/Build/squashfs
2141 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
2142 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-64k
2143 $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs-64k 64
2144 cp $(KDIR)/root.squashfs-64k $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k
2145 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
2146 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
2147 endef
2148
2149 define Image/Build/jffs2
2150 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
2151 endef
2152
2153 define Image/Build/Initramfs
2154 $(call Image/Build/Profile/$(IMAGE_PROFILE),initramfs)
2155 endef
2156
2157 define Image/Prepare
2158 gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
2159 $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
2160 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
2161 gzip -9 -c $(KDIR)/vmlinux-initramfs > $(KDIR)/vmlinux-initramfs.bin.gz
2162 $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
2163 $(call Image/BuildLoader,generic,elf,,,-initramfs)
2164 endif
2165 $(call Image/BuildLoader,generic,elf)
2166 $(call Image/Build/Profile/$(if $(CONFIG_IB),Default,$(IMAGE_PROFILE)),loader)
2167 endef
2168
2169 # $(1): filesystem type.
2170 define Image/Build
2171 $(call Image/Build/$(call rootfs_type,$(1)),$(1))
2172 $(call Image/Build/Profile/$(IMAGE_PROFILE),$(1))
2173 endef
2174
2175 $(eval $(call BuildImage))