ipq-wifi: improve and update instructions on how to add board files
[openwrt/staging/wigyori.git] / package / firmware / ipq-wifi / Makefile
1 include $(TOPDIR)/rules.mk
2 include $(INCLUDE_DIR)/version.mk
3
4 PKG_NAME:=ipq-wifi
5 PKG_RELEASE:=1
6
7 PKG_SOURCE_PROTO:=git
8 PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git
9 PKG_SOURCE_DATE:=2023-09-16
10 PKG_SOURCE_VERSION:=57aa1b1562ac60f11a6bec8be02cd3b68b12b3fa
11 PKG_MIRROR_HASH:=f8f9ab78ae85180a6e601d7c911d6c350b0cc132172d4baefc8f9fe07566ce0f
12
13 PKG_FLAGS:=nonshared
14
15 include $(INCLUDE_DIR)/package.mk
16
17 define Build/Compile
18 endef
19
20 # Use ath10k-bdencoder from https://github.com/qca/qca-swiss-army-knife.git
21 # to generate the board-* files here.
22 #
23 # This is intended to be used on an interim basis until device-specific
24 # board data for new devices is available through the upstream compilation
25 #
26 # Please send a mail with your device-specific board files upstream.
27 # You can find instructions and examples on the linux-wireless wiki:
28 # <https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>
29
30 ALLWIFIBOARDS:= \
31 buffalo_wxr-5950ax12 \
32 compex_wpq873 \
33 dynalink_dl-wrx36 \
34 edgecore_eap102 \
35 edimax_cax1800 \
36 netgear_rax120v2 \
37 netgear_wax218 \
38 netgear_wax620 \
39 prpl_haze \
40 qnap_301w \
41 redmi_ax6 \
42 wallys_dr40x9 \
43 xiaomi_ax3600 \
44 xiaomi_ax9000 \
45 yyets_le1 \
46 zte_mf289f \
47 zte_mf287 \
48 zte_mf287plus \
49 zyxel_nbg7815
50
51 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD))
52
53 define Package/ipq-wifi-default
54 SUBMENU:=ath10k Board-Specific Overrides
55 SECTION:=firmware
56 CATEGORY:=Firmware
57 DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax)
58 TITLE:=Custom Board
59 endef
60
61 define ipq-wifi-install-one-to
62 $(INSTALL_DIR) $(2)/lib/firmware/ath10k/$(3)/
63 $(INSTALL_DATA) $(1) $(2)/lib/firmware/ath10k/$(3)/board-2.bin
64 endef
65
66 define ipq-wifi-install-ath11-one-to
67 $(INSTALL_DIR) $(2)/lib/firmware/ath11k/$(3)/
68 $(INSTALL_DATA) $(1) $(2)/lib/firmware/ath11k/$(3)/board-2.bin
69 endef
70
71 define ipq-wifi-install-one
72 $(if $(filter $(suffix $(1)),.QCA4019 .qca4019),\
73 $(call ipq-wifi-install-one-to,$(1),$(2),QCA4019/hw1.0),\
74 $(if $(filter $(suffix $(1)),.QCA9888 .qca9888),\
75 $(call ipq-wifi-install-one-to,$(1),$(2),QCA9888/hw2.0),\
76 $(if $(filter $(suffix $(1)),.QCA9889 .qca9889),\
77 $(call ipq-wifi-install-one-to,$(1),$(2),QCA9887/hw1.0),\
78 $(if $(filter $(suffix $(1)),.QCA9984 .qca9984),\
79 $(call ipq-wifi-install-one-to,$(1),$(2),QCA9984/hw1.0),\
80 $(if $(filter $(suffix $(1)),.QCA99X0 .qca99x0),\
81 $(call ipq-wifi-install-one-to,$(1),$(2),QCA99X0/hw2.0),\
82 $(if $(filter $(suffix $(1)),.IPQ8074 .ipq8074),\
83 $(call ipq-wifi-install-ath11-one-to,$(1),$(2),IPQ8074/hw2.0),\
84 $(if $(filter $(suffix $(1)),.QCN9074 .qcn9074),\
85 $(call ipq-wifi-install-ath11-one-to,$(1),$(2),QCN9074/hw1.0),\
86 $(error Unrecognized board-file suffix '$(suffix $(1))' for '$(1)')\
87 )))))))
88
89 endef
90 # Blank line required at end of above define due to foreach context
91
92 define generate-ipq-wifi-package
93 define Package/ipq-wifi-$(1)
94 $(call Package/ipq-wifi-default)
95 TITLE:=board-2.bin Overrides for $(2)
96 CONFLICTS:=$(PREV_BOARD)
97 endef
98
99 define Package/ipq-wifi-$(1)/description
100 The $(2) requires board-specific, reference ("cal") data
101 that is not yet present in the upstream wireless firmware distribution.
102
103 This package supplies board-2.bin file(s) that, in the interim,
104 overwrite those supplied by the ath10k-firmware-* packages.
105
106 This is package is only necessary for the $(2).
107
108 Do not install it for any other device!
109 endef
110
111 define Package/ipq-wifi-$(1)/install-overlay
112 $$$$(foreach IPQ_WIFI_BOARD_FILE,$$$$(wildcard $(PKG_BUILD_DIR)/board-$(1).*),\
113 $$$$(call ipq-wifi-install-one,$$$$(IPQ_WIFI_BOARD_FILE),$$(1)))
114 endef
115
116 PREV_BOARD+=ipq-wifi-$(1)
117 endef
118
119 # To add local files for testing:
120 # 1. create a new directory in the ipq-wifi package directory called "files".
121 # 2. place there the needed board files.
122 #
123 # To send a board file upstream:
124 # 1. create a pull request in https://github.com/openwrt/firmware_qca-wireless or
125 # send a patch to the mailing list adding the tag firmware/qca-wireless before
126 # the PATCH tag.
127 # 2. create a pull request in the main openwrt repository bumping the ipq-wifi
128 # package to the new version and adding the required lines to add the board file.
129 #
130 # Changes needed to the ipq-wifi Makefile:
131 # 1. Add board name to ALLWIFIBOARDS
132 # 2. Add $(eval $(call generate-ipq-wifi-package,<devicename>,<display name>))
133 #
134 # Board files should follow this name structure:
135 # board-<devicename>.<qca4019|qca9888|qca9889|qca9984|qca99x0|ipq8074>
136
137 $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
138 $(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873))
139 $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36))
140 $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102))
141 $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800))
142 $(eval $(call generate-ipq-wifi-package,netgear_rax120v2,Netgear RAX120v2))
143 $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218))
144 $(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620))
145 $(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))
146 $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze))
147 $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
148 $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9))
149 $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600))
150 $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000))
151 $(eval $(call generate-ipq-wifi-package,yyets_le1,YYeTs LE1))
152 $(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F))
153 $(eval $(call generate-ipq-wifi-package,zte_mf287,ZTE MF287))
154 $(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus))
155 $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815))
156
157 $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE))))