From 703de5d042a65dae1113187553f1128cb86ae507 Mon Sep 17 00:00:00 2001 From: Martijn Braam Date: Tue, 30 May 2017 23:42:55 +0200 Subject: [PATCH] LG Hammerhead kernel finally compiles --- linux-lg-hammerhead/APKBUILD | 35 ++++++------- ...3592a13bf12861943e44fc48f1f270941f8d.patch | 49 +++++++++++++++++++ .../gpu-msm-fix-gcc5-compile.patch | 33 +++++++++++++ 3 files changed, 100 insertions(+), 17 deletions(-) create mode 100644 linux-lg-hammerhead/aeea3592a13bf12861943e44fc48f1f270941f8d.patch create mode 100644 linux-lg-hammerhead/gpu-msm-fix-gcc5-compile.patch diff --git a/linux-lg-hammerhead/APKBUILD b/linux-lg-hammerhead/APKBUILD index 08c930e32..4d7878a78 100644 --- a/linux-lg-hammerhead/APKBUILD +++ b/linux-lg-hammerhead/APKBUILD @@ -11,26 +11,28 @@ _vendor=lg _flavor=lg-hammerhead -_hash="v4.11" -_config="config-${_flavor}.armhf" +_hash="1dae34efb7d2399073ca371c953aafd2ed503849" +_config="hammerhead_defconfig" pkgname=linux-${_flavor} -pkgver=4.11 +pkgver=3.4.0 case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac pkgrel=3 arch="armhf" -pkgdesc="Linux 4.11 with hammerhead config" -url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=hammerhead" +pkgdesc="LineageOS kernel for Nexus 5 hammerhead" +url="https://github.com/LineageOS/android_kernel_lge_hammerhead" depends="postmarketos-mkinitfs" makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev" options="!strip !check !tracedeps" install= source=" - https://github.com/torvalds/linux/archive/${_hash}.zip - $_config + https://github.com/LineageOS/android_kernel_lge_hammerhead/archive/${_hash}.zip + compiler-gcc6.h + aeea3592a13bf12861943e44fc48f1f270941f8d.patch + gpu-msm-fix-gcc5-compile.patch " subpackages="" license="GPL2" @@ -40,7 +42,7 @@ _carch="arm" HOSTCC="${CC:-gcc}" HOSTCC="${HOSTCC#${CROSS_COMPILE}}" -ksrcdir="$srcdir/linux-${pkgver}" +ksrcdir="$srcdir/android_kernel_lge_hammerhead-${_hash}" prepare() { local _patch_failed= @@ -66,14 +68,11 @@ prepare() { fi # gcc6 support - # cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/" + cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/" mkdir -p "$srcdir"/build - cp "$srcdir"/$_config "$srcdir"/build/.config || return 1 - rm "$ksrcdir"/arch/arm/boot/dts/include/dt-bindings - ln -s "$ksrcdir"/include/dt-bindings "$ksrcdir"/arch/arm/boot/dts/include/ - make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" CROSS_COMPILE=arm-linux-gnueabi- \ - silentoldconfig + make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" CONFIG_NO_ERROR_ON_MISMATCH=y HOSTCC="$HOSTCC" CROSS_COMPILE=arm-linux-gnueabi- \ + ${_config} } @@ -89,7 +88,7 @@ build() { cd "$srcdir"/build unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \ + KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \ || return 1 } @@ -101,5 +100,7 @@ package() { "$pkgdir/usr/share/kernel/$_flavor/kernel.release" } -sha512sums="bfce6c290a7d372a018599fb835800a2cb5c3488883f4bd55c78b2197c6fb9420a8ac2f7740c054330948c62f0ffeafccdd386b6b57e8e4e794a74abb0ff12f6 v4.11.zip -ab220bd127daf0eb3b97279d6f050b520a0cf51c7f25ac2dae3ad038644344dbbe42a62fc8a258f4be1cedc5713ffff479bdbc8ea4c13974b67988f4f7fcd02a config-lg-hammerhead.armhf" +sha512sums="882ec7d4ce3eadb372c1279f53fab18c5c7f18109d3df2c8c4005ec5d06e6244c2c788c3183defa4d4aaf493a5c1bf905d8bd2aeb554e4b0680b0e1b45de6742 1dae34efb7d2399073ca371c953aafd2ed503849.zip +d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h +ea1d3b5a234fa565e3c1a792de48f4fc4e6023d281d303c8e319c7ef28edc5739ab0e4dea0139a41f0a5c7d03e27921ccaa214fd0ac5c72245a094ce60128864 aeea3592a13bf12861943e44fc48f1f270941f8d.patch +7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 gpu-msm-fix-gcc5-compile.patch" diff --git a/linux-lg-hammerhead/aeea3592a13bf12861943e44fc48f1f270941f8d.patch b/linux-lg-hammerhead/aeea3592a13bf12861943e44fc48f1f270941f8d.patch new file mode 100644 index 000000000..287d1f707 --- /dev/null +++ b/linux-lg-hammerhead/aeea3592a13bf12861943e44fc48f1f270941f8d.patch @@ -0,0 +1,49 @@ +From aeea3592a13bf12861943e44fc48f1f270941f8d Mon Sep 17 00:00:00 2001 +From: Behan Webster +Date: Wed, 24 Sep 2014 01:06:46 +0100 +Subject: [PATCH] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h + +With compilers which follow the C99 standard (like modern versions of gcc and +clang), "extern inline" does the wrong thing (emits code for an externally +linkable version of the inline function). In this case using static inline +and removing the NULL version of return_address in return_address.c does +the right thing. + +Signed-off-by: Behan Webster +Reviewed-by: Mark Charlebois +Acked-by: Steven Rostedt +Signed-off-by: Russell King +--- + arch/arm/include/asm/ftrace.h | 2 +- + arch/arm/kernel/return_address.c | 5 ----- + 2 files changed, 1 insertion(+), 6 deletions(-) + +diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h +index 39eb16b0066f2..bfe2a2f5a644e 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 fafedd86885dd..f6aa84d5b93c9 100644 +--- 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); diff --git a/linux-lg-hammerhead/gpu-msm-fix-gcc5-compile.patch b/linux-lg-hammerhead/gpu-msm-fix-gcc5-compile.patch new file mode 100644 index 000000000..91b17cd76 --- /dev/null +++ b/linux-lg-hammerhead/gpu-msm-fix-gcc5-compile.patch @@ -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 + +--- a/drivers/gpu/msm/kgsl_iommu.c ++++ b/drivers/gpu/msm/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;