Porting to samsung-i9305 (Galaxy SIII LTE) (#690)

This commit is contained in:
joris 2017-10-04 19:20:17 +02:00 committed by Oliver Smith
parent a68b9e0e40
commit 0d4c353fc3
8 changed files with 3708 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# 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" \

View file

@ -0,0 +1,28 @@
pkgname=device-samsung-i9305
pkgver=1
pkgrel=12
pkgdesc="Samsung Galaxy SIII LTE"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-samsung-i9305 firmware-samsung-i9305 mkbootimg"
makedepends=""
install="$pkgname.post-install"
subpackages=""
source="
deviceinfo
90-android-touch-dev.rules
$install
"
options="!check"
package() {
install -D -m644 "$srcdir/deviceinfo" \
"$pkgdir/etc/deviceinfo"
install -D -m644 "$srcdir"/90-android-touch-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
}
sha512sums="79d2ac3c0e6942074123d6b4a3a8fa1f11e816a9bfab4ddd43fb0fee639c11601e75e190c44834d876afb6ab89e0fa6dd9a0e9aaa0fdc0d991cea463f1cce8e6 deviceinfo
dd1e84052f503e81cdd8c7b26429900319fb358a6ac2d9f6919382a3b230897e49c0557157518fc323e79a2f75c510a98b8949c0ffb2c15e104fe8ed20c6e3ed 90-android-touch-dev.rules
03da52725e676bc7db371cbf4b60bff8689eca469dae96a02ca7d6c194ed9f8c4ec9d19d1ac9212eeba0b73384fd213e86f2b93da94f37e5abe4cc3339281205 device-samsung-i9305.post-install"

View file

@ -0,0 +1,7 @@
#!/bin/sh
# Create mount point and /efs mount point in fstab
if [ -z "$(grep /efs /etc/fstab)" ]; then
mkdir -p /efs
echo "/dev/mmcblk0p1 /efs auto ro 0 0" >> /etc/fstab
fi

View file

@ -0,0 +1,38 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Galaxy SIII LTE"
deviceinfo_manufacturer="Samsung"
deviceinfo_date=""
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="true"
deviceinfo_external_disk_install="true"
deviceinfo_flash_methods="heimdall-bootimg"
deviceinfo_generate_bootimg="true"
deviceinfo_arch="armhf"
# Device related
deviceinfo_keyboard="false"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1280"
deviceinfo_dev_touchscreen="/dev/input/event2"
# Offsets for the boot.img
deviceinfo_kernel_cmdline="console=ttySAC2,115200 buildvariant=userdebug"
deviceinfo_flash_offset_kernel=0x00008000
deviceinfo_flash_offset_ramdisk=0x1000000
deviceinfo_flash_offset_second=0x00f00000
deviceinfo_flash_offset_tags=0x00000100
deviceinfo_flash_pagesize=2048
# Heimdall related
deviceinfo_flash_heimdall_partition_kernel="BOOT"
#deviceinfo_flash_heimdall_partition_initfs="RECOVERY"
#deviceinfo_flash_heimdall_partition_system="SYSTEM"
deviceinfo_weston_core_modules="xwayland.so"

View file

@ -0,0 +1,123 @@
# 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_i9305_defconfig
# Changes:
# - enable devtmpfs (needed for udev -> touch support in weston)
# - adding xz to makedepends because of lzma: unrecognized option: 9 (https://yuvadm.github.io/pmosweb/wiki/Troubleshooting:kernel/)
# - add kernel modules installation
_vendor=samsung
_flavor=samsung-i9305
_hash="fa8fa332fdec11744ffe0c742775cc22efe0d041"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=3.0.101
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=2
arch="armhf"
pkgdesc="Samsung Galaxy SIII LTE kernel from LineageOS"
url="https://github.com/LineageOS/android_kernel_samsung_smdk4412"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev xz busybox-static-armhf"
options="!strip !check !tracedeps"
install=
source="
$pkgname-$_hash.tar.gz::https://github.com/LineageOS/android_kernel_${_vendor}_smdk4412/archive/${_hash}.tar.gz
$_config
compiler-gcc6.h
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/android_kernel_${_vendor}_smdk4412-${_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
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
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
cd "$srcdir"/build
unset LDFLAGS
echo "-- [ Build kernel ] --"
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine"
echo "-- [ Build modules ] --"
# the 'no-pic' flag is necessary to avoid the
# error 'Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)' when loading the module
make ARCH="$_carch" CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" CONFIG_NO_ERROR_ON_MISMATCH=y \
modules
}
package() {
echo "--[ Installing kernel ]--"
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"
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
}
sha512sums="d87dd54152980b30012fead62e639dde6ff0862d376790eac32800aeffd91482a220c7b1f233933a1879796dcaa3722e86c42a5f0e4df4168ae1f65362952779 linux-samsung-i9305-fa8fa332fdec11744ffe0c742775cc22efe0d041.tar.gz
76757c38a655e1b1ef0228d39d23ccbdf9402769b302cd2e8a076bc7eb0ee0cd83c7599b16fabbe69812315dc1ad518c8313095e040deb4412c4b85cb95a3c90 config-samsung-i9305.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h"

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,28 @@
pkgname=firmware-samsung-i9305
pkgver=1
pkgrel=0
pkgdesc="Samsung Galaxy SIII LTE Firmware"
url="https://github.com/Androguide/android_vendor_samsung"
arch="noarch"
license="proprietary"
depends=""
makedepends=""
install=""
subpackages=""
_hash="d5a8735a6ad1fff3091f100383ac004f411d7528"
source=$pkgname-$_hash.tar.gz::$url"/archive/${_hash}.tar.gz"
options="!check !strip"
vsrcdir="$srcdir/android_vendor_samsung-${_hash}"
package() {
mkdir -p "$pkgdir/lib/firmware/postmarketos"
# install wifi firmware
install -Dm644 "$vsrcdir/smdk4412-common/proprietary/system/etc/wifi/bcmdhd_sta.bin_b2" \
"$pkgdir/lib/firmware/postmarketos/bcmdhd_sta.bin_b2"
install -Dm644 "$vsrcdir/smdk4412-common/proprietary/system/etc/wifi/nvram_net.txt" \
"$pkgdir/lib/firmware/postmarketos/nvram_net.txt"
}
sha512sums="6559320d23e6a73accacf8c760426cb5a0679ab34e353d24dde653b336eadf98c2aa28c783e7010bf9f32cc64baadc02a9fff09baac6ff8b535ed5bc94c8abc5 firmware-samsung-i9305-d5a8735a6ad1fff3091f100383ac004f411d7528.tar.gz"