ed46bca6490b4e1fda2718720fb9bcf8975ce9a0
[oweals/openwrt.git] / target / linux / ipq40xx / image / Makefile
1 include $(TOPDIR)/rules.mk
2 include $(INCLUDE_DIR)/image.mk
3
4 DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION
5
6 define Device/Default
7         PROFILES := Default
8         KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
9         KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
10         KERNEL_PREFIX := $$(IMAGE_PREFIX)
11         KERNEL_LOADADDR := 0x80208000
12         SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
13         IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata
14         IMAGE/sysupgrade.bin/squashfs :=
15 endef
16
17 define Device/FitImage
18         KERNEL_SUFFIX := -fit-uImage.itb
19         KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
20         KERNEL_NAME := Image
21 endef
22
23 define Device/FitImageLzma
24         KERNEL_SUFFIX := -fit-uImage.itb
25         KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
26         KERNEL_NAME := Image
27 endef
28
29 define Device/FitzImage
30         KERNEL_SUFFIX := -fit-zImage.itb
31         KERNEL = kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
32         KERNEL_NAME := zImage
33 endef
34
35 define Device/UbiFit
36         KERNEL_IN_UBI := 1
37         IMAGES := nand-factory.ubi nand-sysupgrade.bin
38         IMAGE/nand-factory.ubi := append-ubi
39         IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata
40 endef
41
42 define Device/DniImage
43         KERNEL_SUFFIX := -fit-uImage.itb
44         KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
45         KERNEL_NAME := Image
46         NETGEAR_BOARD_ID :=
47         NETGEAR_HW_ID :=
48         IMAGES := factory.img sysupgrade.bin
49         IMAGE/factory.img := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | append-rootfs | pad-rootfs | netgear-dni
50         IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | append-rootfs | pad-rootfs | append-metadata
51 endef
52 DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
53
54 define Build/SenaoFW
55         -$(STAGING_DIR_HOST)/bin/mksenaofw \
56                 -n $(BOARD_NAME) -r $(VENDOR_ID) -p $(1) \
57                 -c $(DATECODE) -w $(2) -x $(CW_VER) -t 0 \
58                 -e $@ \
59                 -o $@.new
60         @cp $@.new $@
61 endef
62
63 define Device/8dev_jalapeno
64         $(call Device/FitImage)
65         $(call Device/UbiFit)
66         DEVICE_VENDOR := 8devices
67         DEVICE_MODEL := Jalapeno
68         DEVICE_DTS := qcom-ipq4018-jalapeno
69         BLOCKSIZE := 128k
70         PAGESIZE := 2048
71 endef
72 TARGET_DEVICES += 8dev_jalapeno
73
74 define Device/alfa-network_ap120c-ac
75         $(call Device/FitImage)
76         $(call Device/UbiFit)
77         DEVICE_VENDOR := ALFA Network
78         DEVICE_MODEL := AP120C-AC
79         DEVICE_DTS := qcom-ipq4018-ap120c-ac
80         DEVICE_PACKAGES := kmod-usb-acm \
81                 kmod-tpm-i2c-atmel uboot-envtools
82         BLOCKSIZE := 128k
83         PAGESIZE := 2048
84         IMAGE_SIZE := 65536k
85         IMAGES := nand-factory.bin nand-sysupgrade.bin
86         IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand
87 endef
88 TARGET_DEVICES += alfa-network_ap120c-ac
89
90 define Device/asus_map-ac2200
91         $(call Device/FitImageLzma)
92         DEVICE_VENDOR := ASUS
93         DEVICE_MODEL := Lyra (MAP-AC2200)
94         DEVICE_DTS := qcom-ipq4019-map-ac2200
95         IMAGES := sysupgrade.bin
96         DEVICE_PACKAGES := ath10k-firmware-qca9888-ct kmod-ath3k
97 endef
98 TARGET_DEVICES += asus_map-ac2200
99
100 define Device/asus_rt-ac58u
101         $(call Device/FitImageLzma)
102         DEVICE_VENDOR := ASUS
103         DEVICE_MODEL := RT-AC58U
104         DEVICE_DTS := qcom-ipq4018-rt-ac58u
105         BLOCKSIZE := 128k
106         PAGESIZE := 2048
107         DTB_SIZE := 65536
108         IMAGE_SIZE := 20439364
109         FILESYSTEMS := squashfs
110 #       Someone - in their infinite wisdom - decided to put the firmware
111 #       version in front of the image name \03\00\00\04 => Version 3.0.0.4
112 #       Since u-boot works with strings we either need another fixup step
113 #       to add a version... or we are very careful not to add '\0' into that
114 #       string and call it a day.... Yeah, we do the latter!
115         UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC58U')
116         IMAGES := sysupgrade.bin
117         DEVICE_PACKAGES := kmod-usb-ledtrig-usbport
118 endef
119 TARGET_DEVICES += asus_rt-ac58u
120
121 define Device/avm_fritzbox-4040
122         $(call Device/FitImageLzma)
123         DEVICE_VENDOR := AVM
124         DEVICE_MODEL := FRITZ!Box 4040
125         DEVICE_DTS := qcom-ipq4018-fritz4040
126         BOARD_NAME := fritz4040
127         IMAGE_SIZE := 29753344
128         UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-fritz4040.bin
129         UBOOT_PARTITION_SIZE := 524288
130         IMAGES = eva.bin sysupgrade.bin
131         IMAGE/eva.bin := append-uboot | pad-to $$$$(UBOOT_PARTITION_SIZE) | append-kernel | append-rootfs | pad-rootfs
132         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
133         DEVICE_PACKAGES := fritz-tffs fritz-caldata
134 endef
135 TARGET_DEVICES += avm_fritzbox-4040
136
137 define Device/avm_fritzbox-7530
138         $(call Device/FitImageLzma)
139         DEVICE_VENDOR := AVM
140         DEVICE_MODEL := FRITZ!Box 7530
141         DEVICE_DTS := qcom-ipq4019-fritzbox-7530
142         DEVICE_PACKAGES := fritz-caldata fritz-tffs-nand
143         IMAGES := sysupgrade.bin
144 endef
145 TARGET_DEVICES += avm_fritzbox-7530
146
147 define Device/avm_fritzrepeater-1200
148         $(call Device/FitImageLzma)
149         DEVICE_VENDOR := AVM
150         DEVICE_MODEL := FRITZ!Repeater 1200
151         DEVICE_DTS := qcom-ipq4019-fritzrepeater-1200
152         DEVICE_PACKAGES := fritz-caldata fritz-tffs-nand ipq-wifi-avm_fritzrepeater-1200
153         IMAGES := sysupgrade.bin
154 endef
155 TARGET_DEVICES += avm_fritzrepeater-1200
156
157 define Device/avm_fritzrepeater-3000
158         $(call Device/FitImageLzma)
159         DEVICE_VENDOR := AVM
160         DEVICE_MODEL := FRITZ!Repeater 3000
161         DEVICE_DTS := qcom-ipq4019-fritzrepeater-3000
162         DEVICE_PACKAGES := ath10k-firmware-qca9984-ct fritz-caldata fritz-tffs-nand
163         IMAGES := sysupgrade.bin
164 endef
165 TARGET_DEVICES += avm_fritzrepeater-3000
166
167 define Device/compex_wpj428
168         $(call Device/FitImage)
169         DEVICE_VENDOR := Compex
170         DEVICE_MODEL := WPJ428
171         DEVICE_DTS := qcom-ipq4028-wpj428
172         DEVICE_DTS_CONFIG := config@4
173         BLOCKSIZE := 64k
174         IMAGE_SIZE := 31232k
175         KERNEL_SIZE := 4096k
176         IMAGES = sysupgrade.bin
177         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
178         DEVICE_PACKAGES := kmod-gpio-beeper
179 endef
180 TARGET_DEVICES += compex_wpj428
181
182 define Device/engenius_eap1300
183         $(call Device/FitImage)
184         DEVICE_VENDOR := EnGenius
185         DEVICE_MODEL := EAP1300
186         DEVICE_DTS_CONFIG := config@4
187         BOARD_NAME := eap1300
188         DEVICE_DTS := qcom-ipq4018-eap1300
189         KERNEL_SIZE := 5120k
190         IMAGE_SIZE := 25344k
191         IMAGES := sysupgrade.bin
192         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
193 endef
194 TARGET_DEVICES += engenius_eap1300
195
196 define Device/engenius_ens620ext
197         $(call Device/FitImage)
198         DEVICE_VENDOR := EnGenius
199         DEVICE_MODEL := ENS620EXT
200         DEVICE_DTS := qcom-ipq4018-ens620ext
201         DEVICE_DTS_CONFIG := config@4
202         BLOCKSIZE := 64k
203         PAGESIZE := 256
204         BOARD_NAME := ENS620EXT
205         VENDOR_ID := 0x0101
206         PRODUCT_ID := 0x79
207         PRODUCT_ID_NEW := 0xA4
208         DATECODE := 190507
209         FW_VER := 3.1.2
210         FW_VER_NEW := 3.5.6
211         CW_VER := 1.8.99
212         IMAGE_SIZE := 21823488
213         KERNEL_SIZE := 5120k
214         FILESYSTEMS := squashfs
215         IMAGES := sysupgrade.bin factory_30.bin factory_35.bin
216         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | append-metadata
217         IMAGE/factory_30.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | SenaoFW $$$$(PRODUCT_ID) $$$$(FW_VER)
218         IMAGE/factory_35.bin := qsdk-ipq-factory-nor | check-size $$$$(IMAGE_SIZE) | SenaoFW $$$$(PRODUCT_ID_NEW) $$$$(FW_VER_NEW)
219 endef
220 TARGET_DEVICES += engenius_ens620ext
221
222 define Device/glinet_gl-b1300
223         $(call Device/FitImage)
224         DEVICE_VENDOR := GL.iNet
225         DEVICE_MODEL := GL-B1300
226         BOARD_NAME := gl-b1300
227         DEVICE_DTS := qcom-ipq4029-gl-b1300
228         KERNEL_SIZE := 4096k
229         IMAGE_SIZE := 26624k
230         IMAGES := sysupgrade.bin
231         IMAGE/sysupgrade.bin := append-kernel |append-rootfs | pad-rootfs | append-metadata
232 endef
233 TARGET_DEVICES += glinet_gl-b1300
234
235 define Device/linksys_ea6350v3
236         # The Linksys EA6350v3 has a uboot bootloader that does not
237         # support either booting lzma kernel images nor booting UBI
238         # partitions. This uboot, however, supports raw kernel images and
239         # gzipped images.
240         #
241         # As for the time of writing this, the device will boot the kernel
242         # from a fixed address with a fixed length of 3MiB. Also, the
243         # device has a hard-coded kernel command line that requieres the
244         # rootfs and alt_rootfs to be in mtd11 and mtd13 respectively.
245         # Oh... and the kernel partition overlaps with the rootfs
246         # partition (the same for alt_kernel and alt_rootfs).
247         #
248         # If you are planing re-partitioning the device, you may want to
249         # keep those details in mind:
250         # 1. The kernel adresses you should honor are 0x00000000 and
251         #    0x02800000 respectively.
252         # 2. The kernel size (plus the dtb) cannot exceed 3.00MiB in size.
253         # 3. You can use 'zImage', but not a raw 'Image' packed with lzma.
254         # 4. The kernel command line from uboot is harcoded to boot with
255         #    rootfs either in mtd11 or mtd13.
256         $(call Device/FitzImage)
257         DEVICE_VENDOR := Linksys
258         DEVICE_MODEL := EA6350
259         DEVICE_VARIANT := v3
260         DEVICE_DTS := qcom-ipq4018-ea6350v3
261         BLOCKSIZE := 128k
262         PAGESIZE := 2048
263         KERNEL_SIZE := 3145728
264         IMAGE_SIZE := 38797312
265         UBINIZE_OPTS := -E 5
266         IMAGES := factory.bin sysupgrade.bin
267         IMAGE/factory.bin := append-kernel | append-uImage-fakehdr filesystem | pad-to $$$${KERNEL_SIZE} | append-ubi | linksys-image type=EA6350v3
268         DEVICE_PACKAGES := uboot-envtools
269 endef
270 TARGET_DEVICES += linksys_ea6350v3
271
272 define Device/linksys_ea8300
273         $(call Device/FitzImage)
274         DEVICE_VENDOR := Linksys
275         DEVICE_MODEL := EA8300
276         DEVICE_DTS := qcom-ipq4019-linksys_ea8300
277         KERNEL_SIZE := 3072k
278         IMAGE_SIZE := 87040k
279         BLOCKSIZE := 128k
280         PAGESIZE := 2048
281         UBINIZE_OPTS := -E 5    # EOD marks to "hide" factory sig at EOF
282         IMAGES := sysupgrade.bin factory.bin
283         IMAGE/factory.bin  := append-kernel | pad-to $$$${KERNEL_SIZE} | append-ubi | linksys-image type=EA8300
284         DEVICE_PACKAGES := uboot-envtools ath10k-firmware-qca9888-ct ipq-wifi-linksys_ea8300 kmod-usb-ledtrig-usbport
285 endef
286 TARGET_DEVICES += linksys_ea8300
287
288 define Device/meraki_mr33
289         $(call Device/FitImage)
290         DEVICE_VENDOR := Cisco Meraki
291         DEVICE_MODEL := MR33
292         DEVICE_DTS := qcom-ipq4029-mr33
293         BLOCKSIZE := 131072
294         PAGESIZE := 2048
295         IMAGES = sysupgrade.bin
296         DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct
297 endef
298 TARGET_DEVICES += meraki_mr33
299
300 define Device/netgear_ex61x0v2
301         $(call Device/DniImage)
302         DEVICE_DTS_CONFIG := config@4
303         NETGEAR_BOARD_ID := EX6150v2series
304         NETGEAR_HW_ID := 29765285+16+0+128+2x2
305 endef
306
307 define Device/netgear_ex6100v2
308         $(call Device/netgear_ex61x0v2)
309         DEVICE_VENDOR := Netgear
310         DEVICE_MODEL := EX6100
311         DEVICE_VARIANT := v2
312         DEVICE_DTS := qcom-ipq4018-ex6100v2
313 endef
314 TARGET_DEVICES += netgear_ex6100v2
315
316 define Device/netgear_ex6150v2
317         $(call Device/netgear_ex61x0v2)
318         DEVICE_VENDOR := Netgear
319         DEVICE_MODEL := EX6150
320         DEVICE_VARIANT := v2
321         DEVICE_DTS := qcom-ipq4018-ex6150v2
322 endef
323 TARGET_DEVICES += netgear_ex6150v2
324
325 define Device/openmesh_a42
326         $(call Device/FitImageLzma)
327         DEVICE_VENDOR := OpenMesh
328         DEVICE_MODEL := A42
329         DEVICE_DTS := qcom-ipq4018-a42
330         DEVICE_DTS_CONFIG := config@om.a42
331         BLOCKSIZE := 64k
332         KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE)
333         IMAGE_SIZE := 15616k
334         IMAGES = factory.bin sysupgrade.bin
335         IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A42
336         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
337         DEVICE_PACKAGES := uboot-envtools
338 endef
339 TARGET_DEVICES += openmesh_a42
340
341 define Device/openmesh_a62
342         $(call Device/FitImageLzma)
343         DEVICE_VENDOR := OpenMesh
344         DEVICE_MODEL := A62
345         DEVICE_DTS := qcom-ipq4019-a62
346         DEVICE_DTS_CONFIG := config@om.a62
347         BLOCKSIZE := 64k
348         KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE)
349         IMAGE_SIZE := 15552k
350         IMAGES = factory.bin sysupgrade.bin
351         IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A62
352         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
353         DEVICE_PACKAGES := ath10k-firmware-qca9888-ct uboot-envtools
354 endef
355
356 TARGET_DEVICES += openmesh_a62
357
358 define Device/qcom_ap-dk01.1-c1
359         DEVICE_VENDOR := Qualcomm Atheros
360         DEVICE_MODEL := AP-DK01.1
361         DEVICE_VARIANT := C1
362         BOARD_NAME := ap-dk01.1-c1
363         DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
364         KERNEL_INSTALL := 1
365         KERNEL_SIZE := 4096k
366         IMAGE_SIZE := 26624k
367         $(call Device/FitImage)
368         IMAGES := sysupgrade.bin
369         IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
370 endef
371 TARGET_DEVICES += qcom_ap-dk01.1-c1
372
373 define Device/qcom_ap-dk04.1-c1
374         $(call Device/FitImage)
375         $(call Device/UbiFit)
376         DEVICE_VENDOR := Qualcomm Atheros
377         DEVICE_MODEL := AP-DK04.1
378         DEVICE_VARIANT := C1
379         DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1
380         KERNEL_INSTALL := 1
381         KERNEL_SIZE := 4048k
382         BLOCKSIZE := 128k
383         PAGESIZE := 2048
384         BOARD_NAME := ap-dk04.1-c1
385 endef
386 TARGET_DEVICES += qcom_ap-dk04.1-c1
387
388 define Device/qxwlan_e2600ac-c1
389         $(call Device/FitImage)
390         DEVICE_VENDOR := Qxwlan
391         DEVICE_MODEL := E2600AC
392         DEVICE_VARIANT := C1
393         BOARD_NAME := e2600ac-c1
394         DEVICE_DTS := qcom-ipq4019-qxwlan-e2600ac-c1
395         KERNEL_SIZE := 4096k
396         IMAGE_SIZE := 31232k
397         IMAGES := sysupgrade.bin
398         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
399         DEVICE_PACKAGES := ipq-wifi-qxwlan_e2600ac
400 endef
401 TARGET_DEVICES += qxwlan_e2600ac-c1
402
403 define Device/qxwlan_e2600ac-c2
404         $(call Device/FitImage)
405         $(call Device/UbiFit)
406         DEVICE_VENDOR := Qxwlan
407         DEVICE_MODEL := E2600AC
408         DEVICE_VARIANT := C2
409         DEVICE_DTS := qcom-ipq4019-qxwlan-e2600ac-c2
410         KERNEL_INSTALL := 1
411         BLOCKSIZE := 128k
412         PAGESIZE := 2048
413         DEVICE_PACKAGES := ipq-wifi-qxwlan_e2600ac
414 endef
415 TARGET_DEVICES += qxwlan_e2600ac-c2
416
417 define Device/unielec_u4019-32m
418         $(call Device/FitImage)
419         DEVICE_VENDOR := Unielec
420         DEVICE_MODEL := U4019
421         DEVICE_VARIANT := 32M
422         BOARD_NAME := u4019-32m
423         DEVICE_DTS := qcom-ipq4019-unielec-u4019-32m
424         KERNEL_SIZE := 4096k
425         IMAGE_SIZE := 31232k
426         IMAGES := sysupgrade.bin
427         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
428 endef
429 TARGET_DEVICES += unielec_u4019-32m
430
431 define Device/zyxel_nbg6617
432         $(call Device/FitImageLzma)
433         DEVICE_VENDOR := ZyXEL
434         DEVICE_MODEL := NBG6617
435         DEVICE_DTS := qcom-ipq4018-nbg6617
436         ROOTFS_SIZE := 24960k
437         RAS_BOARD := NBG6617
438         RAS_ROOTFS_SIZE := 19840k
439         RAS_VERSION := "$(VERSION_DIST) $(REVISION)"
440         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
441         IMAGES := sysupgrade.bin factory.bin
442 #       The ZyXEL firmware allows flashing thru the web-gui only when the rootfs is
443 #       at least as large as the one of the initial firmware image (not the current
444 #       one on the device). This only applies to the Web-UI, the bootlaoder ignores
445 #       this minimum-size. However, the larger image can be flashed both ways.
446         IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k | check-size $$$$(ROOTFS_SIZE) | zyxel-ras-image separate-kernel
447         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | check-size $$$$(ROOTFS_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
448         DEVICE_PACKAGES := uboot-envtools kmod-usb-ledtrig-usbport
449 endef
450 TARGET_DEVICES += zyxel_nbg6617
451
452 define Device/zyxel_wre6606
453         $(call Device/FitImage)
454         DEVICE_VENDOR := ZyXEL
455         DEVICE_MODEL := WRE6606
456         DEVICE_DTS_CONFIG := config@4
457         DEVICE_DTS := qcom-ipq4018-wre6606
458         IMAGES := sysupgrade.bin
459         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
460 endef
461 TARGET_DEVICES += zyxel_wre6606
462
463 $(eval $(call BuildImage))