Porting to Moto G 2014 "titan"

- Use samsung-i9100 as template
This commit is contained in:
Pablo Castellano 2017-06-04 13:37:14 +02:00
parent 28a0e10e56
commit bbf3913428
10 changed files with 3543 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}="0.954174 0.016888 -2.626083 -0.006031 1.011271 14.175903"

View File

@ -0,0 +1,3 @@
- make sure, the device is powered off
- hold power + volume down
- let go of the power button, as soon as something appears

View File

@ -0,0 +1,3 @@
- make sure, the device is really powered off
- hold volume up + home + power button
- when the samsung logo appears, only hold volume up + home

View File

@ -0,0 +1,27 @@
pkgname=device-samsung-i9100
pkgver=1
pkgrel=2
pkgdesc="Samsung Galaxy SII"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-samsung-i9100"
makedepends=""
install=""
subpackages=""
source="deviceinfo 90-android.rules"
options="!check"
build() {
return 0
}
package() {
install -D -m644 "$srcdir/deviceinfo" \
"$pkgdir/etc/deviceinfo"
install -D -m644 "$srcdir"/90-android.rules \
"$pkgdir"/etc/udev/rules.d/90-android.rules
}
sha512sums="f2dfe6b848ab751eea2d3aad82c214985b7910865a2911a7be843e44c5479299cb66c768925b4452e8dbdd84efd6bd8b69eb2e2dc49cfa27fc8a3e189ddf68a5 deviceinfo
8aead706ddb118a44de7d049f07d10a27e727d17724058d132e4ec4fa73fed29c9ccfe03f02aca459c922ec0fbba24e171fe3c76e33f7c5462631e3dd5506e36 90-android.rules"

View File

@ -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="Galaxy SII"
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"
# You can for example extract these from an existing boot.img
deviceinfo_flash_offset_base=""
deviceinfo_flash_offset_kernel=""
deviceinfo_flash_offset_ramdisk=""
deviceinfo_flash_offset_second=""
deviceinfo_flash_offset_tags=""
deviceinfo_flash_pagesize=""

View File

@ -0,0 +1,4 @@
#!/bin/sh
# set framebuffer resolution
cat /sys/class/graphics/fb0/modes > /sys/class/graphics/fb0/mode

View File

@ -0,0 +1,131 @@
# 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-device.cpio, in there, always use the
# initramfs from the recovery 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
#
# Kernel config changes, based on: arch/arm/configs/i9100_defconfig
# - enable devtmpfs (needed for udev -> touch support in weston)
# - change compression from CONFIG_KERNEL_LZMA=y to
# CONFIG_KERNEL_GZIP=y (so it works with busybox)
# This must be built in the target chroot, so busybox.static can
# be used.
_pmb_build_in_native_chroot="false"
_vendor=samsung
_flavor=samsung-i9100
_hash="349a3e91e76d17e67ef6213e1f6712e700695631"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=3.0.101
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=5
arch="armhf"
pkgdesc="Samsung Galaxy SII 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
findutils busybox-static"
options="!strip !check !tracedeps"
install=
source="
$pkgname-$_hash.zip::https://github.com/LineageOS/android_kernel_samsung_smdk4412/archive/${_hash}.zip
$_config
compiler-gcc6.h
init
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/android_kernel_samsung_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
# Use Alpine's busybox.static instead of the pre-compiled busybox shipped
# with the source
cp -v /bin/busybox.static "$ksrcdir"/usr/galaxys2_initramfs_files/busybox
# do not use ramdisk.cpio and ramdisk-recovery-device.cpio, always use
# the initramfs from the recovery 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 galaxys2_initramfs.list galaxys2_initramfs.list_old
grep -v "../../ramdisk" galaxys2_initramfs.list_old > galaxys2_initramfs.list \
|| return 1
cp -v "$srcdir"/init "$ksrcdir"/usr/galaxys2_initramfs_files/init || 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="28198b1312d66a1af28e112f3252aa9fbbbee8bf373776c556cdbc1c75517072a1eec6522717df0b2bc4f6b5f06b9ce07d2cb29a2de07fc56c4ea072f4d46c82 linux-samsung-i9100-349a3e91e76d17e67ef6213e1f6712e700695631.zip
7ce82e81ca8d472f01f8097e3a434fe0130d66b16b29ed3d4c5ce94870fb4efe3b5e79523802b078fcdc737e5a1ee6351bc8427d1271a098eab8e9f35b95e6b1 config-samsung-i9100.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
dd4094d5f4ec281d32f12af88cb22a782e497c8e52f69cf60b73ac7d6171fc95f1f8040b3d0ad2ff3f016d22ac1d91c5b522e5d03203534a76742bc55a082af5 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,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 recovery
# 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 recovery partition
load_image=/stage1/isorec.cpio
busybox lzop -dc /dev/block/mmcblk0p6 > ${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