xiaomi-daisy: new device (Xiaomi Mi A2 Lite) (MR 1697)

This commit is contained in:
Ash 2020-11-09 18:09:05 +01:00 committed by Bart Ribbers
parent bb41f53879
commit 0cad340c13
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
8 changed files with 5256 additions and 0 deletions

View file

@ -0,0 +1,38 @@
# Contributor: Matthew5pl <matteofo06@gmail.com>
# Maintainer: NotLugozzi <thomas.bassi@outlook.it>
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-daisy
pkgdesc="Xiaomi Mi A2 Lite"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-xiaomi-daisy mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="deviceinfo
fb.modes
pointercal
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm0755 "$srcdir"/fb.modes "$pkgdir"/etc/fb.modes
install -Dm0755 "$srcdir"/pointercal "$pkgdir"/etc/pointercal
}
nonfree_firmware() {
pkgdesc="Wi-Fi, ADSP Firmware"
depends="firmware-xiaomi-daisy"
mkdir "$subpkgdir"
}
sha512sums="ad71d15408a4d852c7202d12819708193b3ef5de2aef5d60c542631194b3207a9acb017fd91954b0c245a3c4ff95fbb3835ffef493877fc00fb6c54944c601f9 deviceinfo
9b888f3a4ef3ed3c0b2e9c6a6e8a6c686909c530c3d95be797b47b4eb9deb55d64190b7a3736e44139630bfff5e295625a855052923369fdd37889060a3220ca fb.modes
4fa63c184f00033fbae2e4b140c9655061b3b662e337f7bdf5f8e26f7b57d6c66ad01fc93da05ce7d330f0f05bb0d36cc9b356ebfc7eb4200be4d4cc03afc975 pointercal"

View file

@ -0,0 +1,36 @@
# 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 Mi A2 Lite"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-daisy"
deviceinfo_year="2018"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="2280"
deviceinfo_dev_touchscreen="/dev/input/event1"
deviceinfo_dev_touchscreen_calibration="/etc/pointercal"
deviceinfo_swap_size_recommended="1024"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78af000 androidboot.usbconfigfs=false loop.max_part=7 buildvariant=user veritykeyid=id:5560e7863b4d8118c2f1b065595cf93bb2447992"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_offset_base="0x80000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_sparse=true
deviceinfo_weston_core_modules="xwayland.so"

View file

@ -0,0 +1,7 @@
mode "1080x2160-60"
# D: 166.556 MHz, H: 132.187 kHz, V: 60.003 Hz
geometry 1080 2160 1080 2160 16
timings 6004 60 108 33 6 12 4
accel false
rgba 8/0,8/8,8/16,8/16
endmode

View file

@ -0,0 +1 @@
66503 -338 -779699 -332 65882 -586338 65536 1080 2160 0

View file

@ -0,0 +1,40 @@
pkgname=firmware-xiaomi-daisy
pkgver=0.1
pkgrel=0
pkgdesc="Firmware files for Xiaomi Mi A2 Lite"
url="https://postmarketos.org"
arch="aarch64"
license="proprietary"
depends="wcnss-wlan"
_repository="daisy-firmware"
_commit="10eb55e6dc7b9b6d0b5c98eb0d22238707cd43b4"
source="$pkgname-$_commit.tar.gz::https://github.com/NotLugozzi/daisy-firmware/archive/$_commit.tar.gz"
options="!strip !check !archcheck !spdx"
builddir="$srcdir/daisy-firmware-$_commit"
_files="wcnss.b00 wcnss.b01 wcnss.b02 wcnss.b04 wcnss.b06
wcnss.b09 wcnss.b10 wcnss.b11 wcnss.b12 wcnss.mdt
adsp.b00 adsp.b01 adsp.b02 adsp.b03 adsp.b04
adsp.b05 adsp.b06 adsp.b07 adsp.b08 adsp.b09
adsp.b10 adsp.b11 adsp.b12 adsp.b13 adsp.b14 adsp.mdt
qdsp6m.qdb
a506_zap.b00 a506_zap.b01 a506_zap.b02 a506_zap.mdt"
_files_prima="WCNSS_wlan_dictionary.dat
WCNSS_qcom_cfg.ini
WCNSS_qcom_wlan_nv.bin"
package() {
# /lib/firmware/postmarketos
for _i in $_files; do
install -Dm0755 "$_i" \
"$pkgdir"/lib/firmware/postmarketos/"$_i"
done
# /lib/firmware/postmarketos/wlan/prima
for _i in $_files_prima; do
install -Dm0755 wlan/prima/"$_i" \
"$pkgdir"/lib/firmware/postmarketos/wlan/prima/"$_i"
done
}
sha512sums="a0216a84ebf10a6ab9ac793f322dd50698c6e80c82c284eeda0ac3e4a50b618cb5472f60450ce65c23653cd32a49a27e2fd195d67e55e0d34c9caffadca16a5c firmware-xiaomi-daisy-10eb55e6dc7b9b6d0b5c98eb0d22238707cd43b4.tar.gz"

View file

@ -0,0 +1,80 @@
From 92e3310d2db157deacb86ef5db8c8c8d38251312 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Wed, 11 Sep 2019 21:51:40 +0300
Subject: [PATCH 3/6] Add config option to fix bootloader cmdline args
Android bootloader passes some arguments in kernel command
line, that make booting custom OSes harder:
* skip_initramfs
* root=PARTUUID=...
* init=/init
Those parameters override default boot partition to hardcoded,
set init binary to /init, disable booting from initramfs.
If enabled, those parameters will be erased from bootloader's
command line, and custom OS can boot the way it likes.
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
arch/arm64/Kconfig | 17 +++++++++++++++++
drivers/of/fdt.c | 14 ++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2829edba6aa5..bd9f05f83c7e 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1125,6 +1125,23 @@ config CMDLINE_FORCE
command-line options your boot loader passes to the kernel.
endchoice
+config CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ bool "Drop certain dangerous options from cmdline"
+ default n
+ help
+ Android bootloader passes some arguments in kernel command
+ line, that make booting custom OSes harder:
+
+ * skip_initramfs
+ * root=PARTUUID=...
+ * init=/init
+
+ Those parameters override default boot partition to hardcoded,
+ set init binary to /init, disable booting from initramfs.
+
+ If enabled, those parameters will be erased from bootloader's
+ command line, and custom OS can boot the way it likes.
+
config EFI_STUB
bool
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ca175710c4c8..fd8257589648 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1012,6 +1012,20 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
pr_debug("Command line is: %s\n", (char*)data);
+#ifdef CONFIG_CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ pr_err("Replacing dangerous cmdline options...");
+ cmdline = strstr((const char *)data, "skip_initramfs");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "root=");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "init=");
+ if (cmdline)
+ *cmdline = '_';
+ pr_err("Command line now is: %s\n", (char*)data);
+#endif
+
/* break now */
return 1;
}
--
2.24.1

View file

@ -0,0 +1,49 @@
# Contributor: Matthew5pl <matteofo06@gmail.com>
# Maintainer: NotLugozzi <thomasbassi34@gmail.com>
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/msm8953-perf_defconfig
pkgname=linux-xiaomi-daisy
pkgver=4.9.220
pkgrel=0
pkgdesc="Xiaomi Mi A2 Lite kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-daisy"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl"
# Source
_repository="daisy_msm8953"
_commit="80aa9da8ef47805db4c0f987dbbda57a61832874"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/RebornDaisyProject/$_repository/archive/$_commit.tar.gz
$_config
config-xiaomi-daisy.aarch64
0003-Add-config-option-to-fix-bootloader-cmdline-args.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}
sha512sums="8c71f6d3ec8076fe025c3b6506eda0678daf0e8eba0e6e2c5af8803487f760e4504b195cca3b281b8a6f7283136a05553589c73a50a616e41cdc8d4f60ea2ea5 linux-xiaomi-daisy-80aa9da8ef47805db4c0f987dbbda57a61832874.tar.gz
b94445c70ce4f4a63f376ab6fc0c187379885ee4dd3b9ac20c7cd7f018061235fc88d6befde26108e3c276f014d6126011397de1fea525d71fe05f3b33f261ba config-xiaomi-daisy.aarch64
b94445c70ce4f4a63f376ab6fc0c187379885ee4dd3b9ac20c7cd7f018061235fc88d6befde26108e3c276f014d6126011397de1fea525d71fe05f3b33f261ba config-xiaomi-daisy.aarch64
9ce867c4254b537ef5d2485780c26b72da8a3a8767ba71557f3b48d6c550e0e14c8c3e575b31bf65d2878f08a8a4926e48a1c2f1be534bf80a7a57f58313b0fd 0003-Add-config-option-to-fix-bootloader-cmdline-args.patch"

File diff suppressed because it is too large Load diff