From 1cbc5a52bd208101752b8d15f9eb5c98f6f5f8c2 Mon Sep 17 00:00:00 2001
From: Dmitry Kuznetsov <entrider@riseup.net>
Date: Tue, 11 Jan 2022 14:19:47 +0300
Subject: [PATCH] ark-peach: add device (ARK Benefit A3) (MR 2812)

---
 device/testing/device-ark-peach/APKBUILD   | 29 +++++++++++++++++++
 device/testing/device-ark-peach/deviceinfo | 33 ++++++++++++++++++++++
 device/testing/firmware-ark-peach/APKBUILD | 30 ++++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 device/testing/device-ark-peach/APKBUILD
 create mode 100644 device/testing/device-ark-peach/deviceinfo
 create mode 100644 device/testing/firmware-ark-peach/APKBUILD

diff --git a/device/testing/device-ark-peach/APKBUILD b/device/testing/device-ark-peach/APKBUILD
new file mode 100644
index 00000000000..6223da675a0
--- /dev/null
+++ b/device/testing/device-ark-peach/APKBUILD
@@ -0,0 +1,29 @@
+# Reference: <https://postmarketos.org/devicepkg>
+pkgname=device-ark-peach
+pkgdesc="ARK Benefit A3"
+pkgver=1
+pkgrel=0
+url="https://postmarketos.org"
+license="MIT"
+arch="aarch64"
+options="!check !archcheck"
+depends="postmarketos-base mkbootimg linux-postmarketos-qcom-msm8916 soc-qcom-msm8916"
+makedepends="devicepkg-dev"
+source="deviceinfo"
+subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
+
+build() {
+	devicepkg_build $startdir $pkgname
+}
+
+package() {
+	devicepkg_package $startdir $pkgname
+}
+
+nonfree_firmware() {
+	pkgdesc="GPU/WiFi/BT/Modem/Video firmware"
+	depends="firmware-qcom-adreno-a300 msm-firmware-loader firmware-qcom-msm8916-wcnss firmware-qcom-msm8916-venus firmware-ark-peach-wcnss-nv"
+	mkdir "$subpkgdir"
+}
+
+sha512sums="cc78b3779893a3f851205d448eaf9f76556427c25f0dcf2dadbe1a3706507a77945440c8fa2765819beeb108c02998fb247ec806d4982346d84864dc597f5b68  deviceinfo"
diff --git a/device/testing/device-ark-peach/deviceinfo b/device/testing/device-ark-peach/deviceinfo
new file mode 100644
index 00000000000..51440b4c333
--- /dev/null
+++ b/device/testing/device-ark-peach/deviceinfo
@@ -0,0 +1,33 @@
+# Reference: <https://postmarketos.org/deviceinfo>
+# Please use double quotes only. You can source this file in shell scripts.
+
+deviceinfo_format_version="0"
+deviceinfo_name="ARK Benefit A3"
+deviceinfo_manufacturer="ARK"
+deviceinfo_codename="ark-peach"
+deviceinfo_year="2015"
+deviceinfo_dtb="qcom/msm8916-ark-peach"
+deviceinfo_append_dtb="true"
+deviceinfo_modules_initfs="panel-ark-peach-nt35521-dj msm goodix"
+deviceinfo_arch="aarch64"
+
+# Device related
+deviceinfo_chassis="handset"
+deviceinfo_gpu_accelerated="true"
+deviceinfo_keyboard="false"
+deviceinfo_external_storage="true"
+deviceinfo_screen_width="720"
+deviceinfo_screen_height="1280"
+deviceinfo_getty="ttyMSM0;115200"
+
+# Bootloader related
+deviceinfo_flash_method="fastboot"
+deviceinfo_kernel_cmdline="earlycon console=ttyMSM0,115200 PMOS_NO_OUTPUT_REDIRECT"
+deviceinfo_generate_bootimg="true"
+deviceinfo_flash_offset_base="0x80000000"
+deviceinfo_flash_offset_kernel="0x00080000"
+deviceinfo_flash_offset_ramdisk="0x02000000"
+deviceinfo_flash_offset_second="0x00f00000"
+deviceinfo_flash_offset_tags="0x01e00000"
+deviceinfo_flash_pagesize="2048"
+deviceinfo_flash_sparse="true"
diff --git a/device/testing/firmware-ark-peach/APKBUILD b/device/testing/firmware-ark-peach/APKBUILD
new file mode 100644
index 00000000000..5a72c9ba2da
--- /dev/null
+++ b/device/testing/firmware-ark-peach/APKBUILD
@@ -0,0 +1,30 @@
+pkgname=firmware-ark-peach
+pkgver=1
+pkgrel=0
+pkgdesc="Firmware for ARK Benefit A3"
+url="https://postmarketos.org"
+subpackages="$pkgname-wcnss-nv:wcnss_nv"
+arch="aarch64"
+license="proprietary"
+options="!check !strip !archcheck !tracedeps pmb:cross-native"
+source="$pkgname-WCNSS_qcom_wlan_nv.bin.base64::https://pastebin.com/raw/F2zDaaqf"
+
+_fwdir="/lib/firmware/postmarketos"
+
+unpack() {
+	default_unpack
+	base64 -d $pkgname-WCNSS_qcom_wlan_nv.bin.base64 > WCNSS_qcom_wlan_nv.bin
+}
+
+package() {
+	mkdir -p "$pkgdir"
+}
+
+wcnss_nv() {
+	pkgdesc="ARK Benefit A3 WiFi/BT firmware configuration"
+	replaces="firmware-ark-peach-wcnss"
+	install -Dm644 "$srcdir"/WCNSS_qcom_wlan_nv.bin -t "$subpkgdir/$_fwdir"/wlan/prima
+}
+sha512sums="
+214a1e9ec215f4cdf25fee73b2cec446815131b1de283c887a30ea41deffd54c78e7d56cc7f895c5832d568eb336ec8c5ebc114f8a0d331876f940276741c082  firmware-ark-peach-WCNSS_qcom_wlan_nv.bin.base64
+"
-- 
GitLab