From: Rafał Miłecki <ra...@milecki.pl>

Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
have it stored on flash and some need filesystem to provide it.

MediaTek holds its own AQR113C firmware file for its boards. Package it.

The problem is obtaining that firmware:
1. Cloning whole repo seems like an overkill for copying a single file
2. Public git server doesn't support git protocol (and so git archive)
3. Gitiles UI doesn't allow downloading raw files (nor binaries as text)

The only option seems to be downloading tar archive of "firmware"
directory. The problem is such archives generated by Gitiles differ on
every download so a checksum can't be specified.

Due to all above a custom download is implemented in "Build/Prepare".
Then firmware gets simply extracted and packaged.

Cc: Robert Marko <robima...@gmail.com>
Cc: Christian Marangi <ansuels...@gmail.com>
Cc: Daniel Golle <dan...@makrotopia.org>
Signed-off-by: Rafał Miłecki <ra...@milecki.pl>
---
 package/firmware/aquantia-firmware/Makefile | 36 +++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 package/firmware/aquantia-firmware/Makefile

diff --git a/package/firmware/aquantia-firmware/Makefile 
b/package/firmware/aquantia-firmware/Makefile
new file mode 100644
index 0000000000..9cf67f41bb
--- /dev/null
+++ b/package/firmware/aquantia-firmware/Makefile
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=aquantia-firmware
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aquantia-mediatek-aqr113c-firmware
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  TITLE:=MediaTek's firmware for Aquantia AQR113C
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+
+       # Download for "aquantia-mediatek-aqr113c-firmware" package
+       wget \
+               -O 
$(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
 \
+               
"https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+archive/refs/heads/master/21.02/files/target/linux/mediatek/mt7988/base-files/lib/firmware.tar.gz";
+       tar xf 
$(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
 -C $(PKG_BUILD_DIR)
+       # TODO: Verify extracted firmware checksum
+endef
+
+define Build/Compile
+
+endef
+
+define Package/aquantia-mediatek-aqr113c-firmware/install
+       $(INSTALL_DIR) $(1)/lib/firmware
+       $(INSTALL_DATA) 
$(PKG_BUILD_DIR)/Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld 
$(1)/lib/firmware/
+endef
+
+$(eval $(call BuildPackage,aquantia-mediatek-aqr113c-firmware))
-- 
2.35.3


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to