708150521e75e72c3753c483e97db37bc750c1b6
[openwrt/openwrt.git] / target / linux / ipq806x / image / Makefile
1 # Copyright (c) 2014 The Linux Foundation. All rights reserved.
2 #
3 include $(TOPDIR)/rules.mk
4 include $(INCLUDE_DIR)/image.mk
5
6 UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F
7
8 define Image/Prepare
9 $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/vmlinux-unstripped.elf
10 endef
11
12 define Image/BuildKernel
13 $(CP) $(KDIR)/vmlinux-unstripped.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf
14 endef
15
16 define Image/Build/squashfs
17 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
18 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
19 endef
20
21 define Image/Build
22 $(call Image/Build/$(1),$(1))
23 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-root.img bs=2k conv=sync
24 endef
25
26 define Device/Default
27 PROFILES := Default
28 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
29 KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
30 KERNEL_PREFIX := $$(IMAGE_PREFIX)
31 KERNEL_LOADADDR = 0x42208000
32 SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
33 IMAGE/sysupgrade.tar = sysupgrade-tar | append-metadata
34 endef
35
36 define Device/LegacyImage
37 KERNEL_SUFFIX := -uImage
38 KERNEL = kernel-bin | append-dtb | uImage none
39 KERNEL_NAME := zImage
40 endef
41
42 define Device/FitImage
43 KERNEL_SUFFIX := -fit-uImage.itb
44 KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
45 KERNEL_NAME := Image
46 endef
47
48 define Device/FitImageLzma
49 KERNEL_SUFFIX := -fit-uImage.itb
50 KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
51 KERNEL_NAME := Image
52 endef
53
54 define Device/UbiFit
55 KERNEL_IN_UBI := 1
56 IMAGES := nand-factory.ubi nand-sysupgrade.tar
57 IMAGE/nand-factory.ubi := append-ubi
58 IMAGE/nand-sysupgrade.tar := sysupgrade-tar | append-metadata
59 endef
60
61 define Device/DniImage
62 PROFILES += $$(DEVICE_NAME)
63 FILESYSTEMS := squashfs
64 KERNEL_SUFFIX := -uImage
65 KERNEL = kernel-bin | append-dtb | uImage none
66 KERNEL_NAME := zImage
67 NETGEAR_BOARD_ID :=
68 NETGEAR_HW_ID :=
69 UBINIZE_OPTS := -E 5
70 IMAGES := factory.img sysupgrade.tar
71 IMAGE/factory.img := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakeroot-hdr | pad-to $$$$(KERNEL_SIZE) | append-ubi | netgear-dni
72 IMAGE/sysupgrade.tar := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakeroot-hdr | sysupgrade-tar kernel=$$$$@ | append-metadata
73 endef
74 DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
75
76 define Device/TpSafeImage
77 PROFILES += $$(DEVICE_NAME)
78 FILESYSTEMS := squashfs
79 KERNEL_SUFFIX := -uImage
80 KERNEL = kernel-bin | append-dtb | uImage none
81 KERNEL_NAME := zImage
82 TPLINK_BOARD_ID :=
83 IMAGES := factory.bin sysupgrade.bin
84 IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
85 IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | append-metadata
86 endef
87 DEVICE_VARS += TPLINK_BOARD_ID
88
89 define Device/ZyXELImage
90 PROFILES += $$(DEVICE_NAME)
91 FILESYSTEMS := squashfs
92 KERNEL_SUFFIX := -uImage
93 KERNEL = kernel-bin | append-dtb | uImage none | pad-to $${KERNEL_SIZE}
94 KERNEL_NAME := zImage
95 IMAGES := sysupgrade.tar mmcblk0p5-rootfs.bin mmcblk0p4-kernel.bin
96 IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to $$$${BLOCKSIZE} | sysupgrade-tar rootfs=$$$$@ | append-metadata
97 IMAGE/mmcblk0p5-rootfs.bin := append-rootfs | pad-rootfs | pad-to $$$${BLOCKSIZE}
98 IMAGE/mmcblk0p4-kernel.bin := append-kernel
99 endef
100
101 define Device/avm_fritzbox-4040
102 $(call Device/FitImageLzma)
103 DEVICE_DTS := qcom-ipq4019-fritz4040
104 KERNEL_LOADADDR := 0x80208000
105 BLOCKSIZE := 4k
106 PAGESIZE := 256
107 BOARD_NAME := fritz4040
108 DEVICE_TITLE := AVM Fritz!Box 4040
109 IMAGE_SIZE := 29753344
110 IMAGES = sysupgrade.bin
111 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
112 DEVICE_PACKAGES := kmod-usb-phy-qcom-ipq4019 ipq-wifi-fritz4040 fritz-tffs fritz-caldata u-boot-fritz4040
113 endef
114 TARGET_DEVICES += avm_fritzbox-4040
115
116 define Device/linksys_ea8500
117 $(call Device/LegacyImage)
118 DEVICE_DTS := qcom-ipq8064-ea8500
119 PAGESIZE := 2048
120 BLOCKSIZE := 128k
121 KERNEL_SIZE := 3072k
122 FILESYSTEMS := squashfs
123 KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakeroot-hdr
124 PROFILES += $$(DEVICE_NAME)
125 BOARD_NAME := ea8500
126 SUPPORTED_DEVICES += ea8500
127 UBINIZE_OPTS := -E 5
128 IMAGES := factory.bin sysupgrade.tar
129 IMAGE/factory.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-ubi
130 DEVICE_TITLE := Linksys EA8500
131 DEVICE_PACKAGES := ath10k-firmware-qca99x0
132 endef
133 TARGET_DEVICES += linksys_ea8500
134
135 define Device/netgear_d7800
136 $(call Device/DniImage)
137 DEVICE_DTS := qcom-ipq8064-d7800
138 KERNEL_SIZE := 2097152
139 NETGEAR_BOARD_ID := D7800
140 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4
141 BLOCKSIZE := 128k
142 PAGESIZE := 2048
143 BOARD_NAME := d7800
144 SUPPORTED_DEVICES += d7800
145 DEVICE_TITLE := Netgear Nighthawk X4 D7800
146 DEVICE_PACKAGES := ath10k-firmware-qca99x0
147 endef
148 TARGET_DEVICES += netgear_d7800
149
150 define Device/netgear_r7500
151 $(call Device/DniImage)
152 DEVICE_DTS := qcom-ipq8064-r7500
153 KERNEL_SIZE := 2097152
154 NETGEAR_BOARD_ID := R7500
155 NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4
156 BLOCKSIZE := 128k
157 PAGESIZE := 2048
158 BOARD_NAME := r7500
159 SUPPORTED_DEVICES += r7500
160 DEVICE_TITLE := Netgear Nighthawk X4 R7500
161 DEVICE_PACKAGES := ath10k-firmware-qca988x
162 endef
163 TARGET_DEVICES += netgear_r7500
164
165 define Device/netgear_r7500v2
166 $(call Device/DniImage)
167 DEVICE_DTS := qcom-ipq8064-r7500v2
168 KERNEL_SIZE := 2097152
169 NETGEAR_BOARD_ID := R7500v2
170 NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4
171 BLOCKSIZE := 128k
172 PAGESIZE := 2048
173 BOARD_NAME := r7500v2
174 SUPPORTED_DEVICES += r7500v2
175 DEVICE_TITLE := Netgear Nighthawk X4 R7500v2
176 DEVICE_PACKAGES := ath10k-firmware-qca99x0 ath10k-firmware-qca988x
177 endef
178 TARGET_DEVICES += netgear_r7500v2
179
180 define Device/netgear_r7800
181 $(call Device/DniImage)
182 DEVICE_DTS := qcom-ipq8065-r7800
183 KERNEL_SIZE := 2097152
184 NETGEAR_BOARD_ID := R7800
185 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade
186 BLOCKSIZE := 128k
187 PAGESIZE := 2048
188 BOARD_NAME := r7800
189 SUPPORTED_DEVICES += r7800
190 DEVICE_TITLE := Netgear Nighthawk X4S R7800
191 DEVICE_PACKAGES := ath10k-firmware-qca9984
192 endef
193 TARGET_DEVICES += netgear_r7800
194
195 define Device/openmesh_a42
196 $(call Device/FitImageLzma)
197 FILESYSTEMS := squashfs
198 DEVICE_DTS := qcom-ipq4019-a42
199 KERNEL_LOADADDR := 0x80208000
200 BLOCKSIZE := 64k
201 SUPPORTED_DEVICES := openmesh,a42
202 DEVICE_TITLE := OpenMesh A42
203 KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE)
204 IMAGE_SIZE := 15616k
205 IMAGES = factory.bin sysupgrade.bin
206 IMAGE/factory.bin/squashfs := append-rootfs | pad-rootfs | openmesh-image ce_type=A42
207 IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
208 DEVICE_PACKAGES := ath10k-firmware-qca4019 uboot-envtools ipq-wifi-openmesh_a42
209 endef
210 TARGET_DEVICES += openmesh_a42
211
212 define Device/qcom_ap-dk01.1-c1
213 PROFILES += $$(DEVICE_NAME)
214 DEVICE_TITLE := QCA AP-DK01.1-C1
215 BOARD_NAME := ap-dk01.1-c1
216 DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
217 KERNEL_LOADADDR := 0x80208000
218 KERNEL_INSTALL := 1
219 KERNEL_SIZE := 4096k
220 IMAGE_SIZE := 26624k
221 FILESYSTEMS := squashfs
222 $(call Device/FitImage)
223 IMAGES := sysupgrade.bin
224 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
225 DEVICE_PACKAGES := ath10k-firmware-qca4019
226 endef
227 TARGET_DEVICES += qcom_ap-dk01.1-c1
228
229 define Device/qcom_ap-dk04.1-c1
230 $(call Device/FitImage)
231 $(call Device/UbiFit)
232 DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1
233 KERNEL_LOADADDR := 0x80208000
234 KERNEL_INSTALL := 1
235 KERNEL_SIZE := 4048k
236 BLOCKSIZE := 128k
237 PAGESIZE := 2048
238 BOARD_NAME := ap-dk04.1-c1
239 DEVICE_TITLE := QCA AP-DK04.1-C1
240 endef
241 TARGET_DEVICES += qcom_ap-dk04.1-c1
242
243 define Device/qcom_ipq8064-ap148
244 $(call Device/FitImage)
245 $(call Device/UbiFit)
246 DEVICE_DTS := qcom-ipq8064-ap148
247 KERNEL_INSTALL := 1
248 BLOCKSIZE := 128k
249 PAGESIZE := 2048
250 BOARD_NAME := ap148
251 SUPPORTED_DEVICES += ap148
252 DEVICE_TITLE := Qualcomm AP148
253 DEVICE_PACKAGES := ath10k-firmware-qca99x0
254 endef
255 TARGET_DEVICES += qcom_ipq8064-ap148
256
257 define Device/qcom_ipq8064-ap148-legacy
258 $(call Device/LegacyImage)
259 $(call Device/UbiFit)
260 DEVICE_DTS := qcom-ipq8064-ap148
261 BLOCKSIZE := 128k
262 PAGESIZE := 2048
263 BOARD_NAME := ap148
264 SUPPORTED_DEVICES := qcom,ipq8064-ap148 ap148
265 DEVICE_TITLE := Qualcomm AP148 (legacy)
266 DEVICE_PACKAGES := ath10k-firmware-qca99x0
267 endef
268 TARGET_DEVICES += qcom_ipq8064-ap148-legacy
269
270 define Device/qcom_ipq8064-db149
271 $(call Device/FitImage)
272 DEVICE_DTS := qcom-ipq8064-db149
273 KERNEL_INSTALL := 1
274 BOARD_NAME := db149
275 DEVICE_TITLE := Qualcomm DB149
276 DEVICE_PACKAGES := ath10k-firmware-qca99x0
277 endef
278 TARGET_DEVICES += qcom_ipq8064-db149
279
280 define Device/tplink_c2600
281 $(call Device/TpSafeImage)
282 DEVICE_DTS := qcom-ipq8064-c2600
283 BLOCKSIZE := 128k
284 PAGESIZE := 2048
285 BOARD_NAME := c2600
286 SUPPORTED_DEVICES += c2600
287 TPLINK_BOARD_ID := C2600
288 DEVICE_TITLE := TP-Link Archer C2600
289 DEVICE_PACKAGES := ath10k-firmware-qca99x0
290 endef
291 TARGET_DEVICES += tplink_c2600
292
293 define Device/tplink_vr2600v
294 PROFILES += $$(DEVICE_NAME)
295 FILESYSTEMS := squashfs
296 KERNEL_SUFFIX := -uImage
297 KERNEL = kernel-bin | append-dtb | uImage none
298 KERNEL_NAME := zImage
299 KERNEL_SIZE := 2097152
300 DEVICE_DTS := qcom-ipq8064-vr2600v
301 BLOCKSIZE := 128k
302 PAGESIZE := 2048
303 BOARD_NAME := vr2600v
304 SUPPORTED_DEVICES += vr2600v
305 DEVICE_TITLE := TP-Link Archer VR2600v
306 DEVICE_PACKAGES := ath10k-firmware-qca99x0
307 IMAGES := sysupgrade.bin
308 IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
309 endef
310 TARGET_DEVICES += tplink_vr2600v
311
312 define Device/zyxel_nbg6817
313 DEVICE_DTS := qcom-ipq8065-nbg6817
314 KERNEL_SIZE := 4096k
315 BLOCKSIZE := 64k
316 BOARD_NAME := nbg6817
317 SUPPORTED_DEVICES += nbg6817
318 DEVICE_TITLE := ZyXEL NBG6817
319 DEVICE_PACKAGES := ath10k-firmware-qca9984 e2fsprogs kmod-fs-ext4 losetup
320 $(call Device/ZyXELImage)
321 endef
322 TARGET_DEVICES += zyxel_nbg6817
323
324 $(eval $(call BuildImage))