Initial support for OnePlus One (bacon) (#523)

Currently using the LineageOS 15.0 kernel.
This commit is contained in:
Jean Lucas 2017-09-06 06:27:14 -04:00 committed by Martijn Braam
parent 7cfdd2f3e1
commit 1afc41e0e4
7 changed files with 3959 additions and 0 deletions

View file

@ -0,0 +1,2 @@
# udev rules file
# All device names can be read from weston's logfile (/tmp/weston.log in postmarketOS)

View file

@ -0,0 +1,27 @@
pkgname=device-oneplus-bacon
pkgver=1
pkgrel=1
pkgdesc="OnePlus One"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-oneplus-bacon linux-firmware mkbootimg"
makedepends=""
install=""
subpackages=""
source="90-android.rules deviceinfo"
options="!check"
build() {
return 0
}
package() {
install -D -m644 "$srcdir"/90-android.rules \
"$pkgdir"/etc/udev/rules.d/90-android.rules
install -D -m644 "$srcdir"/deviceinfo \
"$pkgdir"/etc/deviceinfo
}
sha512sums="155aa9c8bd0e202917c7f55312eaaa189114864d89bbf7fdbdcc4fe146af3c7c781a6e76b0030046383dee823465a994d6954408248cc2f43e48af40869d6b25 90-android.rules
54c9a25dfbfff8381009f1e49e8b22bb89bd1decf3f9900e67f4f2c9e6b25db4715d4b72e7d9d9791d7d637971e0ac40086746d29c324ffe009b02b06a0b8a30 deviceinfo"

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="OnePlus One"
deviceinfo_manufacturer="OnePlus"
deviceinfo_date=""
deviceinfo_keyboard="false"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="false"
deviceinfo_external_disk_install="false"
deviceinfo_flash_methods="fastboot"
deviceinfo_arch="armhf"
# Splash screen
deviceinfo_screen_width="1080"
deviceinfo_screen_height="1920"
# Fastboot related
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x02000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x01e00000"
deviceinfo_flash_offset_base="0"
deviceinfo_flash_pagesize="2048"
deviceinfo_kernel_cmdline="console=ttyHSL0,115200,n8 androidboot.hardware=bacon user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=msm_sdcc.1 buildvariant=userdebug"
deviceinfo_weston_core_modules="xwayland.so"

View file

@ -0,0 +1,127 @@
# APKBUILD based on linux-vanilla aport. Changes:
# - add !check !tracedeps
# - do not create -dev subpackage
#
# Kernel config based on: arch/arm/configs/lineageos_bacon_defconfig
# Changes:
# - enable loadable module support
# - enable devtmpfs (needed for udev -> touch support in weston)
_vendor=oneplus
_flavor=oneplus-bacon
_version="lineage-15.0"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=3.4.113
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=1
arch="armhf"
pkgdesc="LineageOS kernel for OnePlus One"
url="https://github.com/LineageOS/android_kernel_oneplus_msm8974"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev python2 xz dtbtool"
options="!strip !check !tracedeps"
install=
source="
$pkgname-$_version.tar.gz::https://github.com/LineageOS/android_kernel_oneplus_msm8974/archive/${_version}.tar.gz
${_config}
compiler-gcc6.h
gpu-msm-fix-gcc5-compile.patch
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/android_kernel_oneplus_msm8974-${_version}"
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
echo "--[ silentoldconfig ]--"
yes "" | make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
oldconfig
}
# this is so we can do `abuild menuconfig` to reconfigure kernel
menuconfig() {
cd "$srcdir"/build || return 1
echo "--[ menuconfig ]--"
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" CONFIG_NO_ERROR_ON_MISMATCH=y \
|| return 1
echo "--[ Build modules ]--"
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \
modules || return 1
dtbTool -s 2048 -p "scripts/dtc/" -o "arch/arm/boot/dt.img" "arch/arm/boot/"
}
package() {
install -Dm644 "$srcdir"/build/arch/arm/boot/dt.img \
"$pkgdir"/boot/dt.img
install -Dm644 "$srcdir"/build/arch/arm/boot/zImage-dtb \
"$pkgdir"/boot/vmlinuz-$_flavor
install -D "$srcdir"/build/include/config/kernel.release \
"$pkgdir"/usr/share/kernel/$_flavor/kernel.release
cd "$srcdir"/build
unset LDFLAGS
echo "--[ Installing modules ]--"
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \
INSTALL_MOD_PATH="$pkgdir" modules_install \
|| return 1
}
sha512sums="3f2a599435799e8722ff20295dc438c1c8a303142ec73daf4f549dea1ed202271cf64d9bff9f781aaa0bebf6662a7e4061c2e9653d45c7936d2337c46a0f0789 linux-oneplus-bacon-lineage-15.0.tar.gz
2939fdd0d54b56d9198b5b2527c2a3c647c74f658221c60b457bb68b5f5b1c3949876ae511ef5278766cf268d69fad8b25ca30d3fb807a8221b8d11769dfcf4a config-oneplus-bacon.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 gpu-msm-fix-gcc5-compile.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

View file

@ -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 <Cl3Kener@gmail.com>
--- 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;