samsung-starlte: New device (MR 4123)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Ishaaq 2023-05-26 22:15:15 +01:00 committed by Oliver Smith
parent 0ccd191d21
commit 5e0a9edcae
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
14 changed files with 6268 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# BT unblocked
SUBSYSTEM=="rfkill", ATTR{name}=="bcm43xx Bluetooth", ACTION=="change", ENV{RFKILL_STATE}=="1", RUN+="/etc/init.d/hciattach start"
# BT blocked
SUBSYSTEM=="rfkill", ATTR{name}=="bcm43xx Bluetooth", ACTION=="change", ENV{RFKILL_STATE}=="0", RUN+="/etc/init.d/hciattach stop"

View file

@ -0,0 +1,5 @@
# let LightDM start Xorg even though we don't have graphics driver
# https://github.com/canonical/lightdm/commit/77a7c6b7b8ca896b98ef43826641bdd520650bfb
[LightDM]
logind-check-graphical=false

View file

@ -0,0 +1,61 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-samsung-starlte
pkgdesc="Samsung Galaxy S9"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-samsung-starlte
mkbootimg
postmarketos-base
msm-fb-refresher
"
makedepends="devicepkg-dev"
source="
deviceinfo
initfs-hook.sh
hciattach
10-hciattach.rules
10-logind-check-graphical.conf
"
subpackages="
$pkgname-nonfree-firmware:nonfree_firmware
$pkgname-x11
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
nonfree_firmware() {
pkgdesc="WiFi and BT firmware"
depends="firmware-samsung-crownlte bluez-deprecated"
# hciattach service for Bluetooth
mkdir "$subpkgdir"
install -Dm755 "$srcdir"/hciattach \
-t "$subpkgdir"/etc/init.d
install -Dm644 "$srcdir"/10-hciattach.rules \
-t "$subpkgdir"/etc/udev/rules.d
}
x11() {
install_if="$pkgname=$pkgver-r$pkgrel xorg-server"
depends="xf86-input-evdev"
install -Dm644 "$srcdir"/10-logind-check-graphical.conf \
-t "$subpkgdir"/usr/share/lightdm/lightdm.conf.d
}
sha512sums="
6607d9160a6ec5a444d12efdbd60e2e351808065d381c0b13a47e7f881b04807139a3646567462fcde55aa66708b1b6186716dda284808919217280939d337d7 deviceinfo
cec13a1cb076a249eb94d11fb122b1f6b0c3e9558a2ed3c8da3e73a8e2db633131ec8ce838e62da8f53b5500dcb77c6f4adf3c1d2f1cda6fd23cb2ca1ccf6abc initfs-hook.sh
70c4d3b7af9e58729b5caca87c6c0032675c4adfd3852b0e3fc1f866675d503c4f08d3edaf1b1949bf15344840222c1a7ba00384c290fa5e1b7742e1198855a8 hciattach
58f72bb12532ce23782389bf9e9eb8eb8afe004dd46d11d48b21b6da6a84660846f79d528d9968a1c1be57716577035fd0da59b3fcda4f197599e92f243dbb45 10-hciattach.rules
00addbea452dd3e2cb90e18793becc47d22118e6b99a79b76eb57db02aa8b00b133569beaea81cce4b39c9e556280c1d6ac8ab687016354e2d189734e38768cf 10-logind-check-graphical.conf
"

View file

@ -0,0 +1,35 @@
# 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 S9"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-starlte"
deviceinfo_year="2018"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1440"
deviceinfo_screen_height="2960"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_offset_base="0x10000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0xf0000000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_heimdall_partition_kernel="BOOT"
deviceinfo_flash_heimdall_partition_system="SYSTEM"
deviceinfo_rootfs_image_sector_size="4096"
deviceinfo_flash_sparse="true"

View file

@ -0,0 +1,4 @@
#!/sbin/openrc-run
command="/usr/bin/hciattach"
command_args="/dev/ttySAC1 bcm43xx 3000000"

View file

@ -0,0 +1,5 @@
#!/bin/sh
# blank and unblank for pmOS splash screen
echo 1 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb0/blank

View file

