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