From c9f970ff281c415adaa696b3828ac9442a492cc6 Mon Sep 17 00:00:00 2001 From: red-black-bonsai <5213811-red-black-bonsai@users.noreply.gitlab.com> Date: Fri, 31 Jan 2020 22:59:56 +0100 Subject: [PATCH] zte-kis3: revive device; ported ZTE Open C (also known as Kis 3) from scratch again (!949) --- device/device-zte-kis3/APKBUILD | 12 ++-- device/device-zte-kis3/deviceinfo | 16 ++--- .../00_fix_return_address.patch | 49 ------------- .../02_gpu-msm-fix-gcc5-compile.patch | 33 --------- device/linux-zte-kis3/APKBUILD | 61 ++++++---------- device/linux-zte-kis3/compiler-gcc6.h | 69 ------------------- ...g-zte-kis3.armhf => config-zte-kis3.armv7} | 16 +++-- ...give-up-on-ilog2-const-optimizations.patch | 1 + device/linux-zte-kis3/gcc8-fix-put-user.patch | 1 + ...el-use-the-gnu89-standard-explicitly.patch | 1 + 10 files changed, 52 insertions(+), 207 deletions(-) delete mode 100644 device/linux-zte-kis3/00_fix_return_address.patch delete mode 100644 device/linux-zte-kis3/02_gpu-msm-fix-gcc5-compile.patch delete mode 100644 device/linux-zte-kis3/compiler-gcc6.h rename device/linux-zte-kis3/{config-zte-kis3.armhf => config-zte-kis3.armv7} (99%) create mode 120000 device/linux-zte-kis3/gcc7-give-up-on-ilog2-const-optimizations.patch create mode 120000 device/linux-zte-kis3/gcc8-fix-put-user.patch create mode 120000 device/linux-zte-kis3/kernel-use-the-gnu89-standard-explicitly.patch diff --git a/device/device-zte-kis3/APKBUILD b/device/device-zte-kis3/APKBUILD index 101fa40eb..d61d8e3a6 100644 --- a/device/device-zte-kis3/APKBUILD +++ b/device/device-zte-kis3/APKBUILD @@ -1,12 +1,13 @@ -# Reference: +# Contributor: red-black-bonsai # Contributor: Ethan R. Jones +# Reference: pkgname="device-zte-kis3" -pkgdesc="ZTE Kis 3" +pkgdesc="ZTE Open C / Kis 3" pkgver=0.1 -pkgrel=4 +pkgrel=5 url="https://postmarketos.org" license="MIT" -arch="armhf" +arch="armv7" options="!check !archcheck" depends="postmarketos-base linux-zte-kis3 mkbootimg mesa-dri-swrast" makedepends="devicepkg-dev" @@ -20,4 +21,5 @@ package() { devicepkg_package $startdir $pkgname } -sha512sums="fc30a7df98b00781b45dd7f44207b4a6616d9f6c483c05cea9a26f12d9b9f6d84d8cbc459c445adcef0a3e01ff6951275c7de70e7f473a4e100a1601fd309159 deviceinfo" + +sha512sums="c706f707f5fc1a7d5503ec931cfa4d8cef44ed0e22f1157607eabc30f874330294c2b7ceb659e569ddd4fa42be978fb1b5685d0f1ca737db491209ac86ca7232 deviceinfo" diff --git a/device/device-zte-kis3/deviceinfo b/device/device-zte-kis3/deviceinfo index 46e578c46..b1d5076cc 100644 --- a/device/device-zte-kis3/deviceinfo +++ b/device/device-zte-kis3/deviceinfo @@ -2,32 +2,32 @@ # Please use double quotes only. You can source this file in shell scripts. deviceinfo_format_version="0" -deviceinfo_name="ZTE Kis 3" +deviceinfo_name="ZTE Open C / Kis 3" deviceinfo_manufacturer="ZTE" deviceinfo_codename="zte-kis3" deviceinfo_date="" deviceinfo_dtb="" deviceinfo_modules_initfs="" -deviceinfo_arch="armhf" +deviceinfo_arch="armv7" # Device related deviceinfo_keyboard="false" +deviceinfo_external_storage="true" deviceinfo_screen_width="480" deviceinfo_screen_height="800" -deviceinfo_external_storage="true" -deviceinfo_dev_touchscreen="" +deviceinfo_dev_touchscreen="/dev/input/event3" deviceinfo_dev_touchscreen_calibration="" deviceinfo_dev_keyboard="" # Bootloader related deviceinfo_flash_method="fastboot" -deviceinfo_kernel_cmdline="console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37" +deviceinfo_kernel_cmdline="console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=23 msm_rtb.filter=0x37 androidboot.bootdevice=msm_sdcc.1" deviceinfo_generate_bootimg="true" deviceinfo_bootimg_qcdt="true" +deviceinfo_bootimg_dtb_second="false" deviceinfo_flash_offset_base="0x00000000" deviceinfo_flash_offset_kernel="0x00008000" -deviceinfo_flash_offset_ramdisk="0x02000000" +deviceinfo_flash_offset_ramdisk="0x01000000" deviceinfo_flash_offset_second="0x00f00000" -deviceinfo_flash_offset_tags="0x01e00000" +deviceinfo_flash_offset_tags="0x00000100" deviceinfo_flash_pagesize="2048" - diff --git a/device/linux-zte-kis3/00_fix_return_address.patch b/device/linux-zte-kis3/00_fix_return_address.patch deleted file mode 100644 index 287d1f707..000000000 --- a/device/linux-zte-kis3/00_fix_return_address.patch +++ /dev/null @@ -1,49 +0,0 @@ -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/device/linux-zte-kis3/02_gpu-msm-fix-gcc5-compile.patch b/device/linux-zte-kis3/02_gpu-msm-fix-gcc5-compile.patch deleted file mode 100644 index 91b17cd76..000000000 --- a/device/linux-zte-kis3/02_gpu-msm-fix-gcc5-compile.patch +++ /dev/null @@ -1,33 +0,0 @@ -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; diff --git a/device/linux-zte-kis3/APKBUILD b/device/linux-zte-kis3/APKBUILD index e9a159573..f5e263548 100644 --- a/device/linux-zte-kis3/APKBUILD +++ b/device/linux-zte-kis3/APKBUILD @@ -1,57 +1,40 @@ +# Contributor: Ethan R. Jones +# Contributor: red-black-bonsai +# Reference: # Kernel config based on: arch/arm/configs/msm8610-zte_defconfig pkgname="linux-zte-kis3" pkgver=3.4.0 -pkgrel=2 -pkgdesc="ZTE Kis 3 kernel fork" -arch="armhf" +pkgrel=3 +pkgdesc="ZTE Open C / Kis 3 kernel fork" +arch="armv7" _carch="arm" _flavor="zte-kis3" url="https://kernel.org" -license="GPL2" +license="GPL-2.0-only" options="!strip !check !tracedeps" -makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev dtbtool xz gcc6" +makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev dtbtool xz" -# 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 for instructions. -if [ "${CC:0:5}" != "gcc6-" ]; then - CC="gcc6-$CC" - HOSTCC="gcc6-gcc" - CROSS_COMPILE="gcc6-$CROSS_COMPILE" -fi +# Compiler: latest GCC from Alpine +HOSTCC="${CC:-gcc}" +HOSTCC="${HOSTCC#${CROSS_COMPILE}}" # Source _repository="android_kernel_zte_msm8610" _commit="b55a46067bb75d8a290b2cc0e07f5fb3d8207cb1" -_config="config-${_flavor}.${arch}" +_config="config-$_flavor.$arch" source=" - $pkgname-$_commit.tar.gz::https://github.com/KonstaT/${_repository}/archive/${_commit}.tar.gz + $pkgname-$_commit.tar.gz::https://github.com/KonstaT/$_repository/archive/$_commit.tar.gz $_config - compiler-gcc6.h - 00_fix_return_address.patch - 02_gpu-msm-fix-gcc5-compile.patch + gcc7-give-up-on-ilog2-const-optimizations.patch + gcc8-fix-put-user.patch + kernel-use-the-gnu89-standard-explicitly.patch " -builddir="$srcdir/${_repository}-${_commit}" +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 + downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC" } build() { @@ -88,7 +71,7 @@ package() { } sha512sums="5759d54232e0c83e71896fc4c859fe8554731678defa337ec9da441505e03fb2f3b795fb68b35dec8e0fc6a920e82f03cd986badc05cf55c993d22085620bebc linux-zte-kis3-b55a46067bb75d8a290b2cc0e07f5fb3d8207cb1.tar.gz -1f9c7131401569c5a784b7a63744800a58dd226d5beabba93ae2a64b98b71233f4bcbe15ea5ce8170a85afc9f1271c82e7b92136d5c7023d87064f403d1a02d7 config-zte-kis3.armhf -d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h -ea1d3b5a234fa565e3c1a792de48f4fc4e6023d281d303c8e319c7ef28edc5739ab0e4dea0139a41f0a5c7d03e27921ccaa214fd0ac5c72245a094ce60128864 00_fix_return_address.patch -7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 02_gpu-msm-fix-gcc5-compile.patch" +feb81328c96af6f97789bb39b288f769f4ef47aa2372dcdf9b87073c43a4688478073d492781646153424f4aa2d79a1468edf3f70c9cb9c555d266aeef9b7886 config-zte-kis3.armv7 +77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch +197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch +ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch" diff --git a/device/linux-zte-kis3/compiler-gcc6.h b/device/linux-zte-kis3/compiler-gcc6.h deleted file mode 100644 index 844706318..000000000 --- a/device/linux-zte-kis3/compiler-gcc6.h +++ /dev/null @@ -1,69 +0,0 @@ -// SOURCE: -// https://github.com/NextThingCo/CHIP-u-boot/issues/10#issuecomment-287515505 - -#ifndef __LINUX_COMPILER_H -#error "Please don't include directly, include 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 */ - diff --git a/device/linux-zte-kis3/config-zte-kis3.armhf b/device/linux-zte-kis3/config-zte-kis3.armv7 similarity index 99% rename from device/linux-zte-kis3/config-zte-kis3.armhf rename to device/linux-zte-kis3/config-zte-kis3.armv7 index 2bebebec8..aec4a4de5 100644 --- a/device/linux-zte-kis3/config-zte-kis3.armhf +++ b/device/linux-zte-kis3/config-zte-kis3.armv7 @@ -118,7 +118,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_RD_GZIP=y CONFIG_RD_BZIP2=y CONFIG_RD_LZMA=y -# CONFIG_RD_XZ is not set +CONFIG_RD_XZ=y # CONFIG_RD_LZO is not set # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SYSCTL=y @@ -1149,7 +1149,7 @@ CONFIG_CFG80211_WEXT=y # CONFIG_UEVENT_HELPER_PATH="" CONFIG_DEVTMPFS=y -# CONFIG_DEVTMPFS_MOUNT is not set +CONFIG_DEVTMPFS_MOUNT=y CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y CONFIG_FW_LOADER=y @@ -3204,11 +3204,19 @@ CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y -# CONFIG_XZ_DEC is not set -# CONFIG_XZ_DEC_BCJ is not set +CONFIG_XZ_DEC=y +CONFIG_XZ_DEC_X86=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set CONFIG_DECOMPRESS_GZIP=y CONFIG_DECOMPRESS_BZIP2=y CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_XZ=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_REED_SOLOMON=y CONFIG_REED_SOLOMON_ENC8=y diff --git a/device/linux-zte-kis3/gcc7-give-up-on-ilog2-const-optimizations.patch b/device/linux-zte-kis3/gcc7-give-up-on-ilog2-const-optimizations.patch new file mode 120000 index 000000000..da3d1ed41 --- /dev/null +++ b/device/linux-zte-kis3/gcc7-give-up-on-ilog2-const-optimizations.patch @@ -0,0 +1 @@ +../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch \ No newline at end of file diff --git a/device/linux-zte-kis3/gcc8-fix-put-user.patch b/device/linux-zte-kis3/gcc8-fix-put-user.patch new file mode 120000 index 000000000..1d40b2674 --- /dev/null +++ b/device/linux-zte-kis3/gcc8-fix-put-user.patch @@ -0,0 +1 @@ +../../.shared-patches/linux/gcc8-fix-put-user.patch \ No newline at end of file diff --git a/device/linux-zte-kis3/kernel-use-the-gnu89-standard-explicitly.patch b/device/linux-zte-kis3/kernel-use-the-gnu89-standard-explicitly.patch new file mode 120000 index 000000000..a5f4de276 --- /dev/null +++ b/device/linux-zte-kis3/kernel-use-the-gnu89-standard-explicitly.patch @@ -0,0 +1 @@ +../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch \ No newline at end of file