ipq806x: fix Netgear X4 R7500 ath10k firmware selection
[openwrt/staging/chunkeey.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 KERNEL_LOADADDR := 0x42208000
9
10 define Image/Prepare
11 $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf
12 mkimage -A arm -O linux -T filesystem -C none \
13 -a $(KERNEL_LOADADDR) -e $(KERNEL_LOADADDR) \
14 -n 'ARM OpenWrt fakeroot' \
15 -s $(KDIR_TMP)/root.dummy-uImage.tmp
16 echo -ne '\xff' > $(KDIR_TMP)/root.dummy
17 cat $(KDIR_TMP)/root.dummy $(KDIR_TMP)/root.dummy-uImage.tmp > $(KDIR)/root.dummy
18 endef
19
20 define Image/BuildKernel
21 $(CP) $(KDIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR)
22 endef
23
24 define Image/Build/squashfs
25 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
26 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
27 endef
28
29 define Image/Build
30 $(call Image/Build/$(1),$(1))
31 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-root.img bs=2k conv=sync
32 endef
33
34 define Build/append-file
35 cat $(1) >> $@
36 endef
37
38 define Device/Default
39 PROFILES := Default
40 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
41 KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
42 KERNEL_PREFIX := $$(IMAGE_PREFIX)
43 SUPPORTED_DEVICES = $$(BOARD_NAME)
44 IMAGE/sysupgrade.tar = sysupgrade-tar | append-metadata
45 endef
46
47 define Device/LegacyImage
48 KERNEL_SUFFIX := -uImage
49 KERNEL = kernel-bin | append-dtb | uImage none
50 KERNEL_NAME := zImage
51 endef
52
53 define Device/FitImage
54 KERNEL_SUFFIX := -fit-uImage.itb
55 KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
56 KERNEL_NAME := Image
57 endef
58
59 define Device/UbiFit
60 KERNEL_IN_UBI := 1
61 IMAGES := nand-factory.ubi nand-sysupgrade.tar
62 IMAGE/nand-factory.ubi := append-ubi
63 IMAGE/nand-sysupgrade.tar := sysupgrade-tar | append-metadata
64 endef
65
66 define Device/DniImage
67 PROFILES += $$(DEVICE_NAME)
68 FILESYSTEMS := squashfs
69 KERNEL_SUFFIX := -uImage
70 KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
71 KERNEL = kernel-bin | append-dtb | pad-to $$$$(($$(KERNEL_SIZE)-2*64-1)) | uImage none | append-file $(KDIR)/root.dummy
72 KERNEL_NAME := zImage
73 NETGEAR_BOARD_ID :=
74 NETGEAR_HW_ID :=
75 UBINIZE_OPTS := -E 5
76 IMAGES := factory.img sysupgrade.tar
77 IMAGE/factory.img := append-kernel | append-ubi | netgear-dni
78 endef
79 DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
80
81 define Device/TpSafeImage
82 PROFILES += $$(DEVICE_NAME)
83 FILESYSTEMS := squashfs
84 KERNEL_SUFFIX := -uImage
85 KERNEL = kernel-bin | append-dtb | uImage none
86 KERNEL_NAME := zImage
87 TPLINK_BOARD_NAME :=
88 IMAGES := factory.bin sysupgrade.bin
89 IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
90 IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | append-metadata
91 endef
92 DEVICE_VARS += TPLINK_BOARD_NAME
93
94 define Device/ZyXELImage
95 PROFILES += $$(DEVICE_NAME)
96 FILESYSTEMS := squashfs
97 KERNEL_SUFFIX := -uImage
98 KERNEL = kernel-bin | append-dtb | uImage none | pad-to $${KERNEL_SIZE}
99 KERNEL_NAME := zImage
100 IMAGES := sysupgrade.tar mmcblk0p5-rootfs.bin mmcblk0p4-kernel.bin
101 IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to $$$${BLOCKSIZE} | sysupgrade-tar rootfs=$$$$@ | append-metadata
102 IMAGE/mmcblk0p5-rootfs.bin := append-rootfs | pad-rootfs | pad-to $$$${BLOCKSIZE}
103 IMAGE/mmcblk0p4-kernel.bin := append-kernel
104 endef
105
106 define Device/AP148
107 $(call Device/FitImage)
108 $(call Device/UbiFit)
109 DEVICE_DTS := qcom-ipq8064-ap148
110 BLOCKSIZE := 128k
111 PAGESIZE := 2048
112 BOARD_NAME := ap148
113 DEVICE_TITLE := Qualcomm AP148
114 DEVICE_PACKAGES := ath10k-firmware-qca99x0
115 endef
116
117 define Device/AP148-legacy
118 $(call Device/LegacyImage)
119 $(call Device/UbiFit)
120 DEVICE_DTS := qcom-ipq8064-ap148
121 BLOCKSIZE := 128k
122 PAGESIZE := 2048
123 BOARD_NAME := ap148
124 DEVICE_TITLE := Qualcomm AP148 (legacy)
125 DEVICE_PACKAGES := ath10k-firmware-qca99x0
126 endef
127
128 define Device/C2600
129 $(call Device/TpSafeImage)
130 DEVICE_DTS := qcom-ipq8064-c2600
131 BLOCKSIZE := 128k
132 PAGESIZE := 2048
133 BOARD_NAME := c2600
134 TPLINK_BOARD_NAME := C2600
135 DEVICE_TITLE := TP-Link Archer C2600
136 DEVICE_PACKAGES := ath10k-firmware-qca99x0
137 endef
138
139 define Device/D7800
140 $(call Device/DniImage)
141 DEVICE_DTS := qcom-ipq8064-d7800
142 KERNEL_SIZE := 2097152
143 NETGEAR_BOARD_ID := D7800
144 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4
145 BLOCKSIZE := 128k
146 PAGESIZE := 2048
147 BOARD_NAME := d7800
148 DEVICE_TITLE := Netgear Nighthawk X4 D7800
149 DEVICE_PACKAGES := ath10k-firmware-qca99x0
150 endef
151
152 define Device/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
161 define Device/EA8500
162 $(call Device/LegacyImage)
163 DEVICE_DTS := qcom-ipq8064-ea8500
164 PAGESIZE := 2048
165 BLOCKSIZE := 128k
166 KERNEL_SIZE := 3072k
167 FILESYSTEMS := squashfs
168 KERNEL = kernel-bin | append-dtb | uImage none | append-file $(KDIR)/root.dummy
169 PROFILES += $$(DEVICE_NAME)
170 BOARD_NAME := ea8500
171 UBINIZE_OPTS := -E 5
172 IMAGES := factory.bin sysupgrade.tar
173 IMAGE/factory.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-ubi
174 DEVICE_TITLE := Linksys EA8500
175 DEVICE_PACKAGES := ath10k-firmware-qca99x0
176 endef
177
178 define Device/R7500
179 $(call Device/DniImage)
180 DEVICE_DTS := qcom-ipq8064-r7500
181 KERNEL_SIZE := 2097152
182 NETGEAR_BOARD_ID := R7500
183 NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4
184 BLOCKSIZE := 128k
185 PAGESIZE := 2048
186 BOARD_NAME := r7500
187 DEVICE_TITLE := Netgear Nighthawk X4 R7500
188 DEVICE_PACKAGES := ath10k-firmware-qca988x
189 endef
190
191 define Device/R7500v2
192 $(call Device/DniImage)
193 DEVICE_DTS := qcom-ipq8064-r7500v2
194 KERNEL_SIZE := 2097152
195 NETGEAR_BOARD_ID := R7500v2
196 NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4
197 BLOCKSIZE := 128k
198 PAGESIZE := 2048
199 BOARD_NAME := r7500v2
200 DEVICE_TITLE := Netgear Nighthawk X4 R7500v2
201 DEVICE_PACKAGES := ath10k-firmware-qca99x0 ath10k-firmware-qca988x
202 endef
203
204 define Device/R7800
205 $(call Device/DniImage)
206 DEVICE_DTS := qcom-ipq8065-r7800
207 KERNEL_SIZE := 2097152
208 NETGEAR_BOARD_ID := R7800
209 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade
210 BLOCKSIZE := 128k
211 PAGESIZE := 2048
212 BOARD_NAME := r7800
213 DEVICE_TITLE := Netgear Nighthawk X4S R7800
214 DEVICE_PACKAGES := ath10k-firmware-qca9984
215 endef
216
217 define Device/NBG6817
218 DEVICE_DTS := qcom-ipq8065-nbg6817
219 KERNEL_SIZE := 4096k
220 BLOCKSIZE := 64k
221 BOARD_NAME := nbg6817
222 DEVICE_TITLE := ZyXEL NBG6817
223 DEVICE_PACKAGES := ath10k-firmware-qca9984 e2fsprogs losetup
224 $(call Device/ZyXELImage)
225 endef
226
227 define Device/VR2600v
228 PROFILES += $$(DEVICE_NAME)
229 FILESYSTEMS := squashfs
230 KERNEL_SUFFIX := -uImage
231 KERNEL = kernel-bin | append-dtb | uImage none
232 KERNEL_NAME := zImage
233 KERNEL_SIZE := 2097152
234 DEVICE_DTS := qcom-ipq8064-vr2600v
235 BLOCKSIZE := 128k
236 PAGESIZE := 2048
237 BOARD_NAME := vr2600v
238 DEVICE_TITLE := TP-Link Archer VR2600v
239 DEVICE_PACKAGES := ath10k-firmware-qca99x0
240 IMAGES := sysupgrade.bin
241 IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
242 endef
243
244 TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 R7800 NBG6817 VR2600v
245
246 $(eval $(call BuildImage))