ipq806x: convert to dt-based board-detection
[openwrt/staging/wigyori.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/qcom_ipq8064-ap148
102 $(call Device/FitImage)
103 $(call Device/UbiFit)
104 DEVICE_DTS := qcom-ipq8064-ap148
105 KERNEL_INSTALL := 1
106 BLOCKSIZE := 128k
107 PAGESIZE := 2048
108 BOARD_NAME := ap148
109 SUPPORTED_DEVICES += ap148
110 DEVICE_TITLE := Qualcomm AP148
111 DEVICE_PACKAGES := ath10k-firmware-qca99x0
112 endef
113 TARGET_DEVICES += qcom_ipq8064-ap148
114
115 define Device/qcom_ipq8064-ap148-legacy
116 $(call Device/LegacyImage)
117 $(call Device/UbiFit)
118 DEVICE_DTS := qcom-ipq8064-ap148
119 BLOCKSIZE := 128k
120 PAGESIZE := 2048
121 BOARD_NAME := ap148
122 SUPPORTED_DEVICES := qcom,ipq8064-ap148 ap148
123 DEVICE_TITLE := Qualcomm AP148 (legacy)
124 DEVICE_PACKAGES := ath10k-firmware-qca99x0
125 endef
126 TARGET_DEVICES += qcom_ipq8064-ap148-legacy
127
128 define Device/tplink_c2600
129 $(call Device/TpSafeImage)
130 DEVICE_DTS := qcom-ipq8064-c2600
131 BLOCKSIZE := 128k
132 PAGESIZE := 2048
133 BOARD_NAME := c2600
134 SUPPORTED_DEVICES += c2600
135 TPLINK_BOARD_ID := C2600
136 DEVICE_TITLE := TP-Link Archer C2600
137 DEVICE_PACKAGES := ath10k-firmware-qca99x0
138 endef
139 TARGET_DEVICES += tplink_c2600
140
141 define Device/netgear_d7800
142 $(call Device/DniImage)
143 DEVICE_DTS := qcom-ipq8064-d7800
144 KERNEL_SIZE := 2097152
145 NETGEAR_BOARD_ID := D7800
146 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4
147 BLOCKSIZE := 128k
148 PAGESIZE := 2048
149 BOARD_NAME := d7800
150 SUPPORTED_DEVICES += d7800
151 DEVICE_TITLE := Netgear Nighthawk X4 D7800
152 DEVICE_PACKAGES := ath10k-firmware-qca99x0
153 endef
154 TARGET_DEVICES += netgear_d7800
155
156 define Device/qcom_ipq8064-db149
157 $(call Device/FitImage)
158 DEVICE_DTS := qcom-ipq8064-db149
159 KERNEL_INSTALL := 1
160 BOARD_NAME := db149
161 DEVICE_TITLE := Qualcomm DB149
162 DEVICE_PACKAGES := ath10k-firmware-qca99x0
163 endef
164 TARGET_DEVICES += qcom_ipq8064-db149
165
166 define Device/linksys_ea8500
167 $(call Device/LegacyImage)
168 DEVICE_DTS := qcom-ipq8064-ea8500
169 PAGESIZE := 2048
170 BLOCKSIZE := 128k
171 KERNEL_SIZE := 3072k
172 FILESYSTEMS := squashfs
173 KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakeroot-hdr
174 PROFILES += $$(DEVICE_NAME)
175 BOARD_NAME := ea8500
176 SUPPORTED_DEVICES += ea8500
177 UBINIZE_OPTS := -E 5
178 IMAGES := factory.bin sysupgrade.tar
179 IMAGE/factory.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-ubi
180 DEVICE_TITLE := Linksys EA8500
181 DEVICE_PACKAGES := ath10k-firmware-qca99x0
182 endef
183 TARGET_DEVICES += linksys_ea8500
184
185 define Device/avm_fritzbox-4040
186 $(call Device/FitImageLzma)
187 DEVICE_DTS := qcom-ipq4019-fritz4040
188 KERNEL_LOADADDR := 0x80208000
189 BLOCKSIZE := 4k
190 PAGESIZE := 256
191 BOARD_NAME := fritz4040
192 DEVICE_TITLE := AVM Fritz!Box 4040
193 IMAGE_SIZE := 29753344
194 IMAGES = sysupgrade.bin
195 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
196 DEVICE_PACKAGES := kmod-usb-phy-qcom-ipq4019 ipq-wifi-fritz4040 fritz-tffs fritz-caldata u-boot-fritz4040
197 endef
198 TARGET_DEVICES += avm_fritzbox-4040
199
200 define Device/netgear_r7500
201 $(call Device/DniImage)
202 DEVICE_DTS := qcom-ipq8064-r7500
203 KERNEL_SIZE := 2097152
204 NETGEAR_BOARD_ID := R7500
205 NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4
206 BLOCKSIZE := 128k
207 PAGESIZE := 2048
208 BOARD_NAME := r7500
209 SUPPORTED_DEVICES += r7500
210 DEVICE_TITLE := Netgear Nighthawk X4 R7500
211 DEVICE_PACKAGES := ath10k-firmware-qca988x
212 endef
213 TARGET_DEVICES += netgear_r7500
214
215 define Device/netgear_r7500v2
216 $(call Device/DniImage)
217 DEVICE_DTS := qcom-ipq8064-r7500v2
218 KERNEL_SIZE := 2097152
219 NETGEAR_BOARD_ID := R7500v2
220 NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4
221 BLOCKSIZE := 128k
222 PAGESIZE := 2048
223 BOARD_NAME := r7500v2
224 SUPPORTED_DEVICES += r7500v2
225 DEVICE_TITLE := Netgear Nighthawk X4 R7500v2
226 DEVICE_PACKAGES := ath10k-firmware-qca99x0 ath10k-firmware-qca988x
227 endef
228 TARGET_DEVICES += netgear_r7500v2
229
230 define Device/netgear_r7800
231 $(call Device/DniImage)
232 DEVICE_DTS := qcom-ipq8065-r7800
233 KERNEL_SIZE := 2097152
234 NETGEAR_BOARD_ID := R7800
235 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade
236 BLOCKSIZE := 128k
237 PAGESIZE := 2048
238 BOARD_NAME := r7800
239 SUPPORTED_DEVICES += r7800
240 DEVICE_TITLE := Netgear Nighthawk X4S R7800
241 DEVICE_PACKAGES := ath10k-firmware-qca9984
242 endef
243 TARGET_DEVICES += netgear_r7800
244
245 define Device/zyxel_nbg6817
246 DEVICE_DTS := qcom-ipq8065-nbg6817
247 KERNEL_SIZE := 4096k
248 BLOCKSIZE := 64k
249 BOARD_NAME := nbg6817
250 SUPPORTED_DEVICES += nbg6817
251 DEVICE_TITLE := ZyXEL NBG6817
252 DEVICE_PACKAGES := ath10k-firmware-qca9984 e2fsprogs kmod-fs-ext4 losetup
253 $(call Device/ZyXELImage)
254 endef
255 TARGET_DEVICES += zyxel_nbg6817
256
257 define Device/tplink_vr2600v
258 PROFILES += $$(DEVICE_NAME)
259 FILESYSTEMS := squashfs
260 KERNEL_SUFFIX := -uImage
261 KERNEL = kernel-bin | append-dtb | uImage none
262 KERNEL_NAME := zImage
263 KERNEL_SIZE := 2097152
264 DEVICE_DTS := qcom-ipq8064-vr2600v
265 BLOCKSIZE := 128k
266 PAGESIZE := 2048
267 BOARD_NAME := vr2600v
268 SUPPORTED_DEVICES += vr2600v
269 DEVICE_TITLE := TP-Link Archer VR2600v
270 DEVICE_PACKAGES := ath10k-firmware-qca99x0
271 IMAGES := sysupgrade.bin
272 IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
273 endef
274 TARGET_DEVICES += tplink_vr2600v
275
276 define Device/qcom_ap-dk01.1-c1
277 PROFILES += $$(DEVICE_NAME)
278 DEVICE_TITLE := QCA AP-DK01.1-C1
279 BOARD_NAME := ap-dk01.1-c1
280 DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
281 KERNEL_LOADADDR := 0x80208000
282 KERNEL_INSTALL := 1
283 KERNEL_SIZE := 4096k
284 IMAGE_SIZE := 26624k
285 FILESYSTEMS := squashfs
286 $(call Device/FitImage)
287 IMAGES := sysupgrade.bin
288 IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
289 DEVICE_PACKAGES := ath10k-firmware-qca4019
290 endef
291 TARGET_DEVICES += qcom_ap-dk01.1-c1
292
293 define Device/qcom_ap-dk04.1-c1
294 $(call Device/FitImage)
295 $(call Device/UbiFit)
296 DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1
297 KERNEL_LOADADDR := 0x80208000
298 KERNEL_INSTALL := 1
299 KERNEL_SIZE := 4048k
300 BLOCKSIZE := 128k
301 PAGESIZE := 2048
302 BOARD_NAME := ap-dk04.1-c1
303 DEVICE_TITLE := QCA AP-DK04.1-C1
304 endef
305 TARGET_DEVICES += qcom_ap-dk04.1-c1
306
307 $(eval $(call BuildImage))