xiaomi-aries: new device (Xiaomi Mi2) (!171)

Finally got display working, but it's based on MoKee kernel which is
also hosted on GitHub by community. So what works:

* USB Networking
* Flashing
* Touchscreen
* Display
* Weston with Xwayland

The device boots and shows the splash screen properly, after about 3
sec the screen went black. I had to
"echo 127 > /sys/devices/i2c-0/0-0038/leds/lm3530-backlight/brightness"
to make the backlight work, even though the value of it was already
127.

[skip ci]: this was built successfully in CI already
This commit is contained in:
Lwrless 2019-01-24 11:32:46 +08:00 committed by Oliver Smith
parent 02f73e7e8a
commit 79e655f6e9
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
14 changed files with 4029 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-xiaomi-aries"
pkgdesc="Xiaomi Mi 2"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armhf"
options="!check !archcheck"
depends="postmarketos-base linux-xiaomi-aries mkbootimg mesa-dri-swrast mdss-fb-init-hack"
makedepends="devicepkg-dev"
source="deviceinfo initfs-hook.sh"
build() {
devicepkg_build $startdir $pkgname
}
package() {
install -Dm644 "$srcdir"/initfs-hook.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
devicepkg_package $startdir $pkgname
}
sha512sums="5fff1fdbd8303870bd7368ed3817f184bb28e0467af3a5efbd0ac471448d967cd4eab471af953eb0f01bff9bc2292aad75ff670b7f61b10ce1a4fab5bff93c2b deviceinfo
73d199fdf7eccc2041ea8fabecc8b833d845791d5e7740b9d8e81e8fb917a0db55958f8c0d5499142a5726cf1ee40d6eb0ca16f7dc160276354d940b5abeeedc initfs-hook.sh"

View file

@ -0,0 +1,33 @@
# 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 2"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-aries"
deviceinfo_date="2012-10-30"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armhf"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="false"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1280"
deviceinfo_dev_touchscreen="/dev/input/event1"
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=null androidboot.hardware=qcom ehci-hcd.park=3 maxcpus=2 androidboot.bootdevice=msm_sdcc.1 androidboot.selinux=permissive"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x80200000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x02000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1,3 @@
#!/bin/sh
echo 720,3840 > /sys/devices/virtual/graphics/fb0/virtual_size

View file

