htc-k2u: new device (HTC One SV) (!412)

Device boots, USB networking works.

[ci:skip-build]: already built successfully in CI
This commit is contained in:
hacker12455 2019-06-06 15:57:43 +02:00 committed by Oliver Smith
parent 974fa8e028
commit 3336552bef
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
13 changed files with 4017 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# Touchscreen
SUBSYSTEM=="input", ATTRS{name}=="synaptics-rmi-touchscreen", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1"

View file

@ -0,0 +1,27 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-htc-k2ul"
pkgdesc="HTC One SV"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-htc-k2ul mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
source="deviceinfo initfs-hook.sh 90-android-touch-dev.rules"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -D -m644 "$srcdir"/90-android-touch-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
}
sha512sums="82d2659d9d1711ff4451f5041c1e0fa51fc869461e6bfa1741ff9819b743ab62676e8386a5c428214ed0f1e7a98d7ab532beb479f868496a21dd1e3197bfd091 deviceinfo
e1fa365c75602eb3144ef36f0b1f1c622fea092c758064355c277daf58848655e51ed9db6cbef57a6fe605378a97f778a0b5e3ffca80797257369dc3064419de initfs-hook.sh
f0f69ab3b5b3fed11ec5049f37c71c4e9dcf87dc1f238199a3917dd61957d46783a8798d63d400cc5d3983987e750e3fec6d7117561ad5005f28131ae4821d66 90-android-touch-dev.rules"

View 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="HTC One SV"
deviceinfo_manufacturer="HTC"
deviceinfo_codename="htc-k2ul"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armv7"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="480"
deviceinfo_screen_height="800"
deviceinfo_dev_touchscreen=""
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=ttyHSL0,115200,n8 user_debug=31"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x80400000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01408000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1 @@
echo 4 > /sys/devices/platform/android_usb/usb_function_switch

View file

@ -0,0 +1,81 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/k2_ul_defconfig
pkgname="linux-htc-k2ul"
pkgver=3.4.10
pkgrel=0
pkgdesc="HTC One SV kernel fork"
arch="armv7"
_carch="arm"
_flavor="htc-k2ul"
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 gcc4"
# Compiler: GCC 6 (doesn't boot when compiled with newer versions)
if [ "${CC:0:5}" != "gcc4-" ]; then
CC="gcc4-$CC"
HOSTCC="gcc4-gcc"
CROSS_COMPILE="gcc4-$CROSS_COMPILE"
fi
# Source
# How to get the original version:
# 1. Go to HTCDev.com, log in and go to the kernel source page
# 2. Select the One SV, EU region and the v4.1.2 Android version
# 3. Download the kernel with the 2.14.401.6 description
_repository="k2ul-jb-3.4.10-cl157896-2"
_commit="6ac3629384fac88beef65fd841f5135f9f832624"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/Hacker1245/${_repository}/archive/${_commit}.tar.gz
$_config
gcc8-fix-put-user.patch
fix_return_address.patch
no-hardcoded-CROSS_COMPILE.patch
fix_perl.patch
fix_otg_errors.patch
fix_kgsl_error.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="de02e36c7c19c886cc1f16b5a3a4464542a905e85cc3a531bd27b4944ee1ada01aad6e5fe8fd0346b991c923144154fbce8d86b17f69e69d05549440129b2fc9 linux-htc-k2ul-6ac3629384fac88beef65fd841f5135f9f832624.tar.gz
fbe46ba6b9e76fbae886be1544dd84a37a06856d67d8a1ddd5e8f22b75e126bef065388dea43fd5ac9e3229c013d1193adb4dd6e257f7f3d6947cb90deda6c10 config-htc-k2ul.armv7
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
b0a73e261b6dedfe6135a17d25e9e989958b4ae379ba31abbf9b0e05f50f3082c4f5d4ff4fb848e8d283acbf68c54014ac8cfcc57d4e1be2d456e715237b661c fix_return_address.patch
555033f2ef3e23d84a552e92a6307bf292f91146ee4d8a03b2485f9b5028c2aa3f7ced6ef268acaca7d12649f4bfa7f8fccca39394097f63a5ff2134b912e9e2 no-hardcoded-CROSS_COMPILE.patch
584543558b32dc4fe6d1156a466b8c6acf869cbe64cd59cbbc9d54b716d195ea2807f2c337b4a22a0bbd9b350b07f27de0fd4c750b599afb337ff953dd920bd9 fix_perl.patch
f6229e37304d127cd39bbbd6f0e11100ca8c6b44f1e66b125aba06d7d5ae96d380273e55a7a8fec46af324979523e032de9151d92e181da9242fb5aaf0dba769 fix_otg_errors.patch
c84d3eb75628ee37ad5d16f858bdbf7b9fc2ff1336e5d91559ecdc4d198127b25929c3b264a50f526fafd3722aa39fb2d87fedcfb3a134f2ddd355650a65a4bd fix_kgsl_error.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,21 @@
diff -Naur a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c
--- a/drivers/gpu/msm/kgsl_iommu.c 2013-11-29 03:09:34.000000000 +0100
+++ b/drivers/gpu/msm/kgsl_iommu.c 2019-05-26 00:59:09.026481139 +0200
@@ -520,7 +520,7 @@
return status;
}
-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;
@@ -571,7 +571,7 @@
return cmds - start;
}
-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,87 @@
diff -Naur k2ul-jb-3.4.10-cl157896-2-clone/arch/arm/mm/init.c k2ul-jb-3.4.10-cl157896-2/arch/arm/mm/init.c
--- k2ul-jb-3.4.10-cl157896-2-clone/arch/arm/mm/init.c 2013-07-04 09:45:43.000000000 +0200
+++ k2ul-jb-3.4.10-cl157896-2/arch/arm/mm/init.c 2019-05-27 17:27:17.141150059 +0200
@@ -97,7 +97,7 @@
int free = 0, total = 0, reserved = 0;
int shared = 0, cached = 0, slab = 0, i;
struct meminfo * mi = &meminfo;
- unsigned long kgsl_alloc = kgsl_get_alloc_size(0);
+//unsigned long kgsl_alloc = kgsl_get_alloc_size(0);
int ion_alloc = ion_iommu_heap_dump_size();
printk("Mem-info:\n");
@@ -143,7 +143,7 @@
printk("%d slab pages\n", slab);
printk("%d pages shared\n", shared);
printk("%d pages swap cached\n", cached);
- printk("KGSL_ALLOC: %8lu kB\n", kgsl_alloc >> 10);
+ //printk("KGSL_ALLOC: %8lu kB\n", kgsl_alloc >> 10);
printk("ION_ALLOC: %8d kB\n", ion_alloc >> 10);
}
diff -Naur k2ul-jb-3.4.10-cl157896-2-clone/fs/proc/meminfo.c k2ul-jb-3.4.10-cl157896-2/fs/proc/meminfo.c
--- k2ul-jb-3.4.10-cl157896-2-clone/fs/proc/meminfo.c 2013-07-04 09:47:08.000000000 +0200
+++ k2ul-jb-3.4.10-cl157896-2/fs/proc/meminfo.c 2019-05-27 17:38:40.642919168 +0200
@@ -29,7 +29,7 @@
unsigned long pages[NR_LRU_LISTS];
int lru;
unsigned long ion_alloc = ion_iommu_heap_dump_size();
- unsigned long kgsl_alloc = kgsl_get_alloc_size(1);
+//unsigned long kgsl_alloc = kgsl_get_alloc_size(1);
unsigned long subtotal;
#define K(x) ((x) << (PAGE_SHIFT - 10))
@@ -52,7 +52,7 @@
K(global_page_state(NR_SLAB_RECLAIMABLE) + global_page_state(NR_SLAB_UNRECLAIMABLE)) +
(global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024) +
K(global_page_state(NR_PAGETABLE)) +
- (vmi.alloc >> 10) + (kgsl_alloc >> 10) + (ion_alloc >> 10);
+ //(vmi.alloc >> 10) + (kgsl_alloc >> 10) + (ion_alloc >> 10);
printk("MemFree: %8lu kB\n"
"Buffers: %8lu kB\n"
@@ -65,7 +65,7 @@
"KernelStack: %8lu kB\n"
"VmallocAlloc: %8lu kB\n"
"ION_Alloc: %8lu kB\n"
- "KGSL_Alloc: %8lu kB\n"
+ //"KGSL_Alloc: %8lu kB\n"
"Subtotal: %8lu kB\n",
K(i.freeram),
K(i.bufferram),
@@ -78,7 +78,7 @@
global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024,
(vmi.alloc >> 10),
(ion_alloc >> 10),
- (kgsl_alloc >> 10),
+ //(kgsl_alloc >> 10),
subtotal);
}
@@ -91,7 +91,7 @@
long cached;
unsigned long pages[NR_LRU_LISTS];
int lru;
- unsigned long kgsl_alloc = kgsl_get_alloc_size(0);
+//unsigned long kgsl_alloc = kgsl_get_alloc_size(0);
#define K(x) ((x) << (PAGE_SHIFT - 10))
si_meminfo(&i);
@@ -161,7 +161,7 @@
"VmallocUserMap: %8lu kB\n"
"VmallocVpage: %8lu kB\n"
"VmallocChunk: %8lu kB\n"
- "KGSL_ALLOC: %8lu kB\n"
+ //"KGSL_ALLOC: %8lu kB\n"
"ION_ALLOC: %8d kB\n"
#ifdef CONFIG_MEMORY_FAILURE
"HardwareCorrupted: %5lu kB\n"
@@ -227,7 +227,7 @@
vmi.usermap >> 10,
vmi.vpages >> 10,
vmi.largest_chunk >> 10,
- kgsl_alloc >> 10,
+ //kgsl_alloc >> 10,
ion_iommu_heap_dump_size() >> 10
#ifdef CONFIG_MEMORY_FAILURE
,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10)

