Skip to content
Snippets Groups Projects
Commit 5e92794d authored by Ion Agorria's avatar Ion Agorria Committed by Bart Ribbers
Browse files

device-xiaomi: new device (!165)

Initial support for Xiaomi A1 aka xiaomi-tissot using LineageOS 15.1
kernel, has similar board to Xiaomi Redmi 4 aka xiaomi-mido with some
differences that had to be patched such as reversing skip_initramfs and
ignoring dm param. 16.0 kernel boots but display fb init doesn't work.

Weston boots with touch support, SSH via USB RNDIS works.

[skip ci]: this built once in CI already, good to go.
parent cd98c568
Branches
No related tags found
No related merge requests found
Showing
with 5615 additions and 0 deletions
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-xiaomi-tissot"
pkgdesc="Xiaomi A1"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-xiaomi-tissot mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
source="deviceinfo
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="176aa6496dd4bc335fec4ba986348390b60233ba303d3b170650dbe3020e2a15438ca8708f2d9e5fc92e9dc8f3301fe7ba0f8840e953e4591a7bd7da22c0b459 deviceinfo"
# 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 A1"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-tissot"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="1920"
deviceinfo_dev_touchscreen="/dev/input/event1"
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="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.selinux=permissive buildvariant=eng"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="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"
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/tissot_defconfig
pkgname="linux-xiaomi-tissot"
pkgver=3.18.71
pkgrel=0
pkgdesc="Xiaomi A1 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-tissot"
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 gcc6"
# Compiler: this kernel was only tested with GCC6. Feel free to make a merge
# request if you find out that it is booting working with newer GCCs as
# well. See <https://postmarketos.org/vendorkernel> for instructions.
if [ "${CC:0:5}" != "gcc6-" ]; then
CC="gcc6-$CC"
HOSTCC="gcc6-gcc"
CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi
# Source
_repository="android_kernel_xiaomi_msm8953"
_commit="80cb3f607eb78280642c3b9b6e89f676e9c263bf"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/${_repository}/archive/${_commit}.tar.gz
$_config
compiler-gcc6.h
fix-include-msm_isp.patch
fix-include-msm_camera_i2c.patch
fix-rndis_ipa.patch
fix_u_f_header.patch
fix_usb_gadget_function.patch
fix_msm_dba.patch
init-reverse-skip_initramfs.patch
init-ignore-dm-if-skip_initramfs.patch
tweak-warn-once-skb_release_head_state.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/"
# Remove -Werror from all makefiles
local i
local makefiles="$(find . -type f -name Makefile)
$(find . -type f -name Kbuild)"
for i in $makefiles; do
sed -i 's/-Werror-/-W/g' "$i"
sed -i 's/-Werror//g' "$i"
done
# Prepare kernel config ('yes ""' for kernels lacking olddefconfig)
cp "$srcdir"/$_config "$builddir"/.config
yes "" | make ARCH="$_carch" HOSTCC="$HOSTCC" oldconfig
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
msg "Combine DTB and Image.gz"
msg "(Image.gz-dtb without DTB itself ¯\_(ツ)_/¯)"
rm "$builddir/arch/$_carch/boot/Image.gz-dtb"
cat "$builddir/arch/$_carch/boot/Image.gz" \
"$builddir/arch/$_carch/boot/dts/qcom/msm8953-qrd-sku3-tissot.dtb" \
> "$builddir/arch/$_carch/boot/Image.gz-dtb"
}
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="f0bba3e19e8cad92cabaeba63db75af9b2cf1e5fa7e79c7688c487c55db0230840ab838628b8aaf6a39a03d403237ab224aa94fac88eb538b82cb7909f35e43d linux-xiaomi-tissot-80cb3f607eb78280642c3b9b6e89f676e9c263bf.tar.gz
54ad078eb8b54037fb1d4191a45a8ebded6ac5e95e7bea41d0f20a75feed5b0dd0654ee1fd17a942939f8953e4f25781559e5f8fb170c58d2e2e6783f0405375 config-xiaomi-tissot.aarch64
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
a7acfa838563cb3a0da85b0b580b8b6873e87a21c83d060bbacf0f159672353db65d2f5d1d74cfd3b8640336db1b56aa4868dea8dd5eaba6366bc7050624608f fix-include-msm_isp.patch
e4a9fca760b22c71ecc6b749afeec0bf2e5571bcde9c3d25612402ee406e2ccdebc6fb1e353851190e948bcda00ed37f7d1bb6c26c08557fda02f37811c80cc7 fix-include-msm_camera_i2c.patch
c35a7337ddee41ea355bc3040e258c111b92c62413e355d7fe1329f516f8bdf724bab0cb8f426aee96fc776a8297e7a3ec5414120248538e0ee0ac3265790fbd fix-rndis_ipa.patch
b408f157cc025d410b38f5aee9be977e670e1ac3f195f6c3a6681446fa0c3887067d62a4f729cfcd058fab42fca355b0265764dc2d21515f6e023ed025f55d41 fix_u_f_header.patch
1f23466d1a864f2d2c67ae4250b0c166ecb7755779bbdad6732808a001cc2826cc1d013c2281d2ca1d5abd7d60d13783f0b9f11bb8359971f2b30b911e627220 fix_usb_gadget_function.patch
7e765cb696fa8c3dfbc305b05cbf1fad85fb9572613d5391e945341dae5974a745f4906c795dc841e5562b19ab77d5257f9741e514af2c2573aa4bb8b262ce51 fix_msm_dba.patch
32f8180ae59351835f91ead8e38ae4933658c13bfe62bdbb32de82aecb16e1ff9e96333f4f129423ae8be4dc3210ee3bbf3fd0ea199df0f397ecb2f2efe37bcb init-reverse-skip_initramfs.patch
d97b343970bba978b0c99222e01d3a66abba9d7fe5725705021b4ab2895dd18df2c68bfbb894f05f2894714b958e1aa63ed5e09d19cbbff1204fdc7f246891b4 init-ignore-dm-if-skip_initramfs.patch
170a979908156f740d32fc3a8f74c2b2cb54420e12b81f2373fed1eb095159f1e03d3c24116a345f41ccd927fd93594b0a0e4b58a57ffe6869288f1ec030078c tweak-warn-once-skb_release_head_state.patch"
// SOURCE:
// https://github.com/NextThingCo/CHIP-u-boot/issues/10#issuecomment-287515505
#ifndef __LINUX_COMPILER_H
#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
#endif
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
like BUG(), printk(), panic() etc. [but let's keep them for now for
older compilers]
Early snapshots of gcc 4.3 don't support this and we can't detect this
in the preprocessor, but we can live with this because they're unreleased.
Maketime probing would be overkill here.
gcc also has a __attribute__((__hot__)) to move hot functions into
a special section, but I don't see any sense in this right now in
the kernel context */
#define __cold __attribute__((__cold__))
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
#ifndef __CHECKER__
# define __compiletime_warning(message) __attribute__((warning(message)))
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* __CHECKER__ */
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
* control elsewhere.
*
* Early snapshots of gcc 4.5 don't support this and we can't detect
* this in the preprocessor, but we can live with this because they're
* unreleased. Really, we need to have autoconf for the kernel.
*/
#define unreachable() __builtin_unreachable()
/* Mark a function definition as prohibited from being cloned. */
#define __noclone __attribute__((__noclone__))
/*
* Tell the optimizer that something else uses this function or variable.
*/
#define __visible __attribute__((externally_visible))
/*
* GCC 'asm goto' miscompiles certain code sequences:
*
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
*
* (asm goto is automatically volatile - the naming reflects this.)
*/
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
#define __HAVE_BUILTIN_BSWAP32__
#define __HAVE_BUILTIN_BSWAP64__
#define __HAVE_BUILTIN_BSWAP16__
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
This diff is collapsed.
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
index 5d57ec8c28ff..cc69fa018d65 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
@@ -31,9 +31,10 @@
#include <media/msm_cam_sensor.h>
#include <media/v4l2-subdev.h>
#include <media/v4l2-ioctl.h>
-#include "msm_camera_i2c.h"
-#include "msm_camera_dt_util.h"
-#include "msm_sd.h"
+
+#include "io/msm_camera_i2c.h"
+#include "io/msm_camera_dt_util.h"
+#include "../msm_sd.h"
#define DEFINE_MSM_MUTEX(mutexname) \
static struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
diff --git a/include/trace/events/msm_cam.h b/include/trace/events/msm_cam.h
index b52845407ef0..2cd283db8d32 100644
--- a/include/trace/events/msm_cam.h
+++ b/include/trace/events/msm_cam.h
@@ -16,7 +16,7 @@
#if !defined(_TRACE_MSM_VFE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_MSM_VFE_H
-#include "msm_isp.h"
+#include "../../../drivers/media/platform/msm/camera_v2/isp/msm_isp.h"
#include <linux/types.h>
#include <linux/tracepoint.h>
diff --git a/drivers/net/ethernet/msm/Makefile b/drivers/net/ethernet/msm/Makefile
index 5bf934e82fce..6d252a523be3 100644
--- a/drivers/net/ethernet/msm/Makefile
+++ b/drivers/net/ethernet/msm/Makefile
@@ -2,6 +2,8 @@
# Makefile for the msm networking support.
#
+CFLAGS_rndis_ipa.o := -I$(src)
+
obj-$(CONFIG_MSM_RMNET_MHI) += msm_rmnet_mhi.o
obj-$(CONFIG_ECM_IPA) += ecm_ipa.o
obj-$(CONFIG_RNDIS_IPA) += rndis_ipa.o
diff --git a/drivers/platform/msm/ipa/ipa_v2/Makefile b/drivers/platform/msm/ipa/ipa_v2/Makefile
index 69b8a4c94461..8bb29f9774f6 100644
--- a/drivers/platform/msm/ipa/ipa_v2/Makefile
+++ b/drivers/platform/msm/ipa/ipa_v2/Makefile
@@ -1,3 +1,4 @@
+CFLAGS_ipa.o := -I$(src)
obj-$(CONFIG_IPA) += ipat.o
ipat-y := ipa.o ipa_debugfs.o ipa_hdr.o ipa_flt.o ipa_rt.o ipa_dp.o ipa_client.o \
ipa_utils.o ipa_nat.o ipa_intf.o teth_bridge.o ipa_interrupts.o \
diff --git a/drivers/platform/msm/ipa/ipa_v3/Makefile b/drivers/platform/msm/ipa/ipa_v3/Makefile
index a4faaea715a8..9862cad0d43f 100644
--- a/drivers/platform/msm/ipa/ipa_v3/Makefile
+++ b/drivers/platform/msm/ipa/ipa_v3/Makefile
@@ -6,3 +6,5 @@ ipat-y := ipa.o ipa_debugfs.o ipa_hdr.o ipa_flt.o ipa_rt.o ipa_dp.o ipa_client.o
ipa_uc.o ipa_uc_wdi.o ipa_dma.o ipa_uc_mhi.o ipa_mhi.o ipa_uc_ntn.o
obj-$(CONFIG_RMNET_IPA3) += rmnet_ipa.o ipa_qmi_service_v01.o ipa_qmi_service.o rmnet_ipa_fd_ioctl.o
+
+CFLAGS_ipa.o := -I$(src)
diff --git a/drivers/video/msm/msm_dba/msm_dba.c b/drivers/video/msm/msm_dba/msm_dba.c
index cc6512a..eb073a7 100644
--- a/drivers/video/msm/msm_dba/msm_dba.c
+++ b/drivers/video/msm/msm_dba/msm_dba.c
@@ -22,7 +22,7 @@
#include <linux/err.h>
#include <video/msm_dba.h>
-#include <msm_dba_internal.h>
+#include "msm_dba_internal.h"
static DEFINE_MUTEX(register_mutex);
diff --git a/drivers/usb/gadget/function/u_f.h b/drivers/usb/gadget/function/u_f.h
new file mode 100644
index 0000000..1d5f0eb
--- /dev/null
+++ b/drivers/usb/gadget/function/u_f.h
@@ -0,0 +1,52 @@
+/*
+ * u_f.h
+ *
+ * Utility definitions for USB functions
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __U_F_H__
+#define __U_F_H__
+
+/* Variable Length Array Macros **********************************************/
+#define vla_group(groupname) size_t groupname##__next = 0
+#define vla_group_size(groupname) groupname##__next
+
+#define vla_item(groupname, type, name, n) \
+ size_t groupname##_##name##__offset = ({ \
+ size_t align_mask = __alignof__(type) - 1; \
+ size_t offset = (groupname##__next + align_mask) & ~align_mask;\
+ size_t size = (n) * sizeof(type); \
+ groupname##__next = offset + size; \
+ offset; \
+ })
+
+#define vla_item_with_sz(groupname, type, name, n) \
+ size_t groupname##_##name##__sz = (n) * sizeof(type); \
+ size_t groupname##_##name##__offset = ({ \
+ size_t align_mask = __alignof__(type) - 1; \
+ size_t offset = (groupname##__next + align_mask) & ~align_mask;\
+ size_t size = groupname##_##name##__sz; \
+ groupname##__next = offset + size; \
+ offset; \
+ })
+
+#define vla_ptr(ptr, groupname, name) \
+ ((void *) ((char *)ptr + groupname##_##name##__offset))
+
+struct usb_ep;
+struct usb_request;
+
+struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
+
+#endif /* __U_F_H__ */
+
+
This diff is collapsed.
From 88d497212226cd63501e79e5031c6fca843e46a1 Mon Sep 17 00:00:00 2001
From: Ion Agorria <ion@agorria.com>
Date: Sat, 19 Jan 2019 12:07:10 +0100
Subject: [PATCH] Cancel dm-setup if skip_initramfs is not present
dm parameter might interfere on linux booting
so we only use it when not doing a normal boot.
---
init/do_mounts_dm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/init/do_mounts_dm.c b/init/do_mounts_dm.c
index ecda58df9a19..53cda0b0317b 100644
--- a/init/do_mounts_dm.c
+++ b/init/do_mounts_dm.c
@@ -272,6 +272,15 @@ parse_fail:
return 1;
}
+static int __initdata skip_initramfs;
+static int __init skip_initramfs_param(char *str)
+{
+ if (*str) return 0;
+ skip_initramfs = 1;
+ return 0;
+}
+__setup("skip_initramfs", skip_initramfs_param);
+
/*
* Parse the command-line parameters given our kernel, but do not
* actually try to invoke the DM device now; that is handled by
@@ -283,6 +292,10 @@ parse_fail:
static int __init dm_setup(char *str)
{
+ if (skip_initramfs) {
+ printk(KERN_INFO "dm: skip_initramfs present, ignoring dm setup\n");
+ return 1;
+ }
dm_setup_args_init();
str = dm_setup_parse_device_args(str);
--
2.19.2
From 76e12feb81d1b1ccbb7c58b16e040ca6c59f7ace Mon Sep 17 00:00:00 2001
From: Ion Agorria <ion@agorria.com>
Date: Sat, 19 Jan 2019 12:10:23 +0100
Subject: [PATCH] Reverse skip_initramfs to use it by default.
This way it's possible to boot with initram by default.
Initramfs is skip in this device to boot android unless
recovery key is pressed.
---
init/initramfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index d39079e690fa..41fb5db74138 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -621,8 +621,10 @@ static int __init populate_rootfs(void)
{
char *err;
- if (do_skip_initramfs)
+ if (!do_skip_initramfs) {
+ printk(KERN_INFO "Skipping initramfs...\n");
return default_rootfs();
+ }
err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
if (err)
--
2.19.2
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment