diff --git a/device/testing/device-xiaomi-wt88047/APKBUILD b/device/testing/device-xiaomi-wt88047/APKBUILD new file mode 100644 index 000000000..7408a6db7 --- /dev/null +++ b/device/testing/device-xiaomi-wt88047/APKBUILD @@ -0,0 +1,72 @@ +# Reference: +pkgname=device-xiaomi-wt88047 +pkgdesc="Xiaomi Redmi 2" +pkgver=1 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="aarch64" +options="!check !archcheck" +depends="postmarketos-base mkbootimg soc-qcom-msm8916" +makedepends="devicepkg-dev" +source="deviceinfo modprobe.conf" +subpackages=" + $pkgname-kernel-mainline:kernel_mainline + $pkgname-kernel-mainline-modem-wt86047:kernel_mainline_modem_wt86047 + $pkgname-kernel-mainline-modem-wt88047:kernel_mainline_modem_wt88047 + $pkgname-nonfree-firmware:nonfree_firmware + $pkgname-nonfree-firmware-modem-wt86047:nonfree_firmware_modem_wt86047 + $pkgname-nonfree-firmware-modem-wt88047:nonfree_firmware_modem_wt88047 +" + +build() { + devicepkg_build $startdir $pkgname +} + +package() { + devicepkg_package $startdir $pkgname +} + +kernel_mainline() { + pkgdesc="Close to mainline kernel (no modem, audio routed directly)" + depends="linux-postmarketos-qcom-msm8916" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +# wt86047 (Chinese variant) and wt88047 (global variant) need different +# modem firmware, otherwise they are pretty much the same. + +kernel_mainline_modem_wt86047() { + pkgdesc="Close to mainline kernel (wt86047 (China), non-free modem, audio routed through ADSP)" + depends="linux-postmarketos-qcom-msm8916 soc-qcom-msm8916-modem" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +kernel_mainline_modem_wt88047() { + pkgdesc="Close to mainline kernel (wt88047 (global), non-free modem, audio routed through ADSP)" + depends="linux-postmarketos-qcom-msm8916 soc-qcom-msm8916-modem" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +nonfree_firmware() { + pkgdesc="GPU/WiFi/BT/Video(/Modem) firmware" + depends="linux-firmware-qcom firmware-qcom-msm8916-wcnss firmware-xiaomi-wt88047-wcnss-nv" + mkdir "$subpkgdir" +} + +nonfree_firmware_modem_wt86047() { + pkgdesc="Modem firmware (WT86047)" + depends="firmware-xiaomi-wt86047-modem" + install_if="$pkgname-nonfree-firmware $pkgname-kernel-mainline-modem-wt86047" + mkdir "$subpkgdir" +} + +nonfree_firmware_modem_wt88047() { + pkgdesc="Modem firmware (WT88047)" + depends="firmware-xiaomi-wt88047-modem" + install_if="$pkgname-nonfree-firmware $pkgname-kernel-mainline-modem-wt88047" + mkdir "$subpkgdir" +} + +sha512sums="17bf542a3446ef35515bf9bca2849ae5cb95306caef7c8c57101c8d0ea40ba2baf71767f0e652876519a439cacad0d877fac8d40373cae5d1b014a0383896a57 deviceinfo +df15ed95ee31ac2e565d21056493d9c7b264491f5d446bafe6684ae80750d408a0de7370d31323c75d50eee5ac0f97010c198d3c28285898d7762b822ef7181f modprobe.conf" diff --git a/device/testing/device-xiaomi-wt88047/deviceinfo b/device/testing/device-xiaomi-wt88047/deviceinfo new file mode 100644 index 000000000..e8393791f --- /dev/null +++ b/device/testing/device-xiaomi-wt88047/deviceinfo @@ -0,0 +1,34 @@ +# Reference: +# Please use double quotes only. You can source this file in shell scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Xiaomi Redmi 2" +deviceinfo_manufacturer="Xiaomi" +deviceinfo_codename="xiaomi-wt88047" +deviceinfo_year="2015" +deviceinfo_dtb_mainline="qcom/msm8916-wingtech-wt88047" +deviceinfo_dtb_mainline_modem_wt86047="qcom/msm8916-wingtech-wt88047-modem" +deviceinfo_dtb_mainline_modem_wt88047="qcom/msm8916-wingtech-wt88047-modem" +deviceinfo_append_dtb="true" +deviceinfo_modules_initfs="panel-xiaomi-r61308 msm edt-ft5x06" +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-xiaomi-wt88047/modprobe.conf b/device/testing/device-xiaomi-wt88047/modprobe.conf new file mode 100644 index 000000000..40a9338cb --- /dev/null +++ b/device/testing/device-xiaomi-wt88047/modprobe.conf @@ -0,0 +1,20 @@ +# +# There is a weird probe issue if both MSM DRM and the panel driver are built +# as modules: When MSM DRM is loaded it registers the DSI bus for the panel. +# At this point the panel is not loaded yet, so the kernel sends an uevent +# to userspace to load the necessary panel module. +# +# This causes some delay until the panel module is loaded, so MSM DRM fails to +# probe temporarily and returns -EPROBE_DEFER (to request probing again later). +# Unfortunately this will also unregister the DSI bus for the panel, and the +# kernel will not try probing MSM DRM + panel again until some other (slow) +# driver loads after MSM DRM. +# +# Usually WCNSS (WiFi/BT) fits that criteria, allowing the display to work. +# But this does not work if the user decides to exclude proprietary firmware. +# +# To avoid this problem we add an explicit soft dependency for MSM DRM +# on the panel module, so modprobe loads the panel module first and MSM DRM +# will immediately find the panel it is looking for. +# +softdep msm pre: panel-xiaomi-r61308 diff --git a/device/testing/firmware-xiaomi-wt86047-modem/APKBUILD b/device/testing/firmware-xiaomi-wt86047-modem/APKBUILD new file mode 100644 index 000000000..c6c0fd428 --- /dev/null +++ b/device/testing/firmware-xiaomi-wt86047-modem/APKBUILD @@ -0,0 +1,27 @@ +pkgname=firmware-xiaomi-wt86047-modem +pkgver=20161223 +pkgrel=0 +pkgdesc="Xiaomi Redmi 2 (wt86047) modem firmware" +url="https://androidfilehost.com/?w=files&flid=303434" +arch="aarch64" +license="proprietary" +options="!check !strip !archcheck !tracedeps pmb:cross-native" +makedepends="mtools" +source="https://archive.org/download/lineage-15.1-20200223-nightly-wt88047-signed_202004/wt86047-firmware_20161223.zip" + +_fwdir="/lib/firmware/postmarketos" + +unpack() { + default_unpack + + # Extract firmware files from FAT file system image + mcopy -i firmware-update/NON-HLOS.bin -p -m -v \ + ::image/mba.mbn ::image/modem.* "$srcdir" +} + +package() { + install -Dm644 "$srcdir"/mba.mbn -t "$pkgdir/$_fwdir" + install -Dm644 "$srcdir"/modem.* -t "$pkgdir/$_fwdir" +} + +sha512sums="7960acd95e296c41c82a3c3f7a6733ddeac31c484f812d57ce7a2cf5f811721f099fe57af45bae217d543f57930f4329d5613eac45fd0fc867f24273106181db wt86047-firmware_20161223.zip" diff --git a/device/testing/firmware-xiaomi-wt88047/APKBUILD b/device/testing/firmware-xiaomi-wt88047/APKBUILD new file mode 100644 index 000000000..95718ac1b --- /dev/null +++ b/device/testing/firmware-xiaomi-wt88047/APKBUILD @@ -0,0 +1,44 @@ +pkgname=firmware-xiaomi-wt88047 +pkgver=9.2.5.0 +pkgrel=0 +pkgdesc="Firmware for Xiaomi Redmi 2" +url="https://androidfilehost.com/?w=files&flid=303434" +subpackages="$pkgname-modem $pkgname-wcnss-nv:wcnss_nv" +arch="aarch64" +license="proprietary" +options="!check !strip !archcheck !tracedeps pmb:cross-native" +makedepends="mtools" +source=" + wt88047-WCNSS_qcom_wlan_nv.bin.base64::https://pastebin.com/raw/bntm8Z7m + https://archive.org/download/lineage-15.1-20200223-nightly-wt88047-signed_202004/wt88047-firmware_V9.2.5.0.LHJMIEK.zip +" + +_fwdir="/lib/firmware/postmarketos" + +unpack() { + default_unpack + base64 -d wt88047-WCNSS_qcom_wlan_nv.bin.base64 > WCNSS_qcom_wlan_nv.bin + + # Extract firmware files from FAT file system image + mcopy -i firmware-update/NON-HLOS.bin -p -m -v \ + ::image/mba.mbn ::image/modem.* "$srcdir" +} + +package() { + # parent package is empty + mkdir -p "$pkgdir" +} + +modem() { + pkgdesc="Xiaomi Redmi 2 (wt88047) modem firmware" + install -Dm644 "$srcdir"/mba.mbn -t "$subpkgdir/$_fwdir" + install -Dm644 "$srcdir"/modem.* -t "$subpkgdir/$_fwdir" +} + +wcnss_nv() { + pkgdesc="Xiaomi Redmi 2 WiFi/BT firmware configuration" + install -Dm644 "$srcdir"/WCNSS_qcom_wlan_nv.bin -t "$subpkgdir/$_fwdir"/wlan/prima +} + +sha512sums="cab8578bf8b20ff83035a10598ebb673619e5409683799a5d6d04496b7f4b4e0f54a635b29efe2007137adf089d24134339c69214fdfa06a9d2ff052c39b9e59 wt88047-WCNSS_qcom_wlan_nv.bin.base64 +45b0926f1694dc2f71d26b1408922345e2340bb84a73597ea00bd5025e31f5bafcf910395a6b021686043e041b8f2cd4ca448e891341fe4eca7382b6ee5b2186 wt88047-firmware_V9.2.5.0.LHJMIEK.zip"