Add initial support for Zenfone 5 (t00f/t00j) (#1176)

Current status:
  - flashing only manually (intel phones have different bootimg format)
  - usb networking works
  - xorg works using fbdev
  - packages needed for wayland are not available for x86
  - touch works in xorg and osk-sdl
This commit is contained in:
Peter Mann 2018-01-29 21:52:20 +01:00 committed by Oliver Smith
parent d931b61091
commit 301f732c5c
9 changed files with 4664 additions and 0 deletions

View file

@ -0,0 +1,38 @@
pkgname="device-asus-t00f"
pkgdesc="Asus Zenfone 5"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="noarch"
options="!check"
depends="linux-asus-t00f mkbootimg"
makedepends="devicepkg-dev"
subpackages="$pkgname-x11"
source="
deviceinfo
xorg.conf
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
install -Dm644 "$srcdir"/deviceinfo \
"$pkgdir"/etc/deviceinfo
devicepkg_package $startdir $pkgname
}
x11() {
install_if="$pkgname xorg-server"
depends="
libinput
xf86-input-libinput
xf86-video-fbdev"
install -Dm644 "$srcdir"/xorg.conf \
"$subpkgdir"/etc/X11/xorg.conf.d/10-t00f.conf
}
sha512sums="77b946df23ecfb9084f377b733b983cfbadd62e46e2eeb48c873af4e8564c006ff4504f6f5c2ceaaf856ef30b4af9e09a194c0c3e9cb41c458f8181f111bed72 deviceinfo
2511fa519813061531757996fbbbb9eecae1a136d2e13149fd7afe04d19982c7eaa5ced8df57860bb816186f206915fcbd4a9e34fdf92b2c6efe3320a223c328 xorg.conf"

View file

@ -0,0 +1,32 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Asus Zenfone 5"
deviceinfo_manufacturer="ASUS"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk_install="true"
deviceinfo_arch="x86"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_disk="true"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1280"
deviceinfo_dev_touchscreen="/dev/input/event1"
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="init=/init pci=noearly earlyprintk=nologger loglevel=0 kmemleak=off androidboot.bootmedia=sdcard androidboot.hardware=redhookbay watchdog.watchdog_thresh=60 androidboot.spid=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx androidboot.serialno=01234567890123456789 ip=50.0.0.2:50.0.0.1::255.255.255.0::usb0:on vmalloc=172M slub_max_order=2"
deviceinfo_generate_bootimg="false"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base=""
deviceinfo_flash_offset_kernel=""
deviceinfo_flash_offset_ramdisk=""
deviceinfo_flash_offset_second=""
deviceinfo_flash_offset_tags=""
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1,4 @@
Section "Device"
Identifier "Card0"
Driver "fbdev"
EndSection

View file

@ -0,0 +1,32 @@
From 5c347fdb1f28ee2a7b58161985551a5431a5f886 Mon Sep 17 00:00:00 2001
From: Peter Mann <pm@xdd.sk>
Date: Sun, 5 Nov 2017 15:15:36 +0100
Subject: [PATCH 1/1] ipc/shm: fix redefinition of 'shm_rcu_free'
---
ipc/shm.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/ipc/shm.c b/ipc/shm.c
index 0001bf90..ddfad445 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -176,15 +176,6 @@ static void shm_rcu_free(struct rcu_head *head)
ipc_rcu_free(head);
}
-static void shm_rcu_free(struct rcu_head *head)
-{
- struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu);
- struct shmid_kernel *shp = ipc_rcu_to_struct(p);
-
- security_shm_free(shp);
- ipc_rcu_free(head);
-}
-
static inline void shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *s)
{
ipc_rmid(&shm_ids(ns), &s->shm_perm);
--
2.13.6

View file

@ -0,0 +1,111 @@
From 8d15a34e6564cbc5aea33f35d72f2787732eb231 Mon Sep 17 00:00:00 2001
From: Peter Mann <pm@xdd.sk>
Date: Sun, 5 Nov 2017 15:38:56 +0100
Subject: [PATCH 1/1] drivers/external_drivers: remove unused constants
---
.../media/pci/atomisp2/css2300/sh_css_params.c | 53 ----------------------
1 file changed, 53 deletions(-)
diff --git a/drivers/external_drivers/camera/drivers/media/pci/atomisp2/css2300/sh_css_params.c b/drivers/external_drivers/camera/drivers/media/pci/atomisp2/css2300/sh_css_params.c
index 6fecaee8..2d564487 100755
--- a/drivers/external_drivers/camera/drivers/media/pci/atomisp2/css2300/sh_css_params.c
+++ b/drivers/external_drivers/camera/drivers/media/pci/atomisp2/css2300/sh_css_params.c
@@ -1530,17 +1530,6 @@ static const struct sh_css_3a_config default_3a_config = {
{1027, 0, -9219, 16384, -9219, 1027, 0}
};
-static const struct sh_css_3a_config disabled_3a_config = {
- 25559,
- 32768,
- 7209,
- 65535,
- 0,
- 65535,
- {-6689, -12207, -32768, 32767, 12207, 6689, 0},
- {2053, 0, -18437, 32767, -18437, 2053, 0}
-};
-
static const struct sh_css_wb_config default_wb_config = {
1,
32768,
@@ -1694,12 +1683,6 @@ static const struct sh_css_ecd_config default_ecd_config = {
0, /* 0.0 */
};
-static const struct sh_css_ecd_config disabled_ecd_config = {
- 0, /* 0.0 */
- 0, /* 0.0 */
- 0, /* 0.0 */
-};
-
static const struct sh_css_ynr_config default_ynr_config = {
0,
0,
@@ -1707,13 +1690,6 @@ static const struct sh_css_ynr_config default_ynr_config = {
0,
};
-static const struct sh_css_ynr_config disabled_ynr_config = {
- 0,
- 0,
- 0,
- 0,
-};
-
static const struct sh_css_fc_config default_fc_config = {
1,
(1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
@@ -1726,18 +1702,6 @@ static const struct sh_css_fc_config default_fc_config = {
- (1 << (ISP_VEC_ELEMBITS - 1)), /* -1 */
};
-static const struct sh_css_fc_config disabled_fc_config = {
- 1,
- (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
- (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
- (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
- (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
- (1 << (ISP_VEC_ELEMBITS - 1)) - 1, /* 1 */
- (1 << (ISP_VEC_ELEMBITS - 1)) - 1, /* 1 */
- - (1 << (ISP_VEC_ELEMBITS - 1)), /* -1 */
- - (1 << (ISP_VEC_ELEMBITS - 1)), /* -1 */
-};
-
static const struct sh_css_cnr_config default_cnr_config = {
0,
0,
@@ -1749,17 +1713,6 @@ static const struct sh_css_cnr_config default_cnr_config = {
0
};
-static const struct sh_css_cnr_config disabled_cnr_config = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
-};
-
static const struct sh_css_macc_config default_macc_config = {
0,
};
@@ -1816,12 +1769,6 @@ default_rgb2yuv_cc_config = {
{2449, 4809, 934, -1382, -2714, 4096, 4096, -3430, -666}
};
-static const struct sh_css_rgb2yuv_cc_config
-disabled_rgb2yuv_cc_config = {
- /* Bits of fractional part = SH_CSS_RGB2YUV_CSC_COEF_SHIFT = 13s */
- {2449, 4809, 934, -1382, -2714, 4096, 4096, -3430, -666}
-};
-
static void
sh_css_dequeue_param_buffers(void);
--
2.13.6

View file

@ -0,0 +1,96 @@
From 4b344128fe59fc307aeb36bea6169fb91dbcf489 Mon Sep 17 00:00:00 2001
From: Peter Mann <pm@xdd.sk>
Date: Sun, 28 Jan 2018 14:13:06 +0100
Subject: [PATCH 1/1] ipc: fix undefined references
---
ipc/msg.c | 7 +++++--
ipc/sem.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/ipc/msg.c b/ipc/msg.c
index bcf96720f..32aaaab15 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -218,7 +218,8 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params)
return id;
}
- msg_unlock(msq);
+ ipc_unlock_object(&msq->q_perm);
+ rcu_read_unlock();
return msq->q_perm.id;
}
@@ -726,7 +727,9 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
rcu_read_unlock();
schedule();
- ipc_lock_by_ptr(&msq->q_perm);
+ rcu_read_lock();
+ ipc_lock_object(&msq->q_perm);
+
ipc_rcu_putref(msq, ipc_rcu_free);
if (msq->q_perm.deleted) {
err = -EIDRM;
diff --git a/ipc/sem.c b/ipc/sem.c
index 269aefeb1..b305649f3 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -196,6 +196,53 @@ void __init sem_init (void)
IPC_SEM_IDS, sysvipc_sem_proc_show);
}
+/**
+ * unmerge_queues - unmerge queues, if possible.
+ * @sma: semaphore array
+ *
+ * The function unmerges the wait queues if complex_count is 0.
+ * It must be called prior to dropping the global semaphore array lock.
+ */
+static void unmerge_queues(struct sem_array *sma)
+{
+ struct sem_queue *q, *tq;
+
+ /* complex operations still around? */
+ if (sma->complex_count)
+ return;
+ /*
+ * We will switch back to simple mode.
+ * Move all pending operation back into the per-semaphore
+ * queues.
+ */
+ list_for_each_entry_safe(q, tq, &sma->pending_alter, list) {
+ struct sem *curr;
+ curr = &sma->sem_base[q->sops[0].sem_num];
+
+ list_add_tail(&q->list, &curr->pending_alter);
+ }
+ INIT_LIST_HEAD(&sma->pending_alter);
+}
+
+/**
+ * merge_queues - Merge single semop queues into global queue
+ * @sma: semaphore array
+ *
+ * This function merges all per-semaphore queues into the global queue.
+ * It is necessary to achieve FIFO ordering for the pending single-sop
+ * operations when a multi-semop operation must sleep.
+ * Only the alter operations must be moved, the const operations can stay.
+ */
+static void merge_queues(struct sem_array *sma)
+{
+ int i;
+ for (i = 0; i < sma->sem_nsems; i++) {
+ struct sem *sem = sma->sem_base + i;
+
+ list_splice_init(&sem->pending_alter, &sma->pending_alter);
+ }
+}
+
static void sem_rcu_free(struct rcu_head *head)
{
struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu);
--
2.14.3

View file

@ -0,0 +1,85 @@
# Kernel config based on: arch/x86/configs/lineage_T00F_defconfig
pkgname="linux-asus-t00f"
pkgver=3.10.107
pkgrel=0
pkgdesc="Asus Zenfone 5 kernel fork"
arch="x86"
_carch="x86"
_flavor="asus-t00f"
url="https://kernel.org"
license="GPL2"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev xz"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_repository="android_kernel_asus_T00F"
_commit="ffd0a7e6f0d4ccb951f3e39aa805d9c7c6cb3291"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/zf5/${_repository}/archive/${_commit}.tar.gz
$_config
compiler-gcc6.h
01_ipc-shm-fix-redefinition-of-shm_rcu_free.patch
02_drivers-external_drivers-remove-unused-constants.patch
03_ipc-fix-undefined-references.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/"
# Remove -Werror from all makefiles
find . -type f -name Makefile -print0 | \
xargs -0 sed -i 's/-Werror-/-W/g'
find . -type f -name Makefile -print0 | \
xargs -0 sed -i 's/-Werror//g'
# Prepare kernel config ('yes ""' for kernels lacking olddefconfig)
cp "$srcdir"/$_config "$builddir"/.config
yes "" | make ARCH="$_carch" HOSTCC="$HOSTCC" oldconfig
}
menuconfig() {
cd "$builddir"
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
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="98ae9cabe828b9aa3ea38c01f2294398bde4e7dbc470acb87d404d65f7526a416892c2e9a6ca9dacb69d8fe30e6b61a230beb1c4d234e16d126b3c4197564945 linux-asus-t00f-ffd0a7e6f0d4ccb951f3e39aa805d9c7c6cb3291.tar.gz
5d4c4394a6a0f889f0b327175613dfffa1aedc1af124c7e87f967766d35abed680ce581ef23b1939ae61521186b4b2c6acb6a9e1257541c448aa3bcbcb66067c config-asus-t00f.x86
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
0f6a9be41ed61b8407a146e8ccbc5a7abbcffe150cbba01345fcfa8e31a1554274dc2d79015f0ea68f9b394e4af5bd7040e992b3950cf03d2ce1f2454fc0d529 01_ipc-shm-fix-redefinition-of-shm_rcu_free.patch
e55a90bc89a956d83b3d978e3fae871c781544571a667468b89a9f68b626b8d39a3000ea43ae276d5e069c1ca1b2309e72a1e7b6bae53e1d78500d054de3bbd2 02_drivers-external_drivers-remove-unused-constants.patch
7dd36856b2a56216172df1a89a1c7a1cd408141605b1d0bac1a3ecd2d57d0cb1fd58ccf9dea56983597a5432947ca8bdb8789740cb968d9898ba4e36bd6d2d7e 03_ipc-fix-undefined-references.patch"

View file

@ -0,0 +1,69 @@
// 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 */

File diff suppressed because it is too large Load diff