device-samsung-herolte: new device (Samsung Galaxy S7) (!314)

This is basically just the packages for the Galaxy S7 Edge (hero2lte).
I only needed to change a few Kernel config options, so that the
colors are displayed correctly. The options regarding
CONFIG_PANEL_S6E3HF4_WQHD and CONFIG_PANEL_S6E3HA3_DYNAMIC probably
solve this issue, but I modified the other options as well. I got the
differences by diffing:
arch/arm64/configs/exynos8890-{hero2lte,herolte}_defconfig

Booting, USB networking and the display work! I can't say anything about
flashing via heimdall as this tool scares me. Following what WilliamO7
wrote on the device page, I flashed it by sideloading the android
recovery zip.

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Alexander Polynomdivision 2019-04-12 18:35:50 +02:00 committed by Oliver Smith
parent 77706b3b73
commit eadb61205e
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
7 changed files with 5211 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-samsung-herolte"
pkgdesc="Samsung Galaxy S7"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-samsung-herolte mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
source="deviceinfo initfs-hook.sh"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/initfs-hook.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
}
sha512sums="c273794d0f9b16f14020d8165ec8413ee243511743e9c48c3245cc7390419889c8e8b6ffef2e066b5b1f97fb473848da22990ba067293e8b22caaad537b9067a deviceinfo
5a7be3cb8835ffb3783fcd4539de04f7f006c726ac9aea35cdca9e90b2877dc36cf4e314851bf9078f4b2dac061b7265866792d92a79f5232c56a0e17f7910b1 initfs-hook.sh"

View file

@ -0,0 +1,36 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Samsung Galaxy S7"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-herolte"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1440"
deviceinfo_screen_height="2560"
deviceinfo_dev_touchscreen=""
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline="buildvariant=userdebug"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_flash_offset_base="0x10000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_heimdall_partition_kernel="BOOT"
deviceinfo_flash_heimdall_partition_system="SYSTEM"
deviceinfo_flash_sparse="true"

View file

@ -0,0 +1,8 @@
# Set 16bpp fb mode and ensure size is set
echo 16 > /sys/class/graphics/fb0/bits_per_pixel
echo 1440,2560 > /sys/class/graphics/fb0/virtual_size
# Blank and unblank
echo 1 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb0/blank

View file

@ -0,0 +1,24 @@
# This patch removes the __ANDROID__ defines that activate the macros needed for
# the connection gadget system in the kernel.
# Needed for very obvious reasons.
diff --git a/drivers/usb/gadget/function/f_conn_gadget.ioctl.h b/drivers/usb/gadget/function/f_conn_gadget.ioctl.h
index aed3e027..3486e7a3 100644
--- a/drivers/usb/gadget/function/f_conn_gadget.ioctl.h
+++ b/drivers/usb/gadget/function/f_conn_gadget.ioctl.h
@@ -25,8 +25,6 @@ enum {
CONN_GADGET_IOCTL_BIND_STATUS_UNBIND = 2
};
-#if defined(__ANDROID__)||defined(__TIZEN__)
-
enum {
CONN_GADGET_IOCTL_NR_0 = 0,
CONN_GADGET_IOCTL_NR_1,
@@ -42,6 +40,5 @@ enum {
#define CONN_GADGET_IOCTL_BIND_WAIT_NOTIFY _IOR(CONN_GADGET_IOCTL_MAGIC_SIG, CONN_GADGET_IOCTL_NR_1, int)
#define CONN_GADGET_IOCTL_BIND_GET_STATUS _IOR(CONN_GADGET_IOCTL_MAGIC_SIG, CONN_GADGET_IOCTL_NR_2, int)
#define CONN_GADGET_IOCTL_MAX_NR CONN_GADGET_IOCTL_NR_MAX
-#endif
#endif

View file

@ -0,0 +1,31 @@
Exynos devices have a special device tree image format, which the built in
script in this kernel source facilitates.
Unfortunately, the script is badly written in the part where command line
arguments are parsed, so this fixes it to create a valid dtb.
diff --git a/scripts/dtbtool_exynos/dtbtool.c b/scripts/dtbtool_exynos/dtbtool.c
index f72fe8662ee..cacd8c69a32 100644
--- a/scripts/dtbtool_exynos/dtbtool.c
+++ b/scripts/dtbtool_exynos/dtbtool.c
@@ -378,13 +378,14 @@ int main(int argc, char **argv)
dt_subtype_code = strtoul(val, 0, 16);
} else if (*arg != '-') {
/* skip over already allocated file names */
- for (; dtb_files[dt_count]; dt_count++)
- if (dt_count >= DTB_MAX)
- fail("reached dtb file limit (%d)", DTB_MAX);
-
- dtb_files[dt_count] = strdup(arg);
- if (!dtb_files[dt_count])
- fail("failed to allocate memory");
+ for (; dtb_files[dt_count]; dt_count++) {
+ if (dt_count >= DTB_MAX) {
+ fail("reached dtb file limit (%d)", DTB_MAX);
+ } else {
+ dtb_files[dt_count] = strdup(arg);
+ if (!dtb_files[dt_count]) fail("failed to allocate memory");
+ }
+ }
} else
usage();
}

View file

@ -0,0 +1,71 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/exynos8890-hero2lte_defconfig
pkgname="linux-samsung-herolte"
pkgver=3.18.133
pkgrel=0
pkgdesc="Samsung Galaxy S7 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-herolte"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev dtbtool"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source - use Ivan Meler's 3.18 upstream kernel
_repository="android_kernel_samsung_herolte"
_commit="24b577569468748591f7be6435af67e17b532886"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/ivanmeler/${_repository}/archive/${_commit}.tar.gz
$_config
01-remove-android-defines.patch
02-fix-dtbtool.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC"
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
# Note: the DTB for this kernel is built in tree, we just need to copy it.
}
package() {
# kernel.release
install -D "$builddir/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi
# Copy the in-tree DTBH block image
install -Dm644 "$builddir/arch/arm64/boot/dtb.img" \
"$pkgdir/boot/dt.img"
}
sha512sums="59c128754698259ad7f759def8a82b3f0756404bfe8b474df375c6af0a45b9875ba9a00acca5605b8dcebff4fa5ca1cd20d84d3f398999fe38c3f5837690848c linux-samsung-herolte-24b577569468748591f7be6435af67e17b532886.tar.gz
ee0057fa8996ca62fbb93f76e9220ee6a17aa28abe1280eb215a483a5b31dfec8b69d49eb1f012952d96ec5cd2cb3ce6475ad98f91ea019f66f4e465906b8ea2 config-samsung-herolte.aarch64
66e27a174e12d56f5b77932985f0001b551c834d68b2a1bcc1d0b7d04e555757fc9137c182bd4cf5ffd57bf2cb0918d758dfe153a6140b77f02e7b9f33ecfb2c 01-remove-android-defines.patch
59b7151edece9fec879c12fe53fa4a7d34563c9b7ed45fa5e96036bde7616cac0976adeef54a5f36d883d51747831881b2586ac02ac47db4123c399cf98e93d8 02-fix-dtbtool.patch"

File diff suppressed because it is too large Load diff