@ -0,0 +1,21 @@
Adapted from ../linux-samsung-dream/02-fix-decon_reg.patch.
Fixes:
../drivers/video/fbdev/exynos/dpu_9810/decon_reg.c: In function 'decon_reg_get_clock_ratio':
../drivers/video/fbdev/exynos/dpu_9810/decon_reg.c:2376:42: error: '-mgeneral-regs-only' is incompatible with the use of floating-point types
2376 | clks->decon[CLK_ID_VCLK] = decon_clocks_table[i][CLK_ID_VCLK];
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and a few similar errors within this file.
diff --git a/drivers/video/fbdev/exynos/dpu_9810/decon_reg.c b/drivers/video/fbdev/exynos/dpu_9810/decon_reg.c
index 4261b1648cf5..85a31b57b476 100644
--- a/drivers/video/fbdev/exynos/dpu_9810/decon_reg.c
+++ b/drivers/video/fbdev/exynos/dpu_9810/decon_reg.c
@@ -2326,7 +2326,7 @@ u32 decon_reg_get_height(u32 id, int dsi_mode)
return 0;
}
-const double decon_clocks_table[][CLK_ID_MAX] = {
+const unsigned decon_clocks_table[][CLK_ID_MAX] = {
/* VCLK, ECLK, ACLK, PCLK, DISP_PLL, resolution, MIC_ratio, DSC count */
{ 71, 168, 400, 66, 71, 1080 * 1920, MIC_COMP_BYPASS, 0},
{ 63, 168, 400, 66, 63, 1440 * 2560, MIC_COMP_RATIO_1_2, 0},

View file

@ -0,0 +1,21 @@
Adapted from ../linux-samsung-dream/05-BGR-to-RGB-colors.patch.
Fixes color order - from BGRA to RGBA.
diff --git a/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c b/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c
index 07a084d805af..4504591db73e 100644
--- a/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c
+++ b/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c
@@ -807,11 +807,11 @@ int decon_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
case 24:
/* our 24bpp is unpacked, so 32bpp */
var->bits_per_pixel = 32;
- var->red.offset = 16;
+ var->red.offset = 0;
var->red.length = 8;
var->green.offset = 8;
var->green.length = 8;
- var->blue.offset = 0;
+ var->blue.offset = 16;
var->blue.length = 8;
break;

View file

@ -0,0 +1,23 @@
From 4462b31a33dbd72840269bdccb4aa447f14c9a6c Mon Sep 17 00:00:00 2001
From: LONELY-WOLF <zvenayte@gmail.com>
Date: Thu, 4 Jul 2019 12:13:46 +0300
Subject: [PATCH] [decon] suppress unblank warning
---
drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c b/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c
index 07a084d805af..0b9ade4351a2 100644
--- a/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c
+++ b/drivers/video/fbdev/exynos/dpu_9810/decon_dsi.c
@@ -928,8 +928,7 @@ int decon_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
if ((!IS_DECON_HIBER_STATE(decon) && IS_DECON_OFF_STATE(decon)) ||
decon->state == DECON_STATE_INIT) {
- decon_warn("%s: decon%d state(%d), UNBLANK missed\n",
- __func__, decon->id, decon->state);
+// decon_warn("%s: decon%d state(%d), UNBLANK missed\n", __func__, decon->id, decon->state);
return 0;
}

View file

@ -0,0 +1,25 @@
Adapted from ../linux-samsung-dream/04-firmware-path.patch.
Changes hardcoded path for WiFi module's firmware to match pmOS package.
diff --git a/drivers/net/wireless/bcmdhd_100_15/dhd.h b/drivers/net/wireless/bcmdhd_100_15/dhd.h
index f8f13a869622..bac7f7d4aa7c 100644
--- a/drivers/net/wireless/bcmdhd_100_15/dhd.h
+++ b/drivers/net/wireless/bcmdhd_100_15/dhd.h
@@ -401,7 +401,7 @@ enum dhd_op_flags {
#if defined(CUSTOMER_HW4) && defined(PLATFORM_SLP)
#define CONFIG_BCMDHD_CLM_PATH "/lib/firmware/bcmdhd_clm.blob"
#else
-#define CONFIG_BCMDHD_CLM_PATH "/etc/wifi/bcmdhd_clm.blob"
+#define CONFIG_BCMDHD_CLM_PATH "/lib/firmware/postmarketos/bcmdhd_clm.blob"
#endif /* CUSTOMER_HW4 && PLATFORM_SLP */
#endif /* CONFIG_BCMDHD_CLM_PATH */
#define WL_CCODE_NULL_COUNTRY "#n"
@@ -2543,7 +2543,7 @@ extern uint dhd_pktgen_len;
extern char fw_path2[MOD_PARAM_PATHLEN];
#endif // endif
-#define VENDOR_PATH "/vendor"
+#define VENDOR_PATH ""
#if defined(DHD_LEGACY_FILE_PATH)
#define PLATFORM_PATH "/data/"

View file

@ -0,0 +1,21 @@
From 5e26ce9a50556e787a5d407a78720aecb5986b60 Mon Sep 17 00:00:00 2001
From: LONELY-WOLF <zvenayte@gmail.com>
Date: Thu, 4 Jul 2019 12:15:04 +0300
Subject: [PATCH] [decon] disable decon release()
---
drivers/video/fbdev/exynos/dpu_9810/decon_core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/exynos/dpu_9810/decon_core.c b/drivers/video/fbdev/exynos/dpu_9810/decon_core.c
index 41c55ab68c99..4cc004b37cf2 100644
--- a/drivers/video/fbdev/exynos/dpu_9810/decon_core.c
+++ b/drivers/video/fbdev/exynos/dpu_9810/decon_core.c
@@ -2975,6 +2975,7 @@ int decon_release(struct fb_info *info, int user)
struct decon_win *win = info->par;
struct decon_device *decon = win->decon;
+ return 0;
decon_info("%s + : %d\n", __func__, decon->id);
if (decon->dt.out_type == DECON_OUT_DP)
dp_logger_print("decon release\n");

View file

@ -0,0 +1,17 @@
Fixes "ld: read-only segment has dynamic relocations" error caused by "main/binutils: add -z text by default":
https://gitlab.alpinelinux.org/alpine/aports/-/commit/a737d101cad8c0acf782d9a0ec38cf8d3432b6ff
https://gitlab.alpinelinux.org/alpine/aports/-/commit/098309ba27bbb71f3723aa2e6e180776e0396b86
diff --git a/Makefile b/Makefile
index 4ee2a6394ec3..3fbced2573d1 100644
--- a/Makefile
+++ b/Makefile
@@ -969,6 +969,8 @@ ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
LDFLAGS_vmlinux += $(call ld-option, -X,)
endif
+LDFLAGS_vmlinux += -z notext
+
ifneq ($(SEC_BUILD_CONF_USE_FINGERPRINT_TZ), false)
ifeq ($(CONFIG_SENSORS_FINGERPRINT), y)
ifneq ($(CONFIG_SEC_FACTORY), y)

View file

@ -0,0 +1,78 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/exynos9810-starlte_defconfig
pkgname=linux-samsung-starlte
pkgver=4.9.299
pkgrel=0
pkgdesc="Samsung Galaxy S9 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-starlte"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
bash
bc
bison
devicepkg-dev
dtbtool-exynos
findutils
flex
openssl-dev
perl
clang
"
CC="clang"
HOSTCC="clang"
# Source
_repository="android_kernel_samsung_universal9810"
_commit="5eaa43c40667ef407f826ca2bab9552568327c23"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/Exynos9810-LTS/$_repository/archive/$_commit.tar.gz
$_config
01-decon_reg.patch
02-decon_dsi-BGRA-to-RGBA.patch
03-decon_dsi-UNBLANK-missed.patch
04-wifi-firmware-path.patch
05-decon_core-disable-decon_release.patch
06-fix-read-only-segment-has-dynamic-relocations-error.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
# Master DTB (deviceinfo_bootimg_qcdt)
dtbTool-exynos -o "$_outdir/arch/$_carch/boot"/dt.img \
$(find "$_outdir/arch/$_carch/boot/dts/" -name *starlte*.dtb)
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img \
"$pkgdir"/boot/dt.img
}
sha512sums="
2825193c94868c2e301e773e5cc5eef0e4fb4030a7e02a14e4ccfcab491af884e27ffabe92aabbbf77c0e74764e190ee800b9cdd5ff495f28666bfc9754888f2 linux-samsung-starlte-5eaa43c40667ef407f826ca2bab9552568327c23.tar.gz
2b311144db415d6233e55388185516e16cdbfd8be1afd9d5b8ef0ced6a925be9c1b641a18102ffa734705c256cec145c5792c0a02e8d104426e52aa6d4903687 config-samsung-starlte.aarch64
8d56a239cbd488692249ba856f3e949863dbb60edacfc862171f7b42c2564e99009ba88c8299b2179f468291fdc0de118235307acad07ec88342b8e68ee6f075 01-decon_reg.patch
65f5b1541bf3d4dab9db3d5de2aa888e794772f66d85541d11fbf515e7ec9188cda2ec46411f5469d8485caa5f405ffa16159f556bd9180c0cd3a527b14f9f5f 02-decon_dsi-BGRA-to-RGBA.patch
24eb8701d77ad6cfc98a153341874d753a67930a369b1a08d8d51682a5d1014971e106bda93b7180bcacdf7032bb952fdca02f68886ea27c761eab8fefdb03fa 03-decon_dsi-UNBLANK-missed.patch
596235334147a430d0104d01647e57aeac71b7a9e484daf4ad8fca9cd1cf23e040fbf2c00dea7fb2a096e741eb1dde71471585a59d71d47dcdb1336e5c16efad 04-wifi-firmware-path.patch
3bae3abd47766eba42ebe1ca758f0d9e1f8a926132d98705985b493fb99115af863700cc76cfaf3a8b812fcae86b52b7c6807dc8fbade95f98c1e965c5e3dddc 05-decon_core-disable-decon_release.patch
b24594b1bb1d5629338312236957e93f92422289a43f4865763e427f50b0e6a1ca0a7cd12cbdeb81135705b8d76d165b3b8f1b4ac6cb4c5b8d68ed3275ec299d 06-fix-read-only-segment-has-dynamic-relocations-error.patch
"

File diff suppressed because it is too large Load diff