lantiq: simplify image building code
[openwrt/openwrt.git] / target / linux / lantiq / image / Makefile
1 #
2 # Copyright (C) 2010-2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 # boards missing since devicetree update
9 #EASY50712 ARV3527P
10
11 JFFS2_BLOCKSIZE = 64k 128k 256k
12
13 KERNEL_LOADADDR = 0x80002000
14 KERNEL_ENTRY = 0x80002000
15
16 include $(TOPDIR)/rules.mk
17 include $(INCLUDE_DIR)/image.mk
18
19 ifeq ($(SUBTARGET),xway)
20 UBIFS_OPTS := -m 512 -e 15872 -c 1959
21 UBI_OPTS:="-m 512 -p 16KiB -s 256"
22 else
23 UBIFS_OPTS := -m 2048 -e 126KiB -c 4096
24 UBI_OPTS:="-m 2048 -p 128KiB -s 512"
25 endif
26
27 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
28
29 define Image/BuildLoader/Template
30 -rm -rf $(KDIR)/lzma-loader
31 $(LOADER_MAKE) LOADER=loader$(2)-$(1).bin\
32 LZMA_TEXT_START=0x80a00000 \
33 LOADADDR=0x80002000 \
34 LOADER_DATA="$(KDIR)/vmlinux$(2)-$(1).lzma" BOARD="$(1)" \
35 compile loader.bin
36 endef
37
38
39 define CompressLzma
40 $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
41 endef
42
43 define PatchKernelLzma
44 cp $(KDIR)/vmlinux$(2) $(KDIR)/vmlinux$(2)-$(1)
45 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(1).dtb ../dts/$(1).dts
46 cat $(KDIR)/vmlinux$(2)-$(1) $(KDIR)/$(1).dtb > $(KDIR)/vmlinux$(2)-$(1).tmp
47 $(call CompressLzma,$(KDIR)/vmlinux$(2)-$(1).tmp,$(KDIR)/vmlinux$(2)-$(1).lzma)
48 endef
49
50 define MkImageLzma
51 mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
52 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
53 -d $(KDIR)/vmlinux$(2)-$(1).lzma $(KDIR)/uImage-$(1)$(2)
54 endef
55
56 define MkImageEVA
57 lzma2eva 0x80002000 0x80002000 $(KDIR)/vmlinux$(2)-$(1).lzma $(KDIR)/$(1)$(2).eva.prealign
58 dd if=$(KDIR)/$(1)$(2).eva.prealign of=$(KDIR)/$(1)$(2).eva.align.64k bs=64k conv=sync
59 dd if=$(KDIR)/$(1)$(2).eva.prealign of=$(KDIR)/$(1)$(2).eva.align.128k bs=128k conv=sync
60 cat ./eva.dummy.squashfs >> $(KDIR)/$(1)$(2).eva.align.64k
61 endef
62
63 define Image/Build/squashfs
64 cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
65 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
66 endef
67
68 DGN3500_SKERNEL=0x50000
69 DGN3500_SKERNEL_DECIMAL=327680
70 define Image/BuildDGN3500/squashfs
71 dd if=/dev/zero of=$(BIN_DIR)/$(IMG_PREFIX)-pad bs=$(DGN3500_SKERNEL_DECIMAL) count=1
72 cat $(BIN_DIR)/$(IMG_PREFIX)-pad $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img
73 rm -r $(BIN_DIR)/$(IMG_PREFIX)-pad
74 dd if=/dev/zero ibs=16M count=1 | tr "\000" "\377" > $(BIN_DIR)/$(IMG_PREFIX)-pwf
75 cp $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img
76 dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img $(DGN3500_SKERNEL) NA
77 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img)
78 cp $(BIN_DIR)/$(IMG_PREFIX)-pwf $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-NA.img
79 dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-NA.img conv=notrunc
80 dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade-NA.image bs=$(DGN3500_SKERNEL_DECIMAL) skip=1
81 rm -r $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img
82 mv $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img
83 dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img $(DGN3500_SKERNEL) WW
84 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img)
85 mv $(BIN_DIR)/$(IMG_PREFIX)-pwf $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-WW.img
86 dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-WW.img conv=notrunc
87 dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade-WW.image bs=$(DGN3500_SKERNEL_DECIMAL) skip=1
88 rm -r $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img
89 endef
90
91 define Image/BuildDGN3500B/squashfs
92 dd if=/dev/zero of=$(BIN_DIR)/$(IMG_PREFIX)-pad bs=327680 count=1
93 cat $(BIN_DIR)/$(IMG_PREFIX)-pad $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img
94 rm -r $(BIN_DIR)/$(IMG_PREFIX)-pad
95 dd if=/dev/zero ibs=16M count=1 | tr "\000" "\377" > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.img
96 dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img $(DGN3500_SKERNEL) DE
97 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img)
98 dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.img conv=notrunc
99 dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.image bs=$(DGN3500_SKERNEL_DECIMAL) skip=1
100 rm -r $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img
101 dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.image $(DGN3500_SKERNEL) DE
102 endef
103
104
105 define Image/BuildEVA/squashfs
106 cat $(KDIR)/$(2).eva.align.64k $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva
107 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva)
108 endef
109
110 define Image/BuildLoader/squashfs
111 dd if=$(KDIR)/loader-$(2).bin of=$(KDIR)/loader-$(2).bin.padded bs=3072k conv=sync
112 cat $(KDIR)/loader-$(2).bin.padded $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
113 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
114 endef
115
116 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
117 define Image/BuildKernel/InitramfsTemplate
118 $(call PatchKernelLzma,$(1),-initramfs)
119 $(call MkImageLzma,$(1),-initramfs)
120 $(CP) $(KDIR)/uImage-$(1)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage-initramfs
121 endef
122 endif
123
124 define Image/BuildKernel/Template
125 $(call PatchKernelLzma,$(1))
126 $(call MkImageLzma,$(1))
127 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
128 $(Image/BuildKernel/InitramfsTemplate)
129 endef
130
131 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
132 define Image/BuildKernelLoader/InitramfsTemplate
133 $(CP) $(KDIR)/loader-initramfs-$(1).bin $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux-initramfs-loader
134 $(CP) $(KDIR)/vmlinux-initramfs-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux-initramfs
135 endef
136 endif
137
138 define Image/BuildKernelLoader/Template
139 $(CP) $(KDIR)/loader-$(1).bin $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux-loader
140 $(CP) $(KDIR)/vmlinux-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux
141 $(Image/BuildKernelLoader/InitramfsTemplate)
142 endef
143
144 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
145 define Image/Prepare/InitramfsTemplate
146 $(call PatchKernelLzma,$(1),-initramfs)
147 $(call Image/BuildLoader/Template,$(1),-initramfs)
148 endef
149 endif
150
151 define Image/Prepare/Template
152 $(call PatchKernelLzma,$(1))
153 $(call Image/BuildLoader/Template,$(1))
154 $(Image/Prepare/InitramfsTemplate)
155 endef
156
157 define Image/BuildKernelEVA/Template
158 $(call PatchKernelLzma,$(1))
159 $(call MkImageEVA,$(1))
160 $(CP) $(KDIR)/$(1).eva.align.64k $(BIN_DIR)/$(IMG_PREFIX)-$(1).eva.align.64k
161 $(CP) $(KDIR)/$(1).eva.align.128k $(BIN_DIR)/$(IMG_PREFIX)-$(1).eva.align.128k
162 endef
163
164
165 ### Kernel scripts ###
166 define Build/mkbrncmdline
167 mkbrncmdline -i $@ -o $@.new BRN-BOOT
168 mv $@.new $@
169 endef
170
171 define Build/mkbrnimg
172 mkbrnimg -s $(SIGNATURE) -m $(MAGIC) -p $(CRC32_POLY) -o $@ $(word 1,$^) $(word 2,$^)
173 endef
174
175 define Build/fullimage
176 mkimage -A mips -O linux -C lzma -T filesystem -a 0x00 \
177 -e 0x00 -n 'LEDE RootFS' \
178 -d $(word 2,$^) $(word 2,$^).new
179
180 cat $(word 1,$^) $(word 2,$^).new > $@.tmp
181
182 mkimage -A mips -O linux -T multi -a 0x00 -C none \
183 -e 0x00 -n 'OpenWrt fullimage' \
184 -d $@.tmp $@
185
186 rm $(word 2,$^).new
187 rm $@.tmp
188 endef
189
190 # Shared device definition: applies to every defined device
191 define Device/Default
192 PROFILES = Default
193 KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts)
194 KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs
195 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
196 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
197 FILESYSTEMS := squashfs
198 DEVICE_DTS := $(1)
199 DEVICE_DTS_DIR := ../dts
200 IMAGE_SIZE :=
201 IMAGES := sysupgrade.bin
202 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
203 endef
204 DEVICE_VARS += IMAGE_SIZE
205
206 define Device/lantiqBrnImage
207 KERNEL := kernel-bin | append-dtb | mkbrncmdline | lzma-no-dict
208 IMAGES := factory.bin
209 IMAGE/factory.bin := mkbrnimg | check-size $$$$(IMAGE_SIZE)
210 endef
211 DEVICE_VARS += SIGNATURE MAGIC CRC32_POLY
212
213 define Device/lantiqFullImage
214 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | pad-offset 4 0
215 IMAGES := sysupgrade.bin fullimage.img
216 IMAGE/fullimage.img := fullimage | check-size $$$$(IMAGE_SIZE)
217 endef
218
219 ifeq ($(SUBTARGET),xway_legacy)
220
221 define Device/ARV4520PW
222 IMAGE_SIZE := 3648k
223 DEVICE_TITLE := Easybox 800, WAV-281 - ARV4520PW
224 DEVICE_PACKAGES := kmod-ltq-hcd-danube \
225 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
226 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
227 ltq-adsl-app ppp-mod-pppoa \
228 kmod-rt61-pci wpad-mini \
229 swconfig
230 endef
231 TARGET_DEVICES += ARV4520PW
232
233 define Device/ARV4525PW
234 IMAGE_SIZE := 3776k
235 DEVICE_TITLE := Speedport W502V Typ A - ARV4525PW
236 DEVICE_PACKAGES := kmod-ath5k wpad-mini \
237 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
238 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
239 ltq-adsl-app ppp-mod-pppoa
240 endef
241 TARGET_DEVICES += ARV4525PW
242
243 define Device/ARV452CQW
244 IMAGE_SIZE := 3776k
245 DEVICE_TITLE := Easybox 801 - ARV452CQW
246 DEVICE_PACKAGES := kmod-ltq-hcd-danube \
247 kmod-ath5k wpad-mini \
248 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
249 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
250 ltq-adsl-app ppp-mod-pppoa \
251 swconfig
252 endef
253 TARGET_DEVICES += ARV452CQW
254
255 define Device/ARV4518PWR01
256 IMAGE_SIZE := 3776k
257 DEVICE_TITLE := ARV4518PWR01
258 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
259 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
260 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
261 ltq-adsl-app ppp-mod-pppoa \
262 kmod-ath5k wpad-mini \
263 swconfig
264 endef
265 TARGET_DEVICES += ARV4518PWR01
266
267 define Device/ARV4518PWR01A
268 IMAGE_SIZE := 3776k
269 DEVICE_TITLE := ARV4518PWR01A
270 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
271 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
272 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
273 ltq-adsl-app ppp-mod-pppoa \
274 kmod-ath5k wpad-mini \
275 swconfig
276 endef
277 TARGET_DEVICES += ARV4518PWR01A
278
279 endif
280
281 ifeq ($(SUBTARGET),xway)
282
283 # Danube
284
285 Image/BuildKernel/Profile/BTHOMEHUBV2B=$(call Image/BuildKernel/Template,BTHOMEHUBV2B)
286 Image/Build/Profile/BTHOMEHUBV2B=$(call Image/BuildNAND/$(1),$(1),BTHOMEHUBV2B)
287
288 define LegacyDevice/BTHOMEHUBV2B
289 DEVICE_TITLE := BT Home Hub 2B
290 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
291 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
292 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
293 kmod-ltq-deu-danube \
294 ltq-adsl-app ppp-mod-pppoa \
295 kmod-ath9k wpad-mini \
296 swconfig
297 endef
298 LEGACY_DEVICES += BTHOMEHUBV2B
299
300 define Device/EASY50712
301 IMAGE_SIZE := 3776k
302 DEVICE_TITLE := Lantiq Danube - EASY50712
303 endef
304 TARGET_DEVICES += EASY50712
305
306 define Device/ACMP252
307 IMAGE_SIZE := 14848k
308 DEVICE_TITLE := AudioCodes MediaPack MP-252
309 DEVICE_PACKAGES := kmod-rt2x00-pci wpad-mini \
310 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
311 kmod-ltq-adsl-danube-fw-a kmod-ltq-ptm-danube \
312 ltq-adsl-app
313 endef
314 TARGET_DEVICES += ACMP252
315
316 define Device/ARV4510PW
317 IMAGE_SIZE := 15616k
318 DEVICE_TITLE := Wippies, Elisa - ARV4510PW
319 DEVICE_PACKAGES := kmod-ledtrig-usbdev kmod-usb2-pci kmod-usb-uhci \
320 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
321 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
322 ltq-adsl-app ppp-mod-pppoa \
323 kmod-ltq-tapi kmod-ltq-vmmc \
324 kmod-rt2800-pci kmod-ath5k wpad-mini \
325 swconfig
326 endef
327 TARGET_DEVICES += ARV4510PW
328
329 define Device/ARV7525PW
330 IMAGE_SIZE := 3776k
331 DEVICE_TITLE := Speedport W303V Typ A - ARV7525PW
332 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini \
333 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
334 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
335 ltq-adsl-app ppp-mod-pppoa
336 endef
337 TARGET_DEVICES += ARV7525PW
338
339 define Device/ARV4519PW
340 IMAGE_SIZE := 3776k
341 DEVICE_TITLE := Vodafone, Pirelli - ARV4519PW
342 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
343 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
344 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
345 ltq-adsl-app ppp-mod-pppoa \
346 swconfig
347 endef
348 TARGET_DEVICES += ARV4519PW
349
350 define Device/ARV7506PW11
351 IMAGE_SIZE := 7808k
352 DEVICE_TITLE := Alice/O2 IAD 4421 - ARV7506PW11
353 DEVICE_PACKAGES := kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
354 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
355 ltq-adsl-app ppp-mod-pppoa \
356 kmod-rt2800-pci wpad-mini \
357 swconfig
358 endef
359 TARGET_DEVICES += ARV7506PW11
360
361 define Device/ARV7510PW22
362 IMAGE_SIZE := 31232k
363 DEVICE_TITLE := Astoria - ARV7510PW22
364 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
365 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
366 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
367 ltq-adsl-app ppp-mod-pppoa \
368 kmod-ltq-tapi kmod-ltq-vmmc \
369 kmod-rt2800-pci wpad-mini \
370 kmod-usb-uhci kmod-usb2 kmod-usb2-pci \
371 swconfig
372 endef
373 TARGET_DEVICES += ARV7510PW22
374
375 define Device/ARV7518PW
376 IMAGE_SIZE := 7872k
377 DEVICE_TITLE := Astoria - ARV7518PW
378 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
379 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
380 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
381 ltq-adsl-app ppp-mod-pppoa \
382 kmod-ath9k wpad-mini \
383 swconfig
384 endef
385 TARGET_DEVICES += ARV7518PW
386
387 define Device/ARV7519PW
388 IMAGE_SIZE := 15488k
389 DEVICE_TITLE := Astoria - ARV7519PW
390 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
391 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
392 kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
393 ltq-adsl-app ppp-mod-pppoa \
394 kmod-rt2800-pci wpad-mini \
395 swconfig
396 endef
397 TARGET_DEVICES += ARV7519PW
398
399 define Device/ARV752DPW
400 IMAGE_SIZE := 7872k
401 DEVICE_TITLE := Easybox 802 - ARV752DPW
402 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
403 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
404 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
405 ltq-adsl-app ppp-mod-pppoa \
406 kmod-ltq-tapi kmod-ltq-vmmc \
407 kmod-rt2800-pci wpad-mini \
408 swconfig
409 endef
410 TARGET_DEVICES += ARV752DPW
411
412 define Device/ARV752DPW22
413 IMAGE_SIZE := 7616k
414 DEVICE_TITLE := Easybox 803 - ARV752DPW22
415 DEVICE_PACKAGES := kmod-usb2-pci kmod-usb-uhci kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
416 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
417 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
418 ltq-adsl-app ppp-mod-pppoa \
419 kmod-ltq-tapi kmod-ltq-vmmc \
420 kmod-rt2800-pci wpad-mini \
421 swconfig
422 endef
423 TARGET_DEVICES += ARV752DPW22
424
425 define Device/ARV8539PW22
426 IMAGE_SIZE := 7616k
427 DEVICE_TITLE := Speedport W504V Typ A - ARV8539PW22
428 DEVICE_PACKAGES := kmod-ltq-hcd-danube \
429 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
430 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
431 ltq-adsl-app ppp-mod-pppoa \
432 kmod-ath9k wpad-mini \
433 swconfig
434 endef
435 TARGET_DEVICES += ARV8539PW22
436
437 define Device/GIGASX76X
438 IMAGE_SIZE := 7680k
439 DEVICE_TITLE := Gigaset sx76x
440 DEVICE_PACKAGES := kmod-ltq-hcd-danube kmod-ledtrig-usbdev \
441 kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
442 kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
443 ltq-adsl-app ppp-mod-pppoe \
444 kmod-ath5k wpad-mini \
445 swconfig
446 endef
447 TARGET_DEVICES += GIGASX76X
448
449
450 # AR9
451
452 Image/BuildKernel/Profile/BTHOMEHUBV3A=$(call Image/BuildKernel/Template,BTHOMEHUBV3A)
453 Image/Build/Profile/BTHOMEHUBV3A=$(call Image/BuildNAND/$(1),$(1),BTHOMEHUBV3A)
454
455 define LegacyDevice/BTHOMEHUBV3A
456 DEVICE_TITLE := BT Home Hub 3A
457 DEVICE_PACKAGES := kmod-usb-dwc2 kmod-ledtrig-usbdev \
458 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
459 kmod-ltq-adsl-ar9-fw-a kmod-ltq-atm-ar9 \
460 kmod-ltq-deu-ar9 \
461 ltq-adsl-app ppp-mod-pppoa \
462 kmod-ath9k wpad-mini \
463 swconfig uboot-envtools
464 endef
465 LEGACY_DEVICES += BTHOMEHUBV3A
466
467 Image/BuildKernel/Profile/DGN3500=$(call Image/BuildKernel/Template,DGN3500)
468 Image/Build/Profile/DGN3500=$(call Image/BuildDGN3500/$(1),$(1),DGN3500)
469
470 define LegacyDevice/DGN3500
471 DEVICE_TITLE := Netgear DGN3500
472 DEVICE_PACKAGES := kmod-usb-dwc2 kmod-ledtrig-usbdev \
473 kmod-ath9k wpad-mini \
474 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
475 kmod-ltq-adsl-ar9-fw-a kmod-ltq-atm-ar9 \
476 ltq-adsl-app ppp-mod-pppoa \
477 kmod-ltq-deu-ar9 swconfig
478 endef
479 LEGACY_DEVICES += DGN3500
480
481 Image/BuildKernel/Profile/DGN3500B=$(call Image/BuildKernel/Template,DGN3500B)
482 Image/Build/Profile/DGN3500B=$(call Image/BuildDGN3500B/$(1),$(1),DGN3500B)
483
484 define LegacyDevice/DGN3500B
485 DEVICE_TITLE := Netgear DGN3500B
486 DEVICE_PACKAGES := kmod-usb-dwc2 kmod-ledtrig-usbdev \
487 kmod-ath9k wpad-mini \
488 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
489 kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
490 ltq-adsl-app ppp-mod-pppoa \
491 kmod-ltq-deu-ar9 swconfig
492 endef
493 LEGACY_DEVICES += DGN3500B
494
495 define Device/WBMRA
496 IMAGE_SIZE := 31488k
497 DEVICE_DTS := WBMR
498 DEVICE_TITLE := Buffalo WBMR-HP-G300H (A) - WBMR
499 DEVICE_PACKAGES := kmod-usb-dwc2 kmod-ledtrig-usbdev \
500 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
501 kmod-ltq-adsl-ar9-fw-a kmod-ltq-atm-ar9 \
502 ltq-adsl-app ppp-mod-pppoa \
503 kmod-ath9k wpad hostapd-utils \
504 swconfig
505 endef
506 TARGET_DEVICES += WBMRA
507
508 define Device/WBMRB
509 IMAGE_SIZE := 31488k
510 DEVICE_DTS := WBMR
511 DEVICE_TITLE := Buffalo WBMR-HP-G300H (B) - WBMR
512 DEVICE_PACKAGES := kmod-usb-dwc2 kmod-ledtrig-usbdev \
513 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
514 kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
515 ltq-adsl-app ppp-mod-pppoa \
516 kmod-ath9k wpad hostapd-utils \
517 swconfig
518 endef
519 TARGET_DEVICES += WBMRB
520
521 Image/BuildKernel/Profile/FRITZ7320=$(call Image/BuildKernelEVA/Template,FRITZ7320)
522 Image/Build/Profile/FRITZ7320=$(call Image/BuildEVA/$(1),$(1),FRITZ7320)
523
524 define LegacyDevice/FRITZ7320
525 DEVICE_TITLE := 1&1 HomeServer - FRITZ7320
526 DEVICE_PACKAGES := kmod-ath9k wpad-mini \
527 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
528 kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
529 ltq-adsl-app ppp-mod-pppoa \
530 kmod-ltq-deu-ar9 kmod-usb-dwc2 \
531 kmod-ath9k wpad-mini
532 endef
533 LEGACY_DEVICES += FRITZ7320
534
535 define Device/H201L
536 IMAGE_SIZE := 7808k
537 DEVICE_TITLE := ZTE H201L - H201L
538 DEVICE_PACKAGES := kmod-ath9k-htc wpad-mini \
539 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
540 kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
541 ltq-adsl-app ppp-mod-pppoe \
542 kmod-ltq-deu-ar9 kmod-usb-dwc2 \
543 kmod-ltq-tapi kmod-ltq-vmmc \
544 swconfig
545 endef
546 TARGET_DEVICES += H201L
547
548 define Device/P2601HNFX
549 IMAGE_SIZE := 15616k
550 DEVICE_TITLE := ZyXEL P-2601HN-Fx
551 DEVICE_PACKAGES := kmod-rt2800-usb wpad-mini \
552 kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
553 kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
554 ltq-adsl-app ppp-mod-pppoe \
555 kmod-ltq-deu-ar9 kmod-usb-dwc2 \
556 swconfig
557 endef
558 TARGET_DEVICES += P2601HNFX
559
560
561 endif
562
563
564 ifeq ($(SUBTARGET),xrx200)
565
566 # VR9
567
568 Image/BuildKernel/Profile/P2812HNUF1=$(call Image/BuildKernel/Template,P2812HNUF1)
569 Image/Build/Profile/P2812HNUF1=$(call Image/BuildNAND/$(1),$(1),P2812HNUF1)
570
571 define LegacyDevice/P2812HNUF1
572 DEVICE_TITLE := ZyXEL P-2812HNU-F1
573 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini kmod-usb-dwc2
574 endef
575 LEGACY_DEVICES += P2812HNUF1
576
577 Image/BuildKernel/Profile/P2812HNUF3=$(call Image/BuildKernel/Template,P2812HNUF3)
578 Image/Build/Profile/P2812HNUF3=$(call Image/BuildNAND/$(1),$(1),P2812HNUF3)
579
580 define LegacyDevice/P2812HNUF3
581 DEVICE_TITLE := ZyXEL P-2812HNU-F3
582 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini kmod-usb-dwc2
583 endef
584 LEGACY_DEVICES += P2812HNUF3
585
586 define Device/ARV7519RW22
587 IMAGE_SIZE := 31232k
588 DEVICE_TITLE := Livebox Astoria ARV7519RW22
589 DEVICE_PACKAGES := kmod-usb-dwc2
590 endef
591 TARGET_DEVICES += ARV7519RW22
592
593
594 Image/BuildKernel/Profile/BTHOMEHUBV5A=$(call Image/BuildKernel/Template,BTHOMEHUBV5A)
595 Image/Build/Profile/BTHOMEHUBV5A=$(call Image/BuildNAND/$(1),$(1),BTHOMEHUBV5A)
596
597 define LegacyDevice/BTHOMEHUBV5A
598 DEVICE_TITLE := BT Home Hub 5A
599 DEVICE_PACKAGES := kmod-ath9k kmod-ath10k wpad-mini kmod-usb-dwc2
600 endef
601 LEGACY_DEVICES += BTHOMEHUBV5A
602
603 define Device/EASY80920NAND
604 $(Device/lantiqFullImage)
605 IMAGE_SIZE := 64512k
606 DEVICE_TITLE := Lantiq VR9 - EASY80920NAND
607 DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2
608 endef
609 TARGET_DEVICES += EASY80920NAND
610
611 define Device/EASY80920NOR
612 IMAGE_SIZE := 7936k
613 DEVICE_TITLE := Lantiq VR9 - EASY80920NOR
614 DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2
615 endef
616 TARGET_DEVICES += EASY80920NOR
617
618 Image/BuildKernel/Profile/FRITZ3370=$(call Image/BuildKernelEVA/Template,FRITZ3370)
619 Image/Build/Profile/FRITZ3370=$(call Image/BuildEVA/$(1),$(1),FRITZ3370)
620
621 define LegacyDevice/FRITZ3370
622 DEVICE_TITLE := Fritz!Box WLan - FRITZ3370
623 DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2
624 endef
625 LEGACY_DEVICES += FRITZ3370
626
627 Image/BuildKernel/Profile/FRITZ7360SL=$(call Image/BuildKernelEVA/Template,FRITZ7360SL)
628 Image/Build/Profile/FRITZ7360SL=$(call Image/BuildEVA/$(1),$(1),FRITZ7360SL)
629
630 define LegacyDevice/FRITZ7360SL
631 DEVICE_TITLE := 1&1 HomeServer - FRITZ7360SL
632 DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2
633 endef
634 LEGACY_DEVICES += FRITZ7360L
635
636 Image/Prepare/Profile/VG3503J=$(call Image/Prepare/Template,VG3503J)
637 Image/BuildKernel/Profile/VG3503J=$(call Image/BuildKernelLoader/Template,VG3503J)
638 Image/Build/Profile/VG3503J=$(call Image/BuildLoader/$(1),$(1),VG3503J)
639
640 define LegacyDevice/VG3503J
641 DEVICE_TITLE := BT Openreak - ECI VDSL Modem
642 endef
643 LEGACY_DEVICES += VG3503J
644
645 include tp-link.mk
646
647 define Device/WBMR300
648 IMAGE_SIZE := 15616k
649 DEVICE_TITLE := Buffalo WBMR-300HPD
650 DEVICE_PACKAGES := kmod-mt76 wpad-mini kmod-usb-dwc2
651 endef
652 TARGET_DEVICES += WBMR300
653
654 define Device/VGV7510KW22NOR
655 IMAGE_SIZE := 15232k
656 DEVICE_TITLE := o2 Box 6431 / Arcadyan VGV7510KW22 (NOR)
657 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini kmod-usb-dwc2
658 endef
659 TARGET_DEVICES += VGV7510KW22NOR
660
661 define Device/VGV7510KW22BRN
662 $(Device/lantiqBrnImage)
663 IMAGE_SIZE := 7168k
664 SIGNATURE := 5D00008000
665 MAGIC := 0x12345678
666 CRC32_POLY := 0x2083b8ed
667 DEVICE_TITLE := o2 Box 6431 / Arcadyan VGV7510KW22 (BRN)
668 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini kmod-usb-dwc2
669 endef
670 TARGET_DEVICES += VGV7510KW22BRN
671
672 define Device/VGV7519NOR
673 IMAGE_SIZE := 15360k
674 DEVICE_TITLE := Experiabox 8 VGV7519
675 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini kmod-usb-dwc2
676 endef
677 TARGET_DEVICES += VGV7519NOR
678
679 define Device/VGV7519BRN
680 $(Device/lantiqBrnImage)
681 IMAGE_SIZE := 7168k
682 SIGNATURE := 5D00008000
683 MAGIC := 0x12345678
684 CRC32_POLY := 0x2083b8ed
685 DEVICE_TITLE := Experiabox 8 VGV7519 (BRN)
686 DEVICE_PACKAGES := kmod-rt2800-pci wpad-mini kmod-usb-dwc2
687 endef
688 TARGET_DEVICES += VGV7519BRN
689
690 endif
691
692 define Image/BuildNAND/squashfs
693 $(call prepare_generic_squashfs,$(KDIR)/root.$(1))
694 $(call Image/Build/UbinizeImage,$(2),,squashfs,$(UBI_OPTS))
695 $(call Image/Build/SysupgradeNAND,$(2),$(1),$(KDIR)/uImage-$(2))
696 endef
697
698 define Image/Build/ubifs
699 $(CP) $(KDIR)/root.ubifs $(BIN_DIR)/$(IMG_PREFIX)-$(2)-rootfs.ubifs
700 endef
701
702 define Image/Build/ubi
703 $(CP) $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(2)-rootfs.ubi
704 $(CP) $(KDIR)/root-overlay.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(2)-rootfs-overlay.ubi
705 endef
706
707 define Image/BuildEVA/ubi
708 $(CP) $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(2)-rootfs.ubi
709 $(CP) $(KDIR)/root-overlay.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(2)-rootfs-overlay.ubi
710 endef
711
712 define Image/BuildNAND/ubifs
713 $(call Image/Build/UbinizeImage,$(2),,ubifs,$(UBI_OPTS))
714 $(call Image/Build/SysupgradeNAND,$(2),$(1),$(KDIR)/uImage-$(2))
715 endef
716
717 define Image/BuildEVA/ubifs
718 $(CP) $(KDIR)/root.ubifs $(BIN_DIR)/$(IMG_PREFIX)-$(2)-rootfs.ubifs
719 endef
720
721 define Image/Prepare/Profile
722 $(call Image/Prepare/Profile/$(1))
723 endef
724
725 define Image/BuildKernel/Profile
726 $(call Image/BuildKernel/Profile/$(1))
727 endef
728
729 define Image/Build/Profile
730 $(call Image/Build/Profile/$(1),$(2))
731 endef
732
733 $(eval $(call BuildImage))