View file

@ -0,0 +1,19 @@
diff -Naur a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
--- a/drivers/usb/otg/msm_otg.c 2013-11-29 03:09:34.000000000 +0100
+++ b/drivers/usb/otg/msm_otg.c 2019-05-26 01:27:37.680546290 +0200
@@ -2374,13 +2374,8 @@
!test_bit(B_SESS_VLD, &motg->inputs)) {
if (motg->connect_type != CONNECT_TYPE_NONE) {
motg->connect_type = CONNECT_TYPE_NONE;
- queue_work(motg->usb_wq, &motg->notifier_work);
- }
-
- if (check_htc_mode_status() != NOT_ON_AUTOBOT) {
- htc_mode_enable(0);
- android_switch_default();
- }
+ queue_work(motg->usb_wq, &motg->notifier_work);}
+
USBH_INFO("!id || id_a/b || !b_sess_vld\n");
motg->chg_state = USB_CHG_STATE_UNDEFINED;
motg->chg_type = USB_INVALID_CHARGER;

View file

@ -0,0 +1,12 @@
diff -Naur a/kernel/timeconst.pl b/kernel/timeconst.pl
--- a/kernel/timeconst.pl 2013-11-29 03:09:36.000000000 +0100
+++ b/kernel/timeconst.pl 2019-05-26 00:21:42.701338888 +0200
@@ -370,7 +370,7 @@
}
@val = @{$canned_values{$hz}};
- if (!defined(@val)) {
+ if (!@val) {
@val = compute_values($hz);
}
output($hz, @val);

View file

@ -0,0 +1,30 @@
diff -Naur a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
--- a/arch/arm/include/asm/ftrace.h 2013-11-29 03:09:28.000000000 +0100
+++ b/arch/arm/include/asm/ftrace.h 2019-05-25 23:47:19.735062444 +0200
@@ -38,7 +38,7 @@
#else
-extern inline void *return_address(unsigned int level)
+static inline void *return_address(unsigned int level)
{
return NULL;
}
diff -Naur a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
--- a/arch/arm/kernel/return_address.c 2013-11-29 03:09:29.000000000 +0100
+++ b/arch/arm/kernel/return_address.c 2019-05-25 23:45:57.148013069 +0200
@@ -62,11 +62,8 @@
#warning "TODO: return_address should use unwind tables"
#endif
-void *return_address(unsigned int level)
-{
- return NULL;
-}
-#endif
+
+#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
EXPORT_SYMBOL_GPL(return_address);

View file

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

View file

@ -0,0 +1,12 @@
diff -Naur a/Makefile b/Makefile
--- a/Makefile 2013-11-29 03:09:36.000000000 +0100
+++ b/Makefile 2019-05-25 23:21:31.810636014 +0200
@@ -194,8 +194,6 @@
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
-ARCH := arm
-CROSS_COMPILE := arm-eabi-
# Architecture as present in compile.h
UTS_MACHINE := $(ARCH)