Add device HTC Desire (Bravo) support (#202)

* Add HTC Desire (Bravo) device-specific and kernel package

* Enable kernel virtual terminal support

* Add framebuffer and usb configuration in initfs-hook script

* Add udev required kernel options and set correct framebuffer resolution

* Add touchscreen device rules and enabled kernel logs (dmesg)

* Add deviceinfo_flash_offset_base in deviceinfo and update other offsets
This commit is contained in:
drebrez 2017-07-20 19:52:09 +02:00 committed by Oliver Smith
parent d1da069c02
commit e241cca904
7 changed files with 2818 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# Touchscreen (use 'weston-calibrator' to calibrate)
SUBSYSTEM=="input", ATTRS{name}=="synaptics-rmi-touchscreen", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1", \
ENV{WL_CALIBRATION}="1.035377 0.014809 -24.804611 0.057590 0.954340 1.480835"

View File

@ -0,0 +1,34 @@
pkgname=device-htc-bravo
pkgver=1
pkgrel=1
pkgdesc="HTC Desire"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-htc-bravo mkbootimg"
makedepends=""
install=""
subpackages=""
source="
deviceinfo
initfs-hook.sh
90-android-touch-dev.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-touch-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
}
sha512sums="50e66e8aaefb4b88662fa734c9d8e954086e158a7f46a2c7184902260f288a6d37687131069dc8ba1783455ff4dae68b938a070b3740355215a1bf09232a97e7 deviceinfo
3ce2d134aa59677e25a160b5985c552fbf048b237169bbeb85e2b8824f734627064b51c097036db10eee0254064d45d804d17372dffcd1ba246938968fe1e225 initfs-hook.sh
24c8e20cca7d9cff33fe6bac641d0dd4a15d011dd0dbbf1cb1309b11574e6ae7945f4e719646def1a5ba6e8f9607605fcea4a572aa71deb6aaff8498b722cb9d 90-android-touch-dev.rules"

View File

@ -0,0 +1,26 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="HTC Desire"
deviceinfo_manufacturer="HTC"
deviceinfo_date=""
deviceinfo_keyboard="false"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="false"
deviceinfo_external_disk_install="true"
deviceinfo_flash_methods="fastboot"
deviceinfo_arch="armhf"
# Fastboot related
deviceinfo_generate_bootimg="true"
deviceinfo_flash_offset_base="0x20000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_cmdline=""
deviceinfo_flash_pagesize="2048"

View File

@ -0,0 +1,8 @@
#!/bin/sh
# set framebuffer resolution
echo 16 > /sys/class/graphics/fb0/bits_per_pixel
echo 480,1600 > /sys/class/graphics/fb0/virtual_size
# set usb properties
echo 4 > /sys/devices/platform/android_usb/usb_function_switch

View File

@ -0,0 +1,109 @@
# APKBUILD based on linux-vanilla aport. Changes:
# - disabled module installation
# - add !check !tracedeps
# - add xz package (necessary to build)
#
# Kernel config based on: arch/arm/configs/bravo_defconfig
# Changes:
# - apply patches to compile with gcc6
# - enable devtmpfs (needed for udev -> touch support in weston)
# - enable udev required options (https://wiki.gentoo.org/wiki/Udev#Kernel)
_vendor=htc
_flavor=htc-bravo
_config="config-${_flavor}.armhf"
_hash="4bc19919f805777947c243e6c2ed41ece530488b"
pkgname=linux-${_flavor}
pkgver=3.0.16
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=1
arch="armhf"
pkgdesc="HTC Desire kernel from spezi77"
url="https://github.com/spezi77/android_kernel_htc_qsd8k_3.0"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev xz"
options="!strip !check !tracedeps"
install=
source="
$pkgname-$_hash.zip::https://github.com/spezi77/android_kernel_htc_qsd8k_3.0/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_htc_qsd8k_3.0-${_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/" || return 1
mkdir -p "$srcdir"/build
cp "$srcdir"/$_config "$srcdir"/build/.config || return 1
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
echo "--[ Build kernel + modules ]--"
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
|| return 1
}
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"
}
sha512sums="f66f850a4abafc1290c09403e27cee530f37e54474532f9cf13c031df30490003c762df9075b2dd29a3b02fe46913be23b4286b0ed16fc320fe9786f0799fb32 linux-htc-bravo-4bc19919f805777947c243e6c2ed41ece530488b.zip
27ec53afdd9898495ae296b8e98b05401aae3a0bf390ba276f6a878d6bf1ccf3f59da78a5ee50ba4ee0744e4768f71aab53b782511c4f8ad22fefc821a2c815c config-htc-bravo.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