@ -0,0 +1,33 @@
source:
https://github.com/ShinySide/HispAsian_Lollipop_G6/commit/b7756b6fc4bb728722b14d2dfdbaf1dc843812e9
* These need to be static to avoid these errors:
drivers/built-in.o: In function `.LANCHOR1':
msm_iommu_sec.c:(.data+0x9298): undefined reference to `kgsl_iommu_sync_lock'
msm_iommu_sec.c:(.data+0x929c): undefined reference to `kgsl_iommu_sync_unlock'
Makefile:877: recipe for target '.tmp_vmlinux1' failed
make: *** [.tmp_vmlinux1] Error 1
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
--- a/drivers/gpu/msm2/kgsl_iommu.c
+++ b/drivers/gpu/msm2/kgsl_iommu.c
@@ -1010,7 +1010,7 @@ static int kgsl_iommu_init_sync_lock(struct kgsl_mmu *mmu)
*
* Return - int - number of commands.
*/
-inline unsigned int kgsl_iommu_sync_lock(struct kgsl_mmu *mmu,
+static inline unsigned int kgsl_iommu_sync_lock(struct kgsl_mmu *mmu,
unsigned int *cmds)
{
struct kgsl_device *device = mmu->device;
@@ -1080,7 +1080,7 @@ inline unsigned int kgsl_iommu_sync_lock(struct kgsl_mmu *mmu,
*
* Return - int - number of commands.
*/
-inline unsigned int kgsl_iommu_sync_unlock(struct kgsl_mmu *mmu,
+static inline unsigned int kgsl_iommu_sync_unlock(struct kgsl_mmu *mmu,
unsigned int *cmds)
{
struct kgsl_device *device = mmu->device;

View file

@ -0,0 +1,30 @@
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index f89515adac6..2bb8cac28b9 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -45,7 +45,7 @@ void *return_address(unsigned int);
#else
-extern inline void *return_address(unsigned int level)
+static inline void *return_address(unsigned int level)
{
return NULL;
}
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index 2f8f523cece..a3b587ffc14 100755
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -63,11 +63,6 @@ void *return_address(unsigned int level)
//#warning "TODO: return_address should use unwind tables"
//#endif
-void *return_address(unsigned int level)
-{
- return NULL;
-}
-
#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
EXPORT_SYMBOL_GPL(return_address);

View file

@ -0,0 +1,34 @@
From e41494c15d4df342854ac3d2940f5d6ac3158212 Mon Sep 17 00:00:00 2001
From: Bryan Huntsman <bryanh@codeaurora.org>
Date: Mon, 3 Jun 2013 18:48:08 -0700
Subject: [PATCH] msm: fix in-tree compilation for perf_trace_counters
In-tree compilation for arch/arm/mach-msm/perf_trace_counters.c was
hitting this error:
In file included from arch/arm/mach-msm/perf_trace_counters.h:127:0,
from arch/arm/mach-msm/perf_trace_counters.c:14:
include/trace/define_trace.h:79:43: fatal error: ./perf_trace_counters.h: No such file or directory
Instructions for TRACE_INCLUDE_FILE in include/trace/define_trace.h say
"the path is relative to define_trace.h, not the file including it".
Fix in-tree compilation by making the path relative to define_trace.h.
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
---
arch/arm/mach-msm/perf_trace_counters.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/mach-msm/perf_trace_counters.h b/arch/arm/mach-msm/perf_trace_counters.h
index ce7e336aa40d..8f77badf42ac 100644
--- a/arch/arm/mach-msm/perf_trace_counters.h
+++ b/arch/arm/mach-msm/perf_trace_counters.h
@@ -121,7 +121,6 @@ TRACE_EVENT(sched_switch_with_ctrs,
#endif
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../arch/arm/mach-msm
#define TRACE_INCLUDE_FILE perf_trace_counters
#include <trace/define_trace.h>
-

View file

@ -0,0 +1,11 @@
--- a/drivers/gpu/msm2/adreno_trace.h
+++ b/drivers/gpu/msm2/adreno_trace.h
@@ -17,7 +17,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kgsl
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/msm2
#define TRACE_INCLUDE_FILE adreno_trace
#include <linux/tracepoint.h>

View file

@ -0,0 +1,11 @@
--- a/drivers/gpu/msm2/kgsl_events.c
+++ b/drivers/gpu/msm2/kgsl_events.c
@@ -14,7 +14,7 @@
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/module.h>
-#include <kgsl_device.h>
+#include "kgsl_device.h"
#include "kgsl_trace.h"
#include "adreno.h"

View file

@ -0,0 +1,10 @@
--- a/drivers/gpu/msm2/kgsl_trace.h
+++ b/drivers/gpu/msm2/kgsl_trace.h
@@ -17,7 +17,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kgsl
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/msm2
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE kgsl_trace

View file

@ -0,0 +1,77 @@
--- a/drivers/video/msm/msm_fb.c
+++ b/drivers/video/msm/msm_fb.c
@@ -1371,16 +1371,16 @@
fix->xpanstep = 1;
fix->ypanstep = 1;
var->vmode = FB_VMODE_NONINTERLACED;
- var->blue.offset = 0;
- var->green.offset = 8;
- var->red.offset = 16;
+ var->blue.offset = 24;
+ var->green.offset = 16;
+ var->red.offset = 8;
var->blue.length = 8;
var->green.length = 8;
var->red.length = 8;
var->blue.msb_right = 0;
var->green.msb_right = 0;
var->red.msb_right = 0;
- var->transp.offset = 24;
+ var->transp.offset = 0;
var->transp.length = 8;
bpp = 4;
break;
@@ -1390,16 +1390,16 @@
fix->xpanstep = 1;
fix->ypanstep = 1;
var->vmode = FB_VMODE_NONINTERLACED;
- var->blue.offset = 8;
- var->green.offset = 16;
- var->red.offset = 24;
+ var->blue.offset = 16;
+ var->green.offset = 8;
+ var->red.offset = 0;
var->blue.length = 8;
var->green.length = 8;
var->red.length = 8;
var->blue.msb_right = 0;
var->green.msb_right = 0;
var->red.msb_right = 0;
- var->transp.offset = 0;
+ var->transp.offset = 24;
var->transp.length = 8;
bpp = 4;
break;
@@ -2290,15 +2290,15 @@
/* Figure out if the user meant RGBA or ARGB
and verify the position of the RGB components */
- if (var->transp.offset == 24) {
- if ((var->blue.offset != 0) ||
- (var->green.offset != 8) ||
- (var->red.offset != 16))
- return -EINVAL;
- } else if (var->transp.offset == 0) {
- if ((var->blue.offset != 8) ||
+ if (var->transp.offset == 0) {
+ if ((var->blue.offset != 24) ||
(var->green.offset != 16) ||
- (var->red.offset != 24))
+ (var->red.offset != 8))
+ return -EINVAL;
+ } else if (var->transp.offset == 24) {
+ if ((var->blue.offset != 16) ||
+ (var->green.offset != 8) ||
+ (var->red.offset != 0))
return -EINVAL;
} else
return -EINVAL;
@@ -2395,7 +2395,7 @@
break;
case 32:
- if (var->transp.offset == 24)
+ if (var->transp.offset == 0)
mfd->fb_imgType = MDP_ARGB_8888;
else
mfd->fb_imgType = MDP_RGBA_8888;

View file

@ -0,0 +1,81 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/aries-perf-user_defconfig
pkgname="linux-xiaomi-aries"
pkgver=3.4.113
pkgrel=0
pkgdesc="Xiaomi Mi 2 kernel fork"
arch="armhf"
_carch="arm"
_flavor="xiaomi-aries"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev xz"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_username="MoKee"
_repository="android_kernel_xiaomi_aries"
_commit="6a30963cf10e5b7cc938f3ac7b22af4ad72c0bf9"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/${_username}/${_repository}/archive/${_commit}.tar.gz
$_config
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
02_gpu-msm-fix-gcc5-compile.patch
03_fix-return-address.patch
04_fix-perf-trace-counters.patch
05_fix-adreno-trace.patch
06_fix-kgsl-events-include.patch
07_fix-kgsl-trace-h.patch
08_fix-red-screen.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC"
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
# kernel.release
install -D "$builddir/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi
}
sha512sums="3d461173c0ec72d243870bcb2ce1935b2ba1652a532b9b09ef0a3823b5961a3d58415fce2d57f054e1945dc9e70c5c9a68fc45aad26a0adb894bc96120847bc9 linux-xiaomi-aries-6a30963cf10e5b7cc938f3ac7b22af4ad72c0bf9.tar.gz
57ed0e0ac53a70762612ed10885129ee0a731526cc0792050015f929354db7fdf3eae3552cc11b51273b83ea4547b9cada35c05e2081c6c0ac98ac1f2a2d6da9 config-xiaomi-aries.armhf
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
87ff591431c34d920527de8d7640b93bfc1f09ad541a58645969bc1e6b64b89e7443c38dd263cafa9a6090f4a74e0ffcd49f94dba0a4f1df5306dad106ecfb3f 02_gpu-msm-fix-gcc5-compile.patch
7d5ca9d460030adf529466a8e8ef430337cbb998f78b1b5f37a2809fc745cdb16421dc314045ae411069d5af2ace7028f1139303ae4d6d583b6ae07ad931295e 03_fix-return-address.patch
f85ced49ee2f2461adea68dac0a10452aa809a7d41d869092d94eb085344919a9a385dec0c48011f4601ca4f441700f7fe49075c7eca4fb2d66b01f7d413ccb7 04_fix-perf-trace-counters.patch
71465422481ff79d2ddde7a9b55531b963f9a72efa9df47ecd5666353fbfb72e698290fa9e7f51522e2dadb2fa719ad5fc05fabe6c4ff7b9d387243a46d97d72 05_fix-adreno-trace.patch
f58e3d2d327f2fc06b3599903eca8113facd550010e8e0db4ace8fbdeb042f62fdca61e9748770a8891e21dc8211c8366518e8e16c5d61c6b49a88d34a16493c 06_fix-kgsl-events-include.patch
30b66b3b82a762a70381cc3e000f092c739714b116ff7fa4d13108e782789dce2f6e1490de54d720a8870fc52d379bd266abb873f79f7a021c0eced0fdbc70af 07_fix-kgsl-trace-h.patch
67c5d25b7d18644266ea043430655f46edf9cb7ff82612e25e63015a183206966cb41865236ebf642e83bed454cdc0392400e26f4be14f649c615415599229c7 08_fix-red-screen.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch