Device samsung i9070 (#123)

* Add Samsung Galaxy S Advance (i9070) device-specific package

* Add Samsung Galaxy S Advance (i9070) kernel package

* Add initfs-hook script to set framebuffer settings

* Enable adb root access in recovery mode (TWRP)

* Add usb configuration in initfs-hook script
Add weston calibration values
Update description of kernel changes

* Remove TMRP recovery and change init script to boot directly postmarketOS
This commit is contained in:
drebrez 2017-06-29 22:04:16 +02:00 committed by Oliver Smith
parent 6485278d95
commit 6e1e4c5cfc
9 changed files with 3271 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# udev rules file
# All device names can be read from weston's logfile (/tmp/weston.log in postmarketOS)
# Touchscreen (use 'weston-calibrator' to calibrate)
SUBSYSTEM=="input", ATTRS{name}=="sec_touchscreen", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1" \
ENV{WL_CALIBRATION}="1.043478 0.000000 -5.217407 0.014562 0.956938 2.798035"

View file

@ -0,0 +1,30 @@
pkgname=device-samsung-i9070
pkgver=1
pkgrel=3
pkgdesc="Samsung Galaxy S Advance"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-samsung-i9070"
makedepends=""
install=""
subpackages=""
source="deviceinfo initfs-hook.sh 90-android.rules"
options="!check"
build() {
return 0
}
package() {
install -D -m644 "$srcdir/deviceinfo" \
"$pkgdir/etc/deviceinfo"
install -D -m644 "$srcdir"/initfs-hook.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
install -D -m644 "$srcdir"/90-android.rules \
"$pkgdir"/etc/udev/rules.d/90-android.rules
}
sha512sums="8fc6b74f248e19b93278510892fd0eb594d8a86a23dcdef9cee1d8cafbe24a4d9567c69c0169268e924a48699f79459970d493876d542396d5de0ffc32d4d88f deviceinfo
098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh
ffa8ba47539f0b4a931c560811d7842c7f5270631066c270322859c1ef77e63fba09a8462c2533bd6d095056b2c7936c2d4fc4e225f3cff45169f121bf93d8ed 90-android.rules"

View file

@ -0,0 +1,18 @@
# This document format is a draft.
# You can source it in shell scripts.
# Use only double quotes.
deviceinfo_format_version="0"
deviceinfo_name="Galaxy S Advance"
deviceinfo_manufacturer="Samsung"
deviceinfo_date=""
deviceinfo_keyboard="false"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="true"
deviceinfo_external_disk_install="true"
deviceinfo_flash_methods="heimdall"
deviceinfo_arch="armhf"

View file

@ -0,0 +1,15 @@
#!/bin/sh
# set framebuffer resolution
echo 16 > /sys/class/graphics/fb0/bits_per_pixel
echo 960,1600 > /sys/class/graphics/fb0/virtual_size
# set usb properties
echo 0 > /sys/class/android_usb/android0/enable
echo samsung > /sys/class/android_usb/android0/iManufacturer
echo i9070 > /sys/class/android_usb/android0/iProduct
echo 1 > /sys/class/android_usb/android0/enable
# start the usb enumeration process from userspace
echo 1 > /sys/devices/platform/ab8500-i2c.0/ab8500-usb.0/boot_time_device

View file

@ -0,0 +1,138 @@
# Based on linux-lg-mako. Changes:
# - add findutils makedepend (necessary for the initramfs)
# - it builds an initramfs - do not use ramdisk.cpio and
# ramdisk-recovery.cpio, in there, always use the
# initramfs from the kernel2 partition ("isorec")
# - directly boot to that initramfs, not only when the recovery
# key combination was pressed.
# - use Alpine's busybox-static instead of the pre-compiled
# binary, that comes with the source
# - reduce lzo compression because Alpine's busybox doesn't
# support high compression
#
# Kernel config changes, based on: arch/arm/configs/janice_defconfig
# - enable devtmpfs (needed for udev -> touch support in weston)
# This must be built in the target chroot, so busybox.static can
# be used.
_pmb_build_in_native_chroot="false"
_vendor=samsung
_flavor=samsung-i9070
_hash="ac7219c4b8dcec7bc5a598d42c6be0db4aa36332"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=3.0.101
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=1
arch="armhf"
pkgdesc="Samsung Galaxy S Advance kernel from Epirex"
url="https://github.com/Epirex/Samsung_STE_Kernel"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev
findutils busybox-static"
options="!strip !check !tracedeps"
install=
source="
$pkgname-$_hash.zip::https://github.com/Epirex/Samsung_STE_Kernel/archive/${_hash}.zip
$_config
compiler-gcc6.h
fix_return_address.patch
init
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/Samsung_STE_Kernel-${_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
# Use Alpine's busybox.static instead of the pre-compiled busybox shipped
# with the source
cp -v /bin/busybox.static "$ksrcdir"/usr/u8500_initramfs_files/busybox
# do not use ramdisk.cpio and ramdisk-recovery.cpio, always use
# the initramfs from the kernel2 partition ("isorec"), so we can build
# it later and independently from the kernel. also directly boot that
# partition, not only when the recovery key combination was used.
cd "$ksrcdir"/usr/
mv u8500_initramfs.list u8500_initramfs.list_old
grep -v "../../ramdisk" u8500_initramfs.list_old > u8500_initramfs.list \
|| return 1
cp -v "$srcdir"/init "$ksrcdir"/usr/u8500_initramfs_files/init || return 1
# Reduce lzo compression because Alpine's busybox doesn't support high
# compression
sed -i -e 's/lzop -9/lzop -6/g' "$ksrcdir"/scripts/Makefile.lib || return 1
sed -i -e 's/lzop -9/lzop -6/g' "$ksrcdir"/scripts/gen_initramfs_list.sh || return 1
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/" || return 1
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="ea4e0f56efadd12c3dab18f15214973c708f777097aecac2fb7be4118472ba6e61e2660579eec7a2b57398c3a78107c965b59a108ddf1178d481a4e353a68077 linux-samsung-i9070-ac7219c4b8dcec7bc5a598d42c6be0db4aa36332.zip
8789a6b50cb4f438aa581003a54419d70e36f7077bb0107aeaaa237bb2d603d9fc67a25e47460068547c1dcc296c64752b3b448629bd4b64645e619d314ab9bf config-samsung-i9070.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
ea1d3b5a234fa565e3c1a792de48f4fc4e6023d281d303c8e319c7ef28edc5739ab0e4dea0139a41f0a5c7d03e27921ccaa214fd0ac5c72245a094ce60128864 fix_return_address.patch
ef01c51c138239a49c1d00ae0074a07fed267d64934cf3d436a8ff057b91692ee2d040a45eacbb0dc62d5017a708c4dca2fadc282c850fa72aeebcfa787e2cbc init"

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,49 @@
From aeea3592a13bf12861943e44fc48f1f270941f8d Mon Sep 17 00:00:00 2001
From: Behan Webster <behanw@converseincode.com>
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 <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
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);

29
linux-samsung-i9070/init Normal file
View file

@ -0,0 +1,29 @@
#!/stage1/busybox sh
# Samsung kernels come with their own initramfs, which extract and load another
# initramfs. Usually that depends on the recovery key combination being pressed
# or not. For simplicity, we always boot the recovery image (from the kernel2
# partition) here.
_PATH="$PATH"
export PATH=/stage1
busybox cd /
busybox date >>boot.txt
exec >>boot.txt 2>&1
busybox rm init
busybox mount -t proc proc /proc
busybox mount -t sysfs sysfs /sys
# always use the "isorec"-style lzop compressed initramfs
# from the kernel2 partition
load_image=/stage1/isorec.cpio
busybox lzop -dc /dev/block/mmcblk0p17 > ${load_image}
busybox cpio -i < ${load_image}
busybox umount /sys
busybox umount /proc
busybox date >>boot.txt
busybox rm -fr /stage1 /dev/*
export PATH="${_PATH}"
exec /init