Skip to content
Snippets Groups Projects
Commit 8ebafdf9 authored by William O-D's avatar William O-D Committed by Oliver Smith
Browse files

New device: samsung-hero2lte (Samsung Galaxy S7 Edge) (!179)

Display is working in both X and wayland (tested with weston and XFCE).
Not tried with osk-sdl yet, charging-sdl seems to work fine.
USB networking and SSH is working too.

Camera subsystem disabled to prevent bootloops. This device brings its
own dtb.img format, but there's a generator in the kernel source that
is used at build time (patched to make it work properly).

[skip ci]: already built in CI successfully
parent 8c2a95db
No related branches found
No related tags found
No related merge requests found
Pipeline #196160 skipped
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-samsung-hero2lte"
pkgdesc="Samsung Galaxy S7 edge"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-samsung-hero2lte 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="f780adfb37cbaa3930cb4eb4eef2b439c0b83d9a941a898f0396cb4120db4f5d5677903df8930bd3d234c7b6d5c3787f74f6133e2ccb4b04d5fa9d530aa34478 deviceinfo
5a7be3cb8835ffb3783fcd4539de04f7f006c726ac9aea35cdca9e90b2877dc36cf4e314851bf9078f4b2dac061b7265866792d92a79f5232c56a0e17f7910b1 initfs-hook.sh"
# 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 edge"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-hero2lte"
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"
# 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
# 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
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();
}
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/exynos8890-hero2lte_defconfig
pkgname="linux-samsung-hero2lte"
pkgver=3.18.133
pkgrel=0
pkgdesc="Samsung Galaxy S7 edge kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-hero2lte"
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-hero2lte-24b577569468748591f7be6435af67e17b532886.tar.gz
5d70395fec802bc2f925ec2b5f2f138ae988aa61720c82b986310a23ed401949bdca263401918a4f769a477aa98ca4ec2aab1b3dbe0eabfbb856af9f2d99e129 config-samsung-hero2lte.aarch64
66e27a174e12d56f5b77932985f0001b551c834d68b2a1bcc1d0b7d04e555757fc9137c182bd4cf5ffd57bf2cb0918d758dfe153a6140b77f02e7b9f33ecfb2c 01-remove-android-defines.patch
59b7151edece9fec879c12fe53fa4a7d34563c9b7ed45fa5e96036bde7616cac0976adeef54a5f36d883d51747831881b2586ac02ac47db4123c399cf98e93d8 02-fix-dtbtool.patch"
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment