From 053aaff9b0195327e1a601949542e2151a388c77 Mon Sep 17 00:00:00 2001
From: Danct12 <danct12@disroot.org>
Date: Mon, 7 Mar 2022 11:46:52 +0700
Subject: [PATCH] firmware-fxtec-msm8998: add fxtec firmware

---
 .../30-gpu-firmware.files                     |  4 ++
 .../testing/firmware-fxtec-msm8998/APKBUILD   | 40 +++++++++++++++++++
 .../firmware-fxtec-msm8998.post-install       |  3 ++
 .../firmware-fxtec-msm8998/firmware.files     | 16 ++++++++
 4 files changed, 63 insertions(+)
 create mode 100644 device/testing/firmware-fxtec-msm8998/30-gpu-firmware.files
 create mode 100644 device/testing/firmware-fxtec-msm8998/APKBUILD
 create mode 100644 device/testing/firmware-fxtec-msm8998/firmware-fxtec-msm8998.post-install
 create mode 100644 device/testing/firmware-fxtec-msm8998/firmware.files

diff --git a/device/testing/firmware-fxtec-msm8998/30-gpu-firmware.files b/device/testing/firmware-fxtec-msm8998/30-gpu-firmware.files
new file mode 100644
index 00000000000..5f4dfe18420
--- /dev/null
+++ b/device/testing/firmware-fxtec-msm8998/30-gpu-firmware.files
@@ -0,0 +1,4 @@
+/lib/firmware/qcom/a530_pfp.fw
+/lib/firmware/qcom/a530_pm4.fw
+/lib/firmware/qcom/a540_gpmu.fw2
+/lib/firmware/qcom/a540_zap.mbn
diff --git a/device/testing/firmware-fxtec-msm8998/APKBUILD b/device/testing/firmware-fxtec-msm8998/APKBUILD
new file mode 100644
index 00000000000..bfa3c58d318
--- /dev/null
+++ b/device/testing/firmware-fxtec-msm8998/APKBUILD
@@ -0,0 +1,40 @@
+pkgname=firmware-fxtec-msm8998
+pkgver=1.0
+pkgrel=1
+_commit="24ffeacde36b4094976ecabcf00ff6f59d632069"
+pkgdesc="Firmware for Fxtec Pro1 (QX1000)"
+url="https://github.com/pmsourcedump/firmware-fxtec-qx1000"
+arch="aarch64"
+# soc-qcom-sdm845-nonfree-firmware is also applicable to msm8998
+depends="soc-qcom-sdm845-nonfree-firmware qcom-diag linux-firmware-ath10k linux-firmware-qca linux-firmware-qcom"
+install="$pkgname.post-install"
+license="proprietary"
+options="!check !archcheck !strip !tracedeps"
+source="
+	$pkgname-$_commit.tar.gz::https://github.com/pmsourcedump/firmware-fxtec-qx1000/archive/$_commit.tar.gz
+	30-gpu-firmware.files
+	firmware.files
+"
+subpackages="$pkgname-initramfs:firmware_initramfs"
+builddir="$srcdir/firmware-fxtec-qx1000-$_commit"
+
+package() {
+	while IFS="" read -r fw; do
+		install -Dm644 "$fw" "$pkgdir/lib/firmware/$fw"
+	done < "$srcdir"/firmware.files
+}
+
+firmware_initramfs() {
+	pkgdesc="Files to be included in the initramfs to support osk-sdl"
+	depends="$pkgname mesa-egl mesa-gbm"
+	install_if="$pkgname"
+
+	install -Dm644 "$srcdir"/30-gpu-firmware.files \
+		"$subpkgdir"/etc/postmarketos-mkinitfs/files/30-gpu-firmware.files
+}
+
+sha512sums="
+cbe9e5fc6c3ef4491010c5f5c38eaabe66750d4c0bcf9fbda4e7ac580c17d40d515a97b81dab3cab49997cac5551ab9c231764e2741d53bfb879e0b57dd2f6f7  firmware-fxtec-msm8998-24ffeacde36b4094976ecabcf00ff6f59d632069.tar.gz
+974b7bcef52b4ae6d6fa11212ede1ddc9a9944dc3d6b066b0813072d8a9586929db8052670d98277db15cc1e2aa2d731c97c9c3d443f26bd3afab7e885230cba  30-gpu-firmware.files
+e97faf99592cffb5137e8b0cadf7185aa0a274291320fa8f5c06bfedaf356884ae7f6a19f5af535edb26a617785423cafe057b05c67a9df6badbf4a16d94685d  firmware.files
+"
diff --git a/device/testing/firmware-fxtec-msm8998/firmware-fxtec-msm8998.post-install b/device/testing/firmware-fxtec-msm8998/firmware-fxtec-msm8998.post-install
new file mode 100644
index 00000000000..268eff4bd08
--- /dev/null
+++ b/device/testing/firmware-fxtec-msm8998/firmware-fxtec-msm8998.post-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+# The Wi-Fi firmware will keep crashing if diag-router isn't running
+rc-update add diag-router boot
diff --git a/device/testing/firmware-fxtec-msm8998/firmware.files b/device/testing/firmware-fxtec-msm8998/firmware.files
new file mode 100644
index 00000000000..2d39fa69603
--- /dev/null
+++ b/device/testing/firmware-fxtec-msm8998/firmware.files
@@ -0,0 +1,16 @@
+ath10k/WCN3990/hw1.0/board-2.bin
+qcom/a540_gpmu.fw2
+qcom/a540_zap.mbn
+qcom/msm8998/fxtec/a540_zap.mbn
+qcom/msm8998/fxtec/adsp.mbn
+qcom/msm8998/fxtec/adspua.jsn
+qcom/msm8998/fxtec/ipa_fws.mbn
+qcom/msm8998/fxtec/mba.mbn
+qcom/msm8998/fxtec/modem.mbn
+qcom/msm8998/fxtec/modemr.jsn
+qcom/msm8998/fxtec/modemuw.jsn
+qcom/msm8998/fxtec/slpi_v2.mbn
+qcom/msm8998/fxtec/slpir.jsn
+qcom/msm8998/fxtec/slpius.jsn
+qcom/msm8998/fxtec/venus.mbn
+qcom/msm8998/fxtec/wlanmdsp.mbn
-- 
GitLab