From d91cf7fdf40b1b45260f8b058da7541b17b75a4c Mon Sep 17 00:00:00 2001 From: David Wronek Date: Sat, 10 Dec 2022 11:18:13 +0100 Subject: [PATCH] xiaomi-surya: new device (MR 3706) Add support for the Xiaomi POCO X3 NFC. [ci:skip-build] already built successfully in CI --- device/testing/device-xiaomi-surya/APKBUILD | 59 +++++++++++++++ ...xiaomi-surya-nonfree-firmware.post-install | 3 + device/testing/device-xiaomi-surya/deviceinfo | 37 ++++++++++ device/testing/firmware-xiaomi-surya/APKBUILD | 74 +++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 device/testing/device-xiaomi-surya/APKBUILD create mode 100644 device/testing/device-xiaomi-surya/device-xiaomi-surya-nonfree-firmware.post-install create mode 100644 device/testing/device-xiaomi-surya/deviceinfo create mode 100644 device/testing/firmware-xiaomi-surya/APKBUILD diff --git a/device/testing/device-xiaomi-surya/APKBUILD b/device/testing/device-xiaomi-surya/APKBUILD new file mode 100644 index 000000000..abb5e77d5 --- /dev/null +++ b/device/testing/device-xiaomi-surya/APKBUILD @@ -0,0 +1,59 @@ +# Maintainer: David Wronek +# Co-Maintainer: Danila Tikhonov +# Reference: + +pkgname=device-xiaomi-surya +pkgdesc="Xiaomi POCO X3 NFC" +pkgver=1 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="aarch64" +options="!check !archcheck" +depends=" + linux-postmarketos-qcom-sm7150 + make-dynpart-mappings + mkbootimg + postmarketos-base + postmarketos-update-kernel +" +makedepends="devicepkg-dev" +source=" + deviceinfo +" + +subpackages=" + $pkgname-nonfree-firmware:nonfree_firmware +" + +build() { + devicepkg_build $startdir $pkgname +} + +package() { + devicepkg_package $startdir $pkgname +} + +nonfree_firmware() { + pkgdesc="Firmware for Modem, WiFi, Touchscreen, etc." + depends=" + firmware-xiaomi-surya-adsp + firmware-xiaomi-surya-cdsp + firmware-xiaomi-surya-ipa + firmware-xiaomi-surya-modem + firmware-xiaomi-surya-touchscreen + firmware-xiaomi-surya-wlan + linux-firmware-ath10k + linux-firmware-qca + msm-modem + msm-modem-uim-selection + pd-mapper + tqftpserv + " + install="$subpkgname.post-install" + mkdir "$subpkgdir" +} + +sha512sums=" +8fb0c1f3dbad1003b108bd7748a839f002c9c8caa3125148fb8818f5df540da81615428cbc5dfc28738d38460f3f1b4ec977c9f194447c0bc508bcd6a42f4276 deviceinfo +" diff --git a/device/testing/device-xiaomi-surya/device-xiaomi-surya-nonfree-firmware.post-install b/device/testing/device-xiaomi-surya/device-xiaomi-surya-nonfree-firmware.post-install new file mode 100644 index 000000000..70b9e0efe --- /dev/null +++ b/device/testing/device-xiaomi-surya/device-xiaomi-surya-nonfree-firmware.post-install @@ -0,0 +1,3 @@ +#!/bin/sh +rc-update add tqftpserv boot +rc-update add pd-mapper boot diff --git a/device/testing/device-xiaomi-surya/deviceinfo b/device/testing/device-xiaomi-surya/deviceinfo new file mode 100644 index 000000000..59b8dbb69 --- /dev/null +++ b/device/testing/device-xiaomi-surya/deviceinfo @@ -0,0 +1,37 @@ +# Reference: +# Please use double quotes only. You can source this file in shell +# scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Xiaomi POCO X3 NFC" +deviceinfo_manufacturer="Xiaomi" +deviceinfo_codename="xiaomi-surya" +deviceinfo_year="2020" +deviceinfo_dtb="qcom/sm7150-xiaomi-surya" +deviceinfo_append_dtb="true" +deviceinfo_arch="aarch64" +deviceinfo_flash_kernel_on_update="true" + +# Device related +deviceinfo_gpu_accelerated="true" +deviceinfo_chassis="handset" +deviceinfo_keyboard="false" +deviceinfo_external_storage="true" +deviceinfo_screen_width="1080" +deviceinfo_screen_height="2400" + +# Bootloader related +deviceinfo_flash_method="fastboot" +deviceinfo_kernel_cmdline="PMOS_NO_OUTPUT_REDIRECT" +deviceinfo_generate_bootimg="true" +deviceinfo_bootimg_qcdt="false" +deviceinfo_bootimg_mtk_mkimage="false" +deviceinfo_bootimg_dtb_second="false" +deviceinfo_flash_pagesize="4096" +deviceinfo_flash_offset_base="0x00000000" +deviceinfo_flash_offset_kernel="0x00008000" +deviceinfo_flash_offset_ramdisk="0x01000000" +deviceinfo_flash_offset_second="0x00000000" +deviceinfo_flash_offset_tags="0x00000100" +deviceinfo_rootfs_image_sector_size="4096" +deviceinfo_super_partitions="/dev/sda15" diff --git a/device/testing/firmware-xiaomi-surya/APKBUILD b/device/testing/firmware-xiaomi-surya/APKBUILD new file mode 100644 index 000000000..04be5e5ca --- /dev/null +++ b/device/testing/firmware-xiaomi-surya/APKBUILD @@ -0,0 +1,74 @@ +pkgname=firmware-xiaomi-surya +pkgver=1 +pkgrel=0 +pkgdesc="Firmware for Xiaomi POCO X3 NFC" +subpackages=" + $pkgname-adsp + $pkgname-cdsp + $pkgname-ipa + $pkgname-modem + $pkgname-touchscreen + $pkgname-wlan + " +url="https://github.com/sm7150-mainline/firmware-xiaomi-surya" +arch="aarch64" +license="proprietary" +options="!check !strip !archcheck !tracedeps pmb:cross-native" +_commit="47ee12fa953d87d10f61f67b51addd8e26d17899" +source="$pkgname-$_commit.tar.gz::$url/archive/$_commit/$pkgname-$_commit.tar.gz" +builddir="$srcdir/$pkgname-$_commit" + +package() { + # parent package is empty + mkdir -p "$pkgdir" +} + +adsp() { + pkgdesc="Xiaomi POCO X3 NFC adsp firmware" + + install -Dm644 "$builddir"/adsp* -t \ + "$subpkgdir/lib/firmware/qcom/sm7150/surya" +} + +cdsp() { + pkgdesc="Xiaomi POCO X3 NFC cdsp firmware" + + install -Dm644 "$builddir"/cdsp* -t \ + "$subpkgdir/lib/firmware/qcom/sm7150/surya" +} + +ipa() { + pkgdesc="Xiaomi POCO X3 NFC ipa firmware" + + install -Dm644 "$builddir"/ipa_fws.* -t \ + "$subpkgdir/lib/firmware/qcom/sm7150/surya" +} + +modem() { + pkgdesc="Xiaomi POCO X3 NFC modem firmware" + + # cp because of the modem_pr directory + mkdir -p "$subpkgdir/lib/firmware/qcom/sm7150/surya" + cp -r "$builddir"/modem* \ + "$subpkgdir/lib/firmware/qcom/sm7150/surya" + find "$subpkgdir/lib/firmware/qcom/sm7150/surya" \ + -type f -exec chmod 0644 {} \; +} + +touchscreen() { + pkgdesc="Xiaomi POCO X3 NFC touchscreen firmware" + + install -Dm644 "$builddir"/novatek_ts_huaxing_fw.bin -t \ + "$subpkgdir/lib/firmware" +} + +wlan() { + pkgdesc="Xiaomi POCO X3 NFC wlan firmware" + + install -Dm644 "$builddir"/wlanmdsp.mbn -t \ + "$subpkgdir/lib/firmware/qcom/sm7150/surya" +} + +sha512sums=" +cb540920f977a519e696009c62dbc70c12587d0523c57b5e0fa44432e391dadbc8b08d269ef4ab06f420a892dc98fd42900b8745b683824b91b86b4b483526b0 firmware-xiaomi-surya-47ee12fa953d87d10f61f67b51addd8e26d17899.tar.gz +"