From 7cfab311f401e57a5cfd66218eee2e5031b61f0d Mon Sep 17 00:00:00 2001 From: Santosh D Date: Sat, 27 May 2017 21:00:21 +0200 Subject: [PATCH] prepping port for maguro (galaxy nexus GSM) in case it decides to boot again at some point --- aports/device-samsung-maguro/deviceinfo | 26 ++++++ aports/linux-samsung_tuna/APKBUILD | 105 ++++++++++++++++++++++ aports/linux-samsung_tuna/compiler-gcc6.h | 69 ++++++++++++++ 3 files changed, 200 insertions(+) create mode 100644 aports/device-samsung-maguro/deviceinfo create mode 100644 aports/linux-samsung_tuna/APKBUILD create mode 100644 aports/linux-samsung_tuna/compiler-gcc6.h diff --git a/aports/device-samsung-maguro/deviceinfo b/aports/device-samsung-maguro/deviceinfo new file mode 100644 index 00000000..c84f702c --- /dev/null +++ b/aports/device-samsung-maguro/deviceinfo @@ -0,0 +1,26 @@ +# This document format is a draft. +# You can source it in shell scripts. +# Use only double quotes. + +deviceinfo_format_version="0" +deviceinfo_name="Google Galaxy Nexus" +deviceinfo_manufacturer="Samsung" +deviceinfo_date="" +deviceinfo_keyboard="false" +deviceinfo_nonfree="????" +deviceinfo_dtb="" +deviceinfo_modules="" +deviceinfo_modules_initfs="" +deviceinfo_external_disk="false" +deviceinfo_external_disk_install="false" +deviceinfo_flash_methods="fastboot" +deviceinfo_arch="armhf" + + +# You can for example extract these from an existing boot.img +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" diff --git a/aports/linux-samsung_tuna/APKBUILD b/aports/linux-samsung_tuna/APKBUILD new file mode 100644 index 00000000..9dd5d310 --- /dev/null +++ b/aports/linux-samsung_tuna/APKBUILD @@ -0,0 +1,105 @@ +# APKBUILD based on linux-vanilla aport. Changes: +# - disabled module installation +# - add !check !tracedeps +# - package: just install zimage and kernel.release, because the kernel config +# does not generate modules or dtb files +# - do not create -dev subpackage (makes no sense without module support) +# +# Kernel config based on: arch/arm/configs/lineageos_mako_defconfig +# Changes: +# - enable devtmpfs (needed for udev -> touch support in weston) + +_vendor=samsung +_flavor=samsung_tuna +_hash="e14e5fe679a63eef92346cde874175d8b62b6a4a" +_config="config-${_flavor}.armhf" + +pkgname=linux-${_flavor} +pkgver=3.4.0 +case $pkgver in + *.*.*) _kernver=${pkgver%.*};; + *.*) _kernver=$pkgver;; +esac +pkgrel=3 +arch="armhf" +pkgdesc="Nexus 4 kernel from LineageOS" +url="https://github.com/LineageOS/android_kernel_samsung_tuna" +depends="postmarketos-mkinitfs" +makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev" +options="!strip !check !tracedeps" +install= +source=" + https://github.com/LineageOS/android_kernel_${_flavor}/archive/${_hash}.zip + $_config + compiler-gcc6.h +" +subpackages="" +license="GPL2" + +_abi_release=${pkgver} +_carch="arm" +HOSTCC="${CC:-gcc}" +HOSTCC="${HOSTCC#${CROSS_COMPILE}}" + +ksrcdir="$srcdir/android_kernel_${_flavor}-${_hash}" + +prepare() { + local _patch_failed= + cd "$ksrcdir" + + # first apply patches in specified order + for i in $source; do + case $i in + *.patch) + msg "Applying $i..." + if ! patch -s -p1 -N -i "$srcdir"/$i; then + echo $i >>failed + _patch_failed=1 + fi + ;; + esac + done + + if ! [ -z "$_patch_failed" ]; then + error "The following patches failed:" + cat failed + return 1 + fi + + # gcc6 support + cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/" + + mkdir -p "$srcdir"/build + cp "$srcdir"/$_config "$srcdir"/build/.config || return 1 + make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \ + silentoldconfig +} + + + +# this is so we can do: 'abuild menuconfig' to reconfigure kernel +menuconfig() { + cd "$srcdir"/build || return 1 + make ARCH="$_carch" menuconfig + cp .config "$startdir"/$_config +} + +build() { + cd "$srcdir"/build + unset LDFLAGS + make ARCH="$_carch" CC="${CC:-gcc}" \ + KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \ + || return 1 +} + +package() { + install -Dm644 "$srcdir/build/arch/arm/boot/zImage" \ + "$pkgdir/boot/vmlinuz-$_flavor" + + install -D "$srcdir/build/include/config/kernel.release" \ + "$pkgdir/usr/share/kernel/$_flavor/kernel.release" +} + +sha512sums="c048b4f195ac6083e1884e41a7fc77c111edb555e6d53ee391d6220f308138c76389edaeb6b166c6f132fa33e8588f03734ed70397440a738b8e3f1c0068fbab e14e5fe679a63eef92346cde874175d8b62b6a4a.zip +15bbca94f10b321c03aa0c4a79c98b9b812c2b7fc5f72877fcb9973be37b65d289b51a9b324775d32ce22e653c53aa7e3bc5619ab68b2e92bcbf44d9d727912c config-samsung_tuna.armhf +d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h" diff --git a/aports/linux-samsung_tuna/compiler-gcc6.h b/aports/linux-samsung_tuna/compiler-gcc6.h new file mode 100644 index 00000000..84470631 --- /dev/null +++ b/aports/linux-samsung_tuna/compiler-gcc6.h @@ -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 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 */ +