xiaomi-wt88047: add mainline port for Xiaomi Redmi 2 (MR 1604)
Replace the old downstream port with a new aarch64 port running the linux-postmarketos-qcom-msm8916 close-to-mainline(TM) kernel. Most of the functionality is working: - USB Network - Storage (eMMC, SD card) - Display, brightness control - Touchscreen, buttons - IMU (accelerometer+gyroscope) - Notification LED - Sound (Speaker, Headphones, Microphones) - WiFi, Bluetooth - Modem (SMS, voice calls, mobile data) Coming soon (hopefully): Battery/Charging, USB-OTG (not working yet) There are many variants of the device, so more changes to handle differences between them may be needed in the future. For now, the only relevant difference is the required modem firmware: - wt88047 (global variant) - wt86047 (China variant) ... have different kind of modems and they do not seem to work with the firmware of the other one. The way this is handled in this device package is that there is a separate kernel variant for both of them. All other required firmware can be shared, and therefore there is no differentiation needed when using the kernel variant without modem. I renamed "wingtech-wt88047" to "xiaomi-wt88047". My reasoning for that is the following: - Wingtech is the ODM (original design manufacturer), they designed the hardware and (probably) manufactured it. But postmarketOS port applies to the combination of both hardware and firmware, and the firmware was at least partially provided by Xiaomi. - wt88047 looks lonely with the "wingtech" vendor, when all other Xiaomi devices use "xiaomi", even though many from them were probably also designed by Wingtech. - We don't use the ODM hardware name for other devices either, e.g. "wileyfox-crackling" would be "longcheer-l8150" with the same approach. I think the port is better visible as "xiaomi-wt88047" (too bad Xiaomi seemingly did not have a proper codename for this device...)
This commit is contained in:
parent
7ab48c472a
commit
c64f29713f
5 changed files with 197 additions and 0 deletions
72
device/testing/device-xiaomi-wt88047/APKBUILD
Normal file
72
device/testing/device-xiaomi-wt88047/APKBUILD
Normal file
|
@ -0,0 +1,72 @@
|
|||
# Reference: <https://postmarketos.org/devicepkg>
|
||||
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"
|
34
device/testing/device-xiaomi-wt88047/deviceinfo
Normal file
34
device/testing/device-xiaomi-wt88047/deviceinfo
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Reference: <https://postmarketos.org/deviceinfo>
|
||||
# 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"
|
20
device/testing/device-xiaomi-wt88047/modprobe.conf
Normal file
20
device/testing/device-xiaomi-wt88047/modprobe.conf
Normal file
|
@ -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
|
27
device/testing/firmware-xiaomi-wt86047-modem/APKBUILD
Normal file
27
device/testing/firmware-xiaomi-wt86047-modem/APKBUILD
Normal file
|
@ -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"
|
44
device/testing/firmware-xiaomi-wt88047/APKBUILD
Normal file
44
device/testing/firmware-xiaomi-wt88047/APKBUILD
Normal file
|
@ -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"
|
Loading…
Reference in a new issue