f7e7ba3d0f31857d882d742d97d565c56a18258c
[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
55 define Device/8dev_jalapeno
56         $(call Device/FitImage)
57         $(call Device/UbiFit)
58         DEVICE_DTS := qcom-ipq4018-jalapeno
59         BLOCKSIZE := 128k
60         PAGESIZE := 2048
61         DEVICE_TITLE := 8devices Jalapeno
62 endef
63 TARGET_DEVICES += 8dev_jalapeno
64
65 define Device/alfa-network_ap120c-ac
66         $(call Device/FitImage)
67         $(call Device/UbiFit)
68         DEVICE_TITLE := ALFA Network AP120C-AC
69         DEVICE_DTS := qcom-ipq4018-ap120c-ac
70         DEVICE_PACKAGES := ipq-wifi-alfa-network_ap120c-ac kmod-usb-acm \
71                 kmod-tpm-i2c-atmel uboot-envtools
72         BLOCKSIZE := 128k
73         PAGESIZE := 2048
74         IMAGE_SIZE := 65536k
75         IMAGES := nand-factory.bin nand-sysupgrade.bin
76         IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand
77 endef
78 TARGET_DEVICES += alfa-network_ap120c-ac
79
80 define Device/asus_map-ac2200
81         $(call Device/FitImageLzma)
82         DEVICE_DTS := qcom-ipq4019-map-ac2200
83         DEVICE_TITLE := ASUS Lyra MAP-AC2200
84         IMAGES := sysupgrade.bin
85         DEVICE_PACKAGES := ipq-wifi-asus_map-ac2200 ath10k-firmware-qca9888-ct kmod-ath3k
86 endef
87 TARGET_DEVICES += asus_map-ac2200
88
89 define Device/asus_rt-ac58u
90         $(call Device/FitImageLzma)
91         DEVICE_DTS := qcom-ipq4018-rt-ac58u
92         BLOCKSIZE := 128k
93         PAGESIZE := 2048
94         DTB_SIZE := 65536
95         DEVICE_TITLE := Asus RT-AC58U
96         IMAGE_SIZE := 20439364
97         FILESYSTEMS := squashfs
98 #       Someone - in their infinite wisdom - decided to put the firmware
99 #       version in front of the image name \03\00\00\04 => Version 3.0.0.4
100 #       Since u-boot works with strings we either need another fixup step
101 #       to add a version... or we are very careful not to add '\0' into that
102 #       string and call it a day.... Yeah, we do the latter!
103         UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC58U')
104         IMAGES := sysupgrade.bin
105         DEVICE_PACKAGES := kmod-usb-ledtrig-usbport
106 endef
107 TARGET_DEVICES += asus_rt-ac58u
108
109 define Device/avm_fritzbox-4040
110         $(call Device/FitImageLzma)
111         DEVICE_DTS := qcom-ipq4018-fritz4040
112         BOARD_NAME := fritz4040
113         DEVICE_TITLE := AVM Fritz!Box 4040
114         IMAGE_SIZE := 29753344
115         UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-fritz4040.bin
116         UBOOT_PARTITION_SIZE := 524288
117         IMAGES = eva.bin sysupgrade.bin
118         IMAGE/eva.bin := append-uboot | pad-to $$$$(UBOOT_PARTITION_SIZE) | append-kernel | append-rootfs | pad-rootfs
119         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
120         DEVICE_PACKAGES := fritz-tffs fritz-caldata
121 endef
122 TARGET_DEVICES += avm_fritzbox-4040
123
124 define Device/compex_wpj428
125         $(call Device/FitImage)
126         DEVICE_DTS := qcom-ipq4028-wpj428
127         DEVICE_DTS_CONFIG := config@4
128         BLOCKSIZE := 64k
129         DEVICE_TITLE := Compex WPJ428
130         IMAGE_SIZE := 31232k
131         KERNEL_SIZE := 4096k
132         IMAGES = sysupgrade.bin
133         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
134         DEVICE_PACKAGES := kmod-gpio-beeper
135 endef
136 TARGET_DEVICES += compex_wpj428
137
138 define Device/engenius_eap1300
139         $(call Device/FitImage)
140         DEVICE_TITLE := EnGenius EAP1300
141         DEVICE_DTS_CONFIG := config@4
142         BOARD_NAME := eap1300
143         DEVICE_DTS := qcom-ipq4018-eap1300
144         KERNEL_SIZE := 5120k
145         IMAGE_SIZE := 25344k
146         IMAGES := sysupgrade.bin
147         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
148         DEVICE_PACKAGES := ipq-wifi-engenius_eap1300
149 endef
150 TARGET_DEVICES += engenius_eap1300
151
152 define Device/glinet_gl-b1300
153         $(call Device/FitImage)
154         DEVICE_TITLE := GL.iNet GL-B1300
155         BOARD_NAME := gl-b1300
156         DEVICE_DTS := qcom-ipq4029-gl-b1300
157         KERNEL_SIZE := 4096k
158         IMAGE_SIZE := 26624k
159         IMAGES := sysupgrade.bin
160         IMAGE/sysupgrade.bin := append-kernel |append-rootfs | pad-rootfs | append-metadata
161 endef
162 TARGET_DEVICES += glinet_gl-b1300
163
164 define Device/linksys_ea6350v3
165         # The Linksys EA6350v3 has a uboot bootloader that does not
166         # support either booting lzma kernel images nor booting UBI
167         # partitions. This uboot, however, supports raw kernel images and
168         # gzipped images.
169         #
170         # As for the time of writing this, the device will boot the kernel
171         # from a fixed address with a fixed length of 3MiB. Also, the
172         # device has a hard-coded kernel command line that requieres the
173         # rootfs and alt_rootfs to be in mtd11 and mtd13 respectively.
174         # Oh... and the kernel partition overlaps with the rootfs
175         # partition (the same for alt_kernel and alt_rootfs).
176         #
177         # If you are planing re-partitioning the device, you may want to
178         # keep those details in mind:
179         # 1. The kernel adresses you should honor are 0x00000000 and
180         #    0x02800000 respectively.
181         # 2. The kernel size (plus the dtb) cannot exceed 3.00MiB in size.
182         # 3. You can use 'zImage', but not a raw 'Image' packed with lzma.
183         # 4. The kernel command line from uboot is harcoded to boot with
184         #    rootfs either in mtd11 or mtd13.
185         $(call Device/FitzImage)
186         DEVICE_TITLE := Linksys EA6350v3
187         DEVICE_DTS := qcom-ipq4018-ea6350v3
188         BLOCKSIZE := 128k
189         PAGESIZE := 2048
190         KERNEL_SIZE := 3145728
191         IMAGE_SIZE := 38797312
192         UBINIZE_OPTS := -E 5
193         IMAGES := factory.bin sysupgrade.bin
194         IMAGE/factory.bin := append-kernel | append-uImage-fakehdr filesystem | pad-to $$$${KERNEL_SIZE} | append-ubi | linksys-image type=EA6350v3
195         DEVICE_PACKAGES := ipq-wifi-linksys_ea6350v3 uboot-envtools
196 endef
197 TARGET_DEVICES += linksys_ea6350v3
198
199 define Device/meraki_mr33
200         $(call Device/FitImage)
201         DEVICE_DTS := qcom-ipq4029-mr33
202         BLOCKSIZE := 131072
203         PAGESIZE := 2048
204         DEVICE_TITLE := Cisco Meraki MR33
205         IMAGES = sysupgrade.bin
206         DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct
207 endef
208 TARGET_DEVICES += meraki_mr33
209
210 define Device/netgear_ex61x0v2
211         $(call Device/DniImage)
212         DEVICE_DTS_CONFIG := config@4
213         NETGEAR_BOARD_ID := EX6150v2series
214         NETGEAR_HW_ID := 29765285+16+0+128+2x2
215 endef
216
217 define Device/netgear_ex6100v2
218         $(call Device/netgear_ex61x0v2)
219         DEVICE_DTS := qcom-ipq4018-ex6100v2
220         DEVICE_TITLE := Netgear EX6100v2
221 endef
222 TARGET_DEVICES += netgear_ex6100v2
223
224 define Device/netgear_ex6150v2
225         $(call Device/netgear_ex61x0v2)
226         DEVICE_DTS := qcom-ipq4018-ex6150v2
227         DEVICE_TITLE := Netgear EX6150v2
228 endef
229 TARGET_DEVICES += netgear_ex6150v2
230
231 define Device/openmesh_a42
232         $(call Device/FitImageLzma)
233         DEVICE_DTS := qcom-ipq4018-a42
234         DEVICE_DTS_CONFIG := config@om.a42
235         BLOCKSIZE := 64k
236         DEVICE_TITLE := OpenMesh A42
237         KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE)
238         IMAGE_SIZE := 15616k
239         IMAGES = factory.bin sysupgrade.bin
240         IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A42
241         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
242         DEVICE_PACKAGES := uboot-envtools
243 endef
244 TARGET_DEVICES += openmesh_a42
245
246 define Device/openmesh_a62
247         $(call Device/FitImageLzma)
248         DEVICE_DTS := qcom-ipq4019-a62
249         DEVICE_DTS_CONFIG := config@om.a62
250         BLOCKSIZE := 64k
251         DEVICE_TITLE := OpenMesh A62
252         KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE)
253         IMAGE_SIZE := 15552k
254         IMAGES = factory.bin sysupgrade.bin
255         IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A62
256         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
257         DEVICE_PACKAGES := ath10k-firmware-qca9888-ct uboot-envtools
258 endef
259
260 TARGET_DEVICES += openmesh_a62
261
262 define Device/qcom_ap-dk01.1-c1
263         DEVICE_TITLE := QCA AP-DK01.1-C1
264         BOARD_NAME := ap-dk01.1-c1
265         DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
266         KERNEL_INSTALL := 1
267         KERNEL_SIZE := 4096k
268         IMAGE_SIZE := 26624k
269         $(call Device/FitImage)
270         IMAGES := sysupgrade.bin
271         IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
272 endef
273 TARGET_DEVICES += qcom_ap-dk01.1-c1
274
275 define Device/qcom_ap-dk04.1-c1
276         $(call Device/FitImage)
277         $(call Device/UbiFit)
278         DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1
279         KERNEL_INSTALL := 1
280         KERNEL_SIZE := 4048k
281         BLOCKSIZE := 128k
282         PAGESIZE := 2048
283         BOARD_NAME := ap-dk04.1-c1
284         DEVICE_TITLE := QCA AP-DK04.1-C1
285 endef
286 TARGET_DEVICES += qcom_ap-dk04.1-c1
287
288 define Device/zyxel_nbg6617
289         $(call Device/FitImageLzma)
290         DEVICE_DTS := qcom-ipq4018-nbg6617
291         DEVICE_TITLE := ZyXEL NBG6617
292         ROOTFS_SIZE := 24960k
293         RAS_BOARD := NBG6617
294         RAS_ROOTFS_SIZE := 19840k
295         RAS_VERSION := "$(VERSION_DIST) $(REVISION)"
296         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
297         IMAGES := sysupgrade.bin factory.bin
298 #       The ZyXEL firmware allows flashing thru the web-gui only when the rootfs is
299 #       at least as large as the one of the initial firmware image (not the current
300 #       one on the device). This only applies to the Web-UI, the bootlaoder ignores
301 #       this minimum-size. However, the larger image can be flashed both ways.
302         IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k | check-size $$$$(ROOTFS_SIZE) | zyxel-ras-image separate-kernel
303         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | check-size $$$$(ROOTFS_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
304         DEVICE_PACKAGES := uboot-envtools kmod-usb-ledtrig-usbport
305 endef
306 TARGET_DEVICES += zyxel_nbg6617
307
308 define Device/zyxel_wre6606
309         $(call Device/FitImage)
310         DEVICE_TITLE := ZyXEL WRE6606
311         DEVICE_DTS_CONFIG := config@4
312         DEVICE_DTS := qcom-ipq4018-wre6606
313         IMAGES := sysupgrade.bin
314         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
315 endef
316 TARGET_DEVICES += zyxel_wre6606
317
318 $(eval $(call BuildImage))