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