From 37a4121e086892e4670c5dfbfa99713348a1e8e4 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Wed, 21 Apr 2021 15:42:05 +0200 Subject: [PATCH] huawei-g7: new device (Huawei Ascend G7) (MR 2287) The Huawei Ascend G7 is based on Qualcomm MSM8916 and therefore makes use of linux-postmarketos-qcom-msm8916 as a close-to-mainline kernel. Initially supported features: - USB - Storage (eMMC, SD card) - Display - Touchscreen, Buttons, Vibrator - Notification LED - WiFi/Bluetooth - Accelerometer, Magnetometer, Proximity - Audio - NFC The modem needs more work to work around strange Huawei firmware mess. Note that the Huawei shipped an outdated firmware version that does not support booting aarch64 kernels (like used in this device port). However, the device does not verify firmware signatures so it is possible to flash firmware from other devices. This is mostly described in the wiki, but unfortunately it's quite complex. However, the aarch64 version of linux-postmarketos-qcom-msm8916 receives much more testing so I would like to avoid adding more armv7 MSM8916 devices unless absolutely necessary. For pointercal: Screen dimension 720x1280 Touchscreen dimension (reported by evtest) 1100x1900 720/1100*65536 = ~42896 1280/1900*65536 = ~44151 Offset doesn't seem to be needed. [ci:skip-build] already built successfully in CI --- device/testing/device-huawei-g7/APKBUILD | 32 ++++++++++++++++++++++ device/testing/device-huawei-g7/deviceinfo | 32 ++++++++++++++++++++++ device/testing/device-huawei-g7/pointercal | 1 + device/testing/firmware-huawei-g7/APKBUILD | 29 ++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 device/testing/device-huawei-g7/APKBUILD create mode 100644 device/testing/device-huawei-g7/deviceinfo create mode 100644 device/testing/device-huawei-g7/pointercal create mode 100644 device/testing/firmware-huawei-g7/APKBUILD diff --git a/device/testing/device-huawei-g7/APKBUILD b/device/testing/device-huawei-g7/APKBUILD new file mode 100644 index 000000000..59d1a9281 --- /dev/null +++ b/device/testing/device-huawei-g7/APKBUILD @@ -0,0 +1,32 @@ +# Reference: +# Maintainer: Minecrell +pkgname=device-huawei-g7 +pkgdesc="Huawei Ascend G7" +pkgver=1 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="aarch64" +options="!check !archcheck" +depends="postmarketos-base mkbootimg soc-qcom-msm8916 linux-postmarketos-qcom-msm8916" +makedepends="devicepkg-dev" +source="deviceinfo pointercal" +subpackages="$pkgname-nonfree-firmware:nonfree_firmware" + +build() { + devicepkg_build $startdir $pkgname +} + +package() { + devicepkg_package $startdir $pkgname + install -D -m644 "$srcdir"/pointercal "$pkgdir"/etc/pointercal +} + +nonfree_firmware() { + pkgdesc="GPU/WiFi/BT/Video firmware" + depends="linux-firmware-qcom firmware-qcom-msm8916-wcnss firmware-huawei-g7-wcnss-nv" + mkdir "$subpkgdir" +} + +sha512sums="9631a0ef5e6e9a63a919d45a8d604b89589672fdb3b24c68e5e33b7edb26a72de6cb82efffb89bfa0be0a2678a626044e615b03af6595b5cc9fc83c9bc763031 deviceinfo +b47b3eee3f330408ea28f89b0a70752466f1ab854fc7c4677157fd2dcf5a546d1056b1fbfac587ece827b7ae864e969f0fef6981e4e9802b159f88d03fe9b487 pointercal" diff --git a/device/testing/device-huawei-g7/deviceinfo b/device/testing/device-huawei-g7/deviceinfo new file mode 100644 index 000000000..9346267f1 --- /dev/null +++ b/device/testing/device-huawei-g7/deviceinfo @@ -0,0 +1,32 @@ +# Reference: +# Please use double quotes only. You can source this file in shell scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Huawei Ascend G7" +deviceinfo_manufacturer="Huawei" +deviceinfo_codename="huawei-g7" +deviceinfo_year="2014" +deviceinfo_dtb="qcom/msm8916-huawei-g7" +deviceinfo_append_dtb="true" +deviceinfo_modules_initfs="panel-huawei-tianma-nt35521 msm rmi-i2c" +deviceinfo_arch="aarch64" + +# Device related +deviceinfo_chassis="handset" +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/device-huawei-g7/pointercal b/device/testing/device-huawei-g7/pointercal new file mode 100644 index 000000000..e70c8086b --- /dev/null +++ b/device/testing/device-huawei-g7/pointercal @@ -0,0 +1 @@ +42896 0 0 0 44151 0 65536 720 1280 0 diff --git a/device/testing/firmware-huawei-g7/APKBUILD b/device/testing/firmware-huawei-g7/APKBUILD new file mode 100644 index 000000000..a0aa2b541 --- /dev/null +++ b/device/testing/firmware-huawei-g7/APKBUILD @@ -0,0 +1,29 @@ +pkgname=firmware-huawei-g7 +pkgver=1 +pkgrel=0 +pkgdesc="Firmware for Huawei Ascend G7" +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/UmTSZBW7" + +_fwdir="/lib/firmware/postmarketos" + +unpack() { + default_unpack + base64 -d $pkgname-WCNSS_qcom_wlan_nv.bin.base64 > WCNSS_qcom_wlan_nv.bin +} + +package() { + # parent package is empty + mkdir -p "$pkgdir" +} + +wcnss_nv() { + pkgdesc="Huawei Ascend G7 WiFi/BT firmware configuration" + install -Dm644 "$srcdir"/WCNSS_qcom_wlan_nv.bin -t "$subpkgdir/$_fwdir"/wlan/prima +} + +sha512sums="0202ce7d2f736a6a2d37ab571233d715376184c647ba916d9e3e9aaf1408f1aa41f877d6f805d274ead1440dabf295e7477da6957555604cee90ecd5a9a3a24b firmware-huawei-g7-WCNSS_qcom_wlan_nv.bin.base64"