lg-elsa: new device

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8701>

Co-authored-by: Ferass El Hafidi <funderscore@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8701>
This commit is contained in:
Nardo45 2026-05-31 20:53:45 -04:00 committed by Clayton Craft
parent be29d62b94
commit bac7f24803
No known key found for this signature in database
GPG key ID: B14FABC9971C467A
10 changed files with 5387 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Reference: <https://postmarketos.org/devicepkg>
maintainer="Nardo45 <Nardo45@proton.me>"
pkgname=device-lg-elsa
pkgdesc="LG V20 (elsa)"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-lg-elsa
mkbootimg
msm-fb-refresher
postmarketos-base
"
makedepends="devicepkg-dev"
source="deviceinfo kernel-cmdline.conf"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
a84a72e0bc7a2662ff2626865097d1da6f3cb08412f685a8e9add80dd9e674d648fd9d3fc7c81e6b380bd25668cfed7ce5874975aff080be8770ecc2493a083d deviceinfo
67a15c9304112e80e54e62da1bfc6c4c0b942f3a125723f6d007afaa07232fe61ec14c515570ae9abf2ef35a8bdd2f4e7df892904b79b0c1b0f54073603ac157 kernel-cmdline.conf
"

View file

@ -0,0 +1,25 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="LG V20"
deviceinfo_manufacturer="LG"
deviceinfo_codename="lg-elsa"
deviceinfo_year="2016"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_external_storage="true"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_generate_bootimg="true"
deviceinfo_flash_pagesize="4096"
deviceinfo_flash_offset_base="0x80000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x80000000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_rootfs_image_sector_size="4096"

View file

@ -0,0 +1 @@
console=ttyHSL0,115200,n8

View file

@ -0,0 +1,73 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/lineageos_h990_defconfig
maintainer="Nardo45 <Nardo45@proton.me>"
pkgname=linux-lg-elsa
pkgver=3.18.113
pkgrel=0
pkgdesc="LG V20 (elsa) kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="lg-elsa"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
bash
bc
devicepkg-dev
elfutils-dev
flex
gcc6
gmp-dev
installkernel
linux-headers
perl
sed
"
# Source
_repository="android_kernel_lge_msm8996"
_commit="c0cf2a6e4ccceb664492ca47b8b1c9f9d4a680c2"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
$_config
gcc10-extern_YYLOC_global_declaration.patch
asm_immediate_parentheses.patch
asm_section_flags.patch
vdsomunge_upstream.patch
fix_include_paths.patch
"
builddir="$srcdir/$_repository-$_commit"
prepare() {
default_prepare
. downstreamkernel_prepare
}
# Compiler: GCC 6 (doesn't boot when compiled with newer versions)
build() {
unset LDFLAGS
# We pass the compiler overrides directly to make here.
# This avoids using global variables which upsets apkbuild-lint.
make ARCH="$_carch" \
CC="gcc6-${CC:-gcc}" \
HOSTCC="gcc6-gcc" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor"
}
sha512sums="
bc15ff2fc2f452fc3e30704c36800e029a1911d5852b113b47f48264fcf43266ad1185cc69a5e8978bb9c091b94ef36f40a607545199546e0a554269de3ae71a linux-lg-elsa-c0cf2a6e4ccceb664492ca47b8b1c9f9d4a680c2.tar.gz
e256a4420c482da35aa92a1d0ea3346e96d59ecf2ae07c82d9610b7b711beb5130c8c818b8babbb0de4d1d65daa1bf001b9543d50fc6e3a0a79017babc839122 config-lg-elsa.aarch64
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
ef1f25e7bca6624893432caa93a9795e07e8ba4aa4603a969c02ce92001d92566a1f9c87def610849522578decc7b12cf9a03d80d34d3b2e4c743ced185f1e7f asm_immediate_parentheses.patch
b2a06d84b2caf44944cadd355c0a425d017b7edd91fe3f7003a74fe177da0d86dd3c0b30b6879b92b0b405d378c1dd31d43f2c619f36873aa1430a00d458b3ea asm_section_flags.patch
6d31f4c70b2a96dcddfb0ef4aa87312eda79efdecf08306e027812f87774ede054f229b9769473ced4f05f3a25fbc3e785a7b8a1d65ba13a89b39d8d19085ff3 vdsomunge_upstream.patch
dfecd8ba5d57b55c8988fe7c33a2f14670a3d64485ed73847cae2cab7ce95e18173dd7f01a2981bae738ad6a613ecee300412771b211b53667f906848893f130 fix_include_paths.patch
"

View file

@ -0,0 +1,16 @@
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index b6245c71bd07..67eb17a743ad 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -152,9 +152,9 @@ ENTRY(__cpu_setup)
tlbi vmalle1 // Invalidate local TLB
dsb nsh
- mov x0, #3 << 20
+ mov x0, #(3 << 20)
msr cpacr_el1, x0 // Enable FP/ASIMD
- mov x0, #1 << 12 // Reset mdscr_el1 and disable
+ mov x0, #(1 << 12) // Reset mdscr_el1 and disable
msr mdscr_el1, x0 // access to the DCC from EL0
isb // Unmask debug exceptions now,
enable_dbg // since this is per-cpu

View file

@ -0,0 +1,13 @@
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index b6245c71bd07..28b7050241d1 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -140,7 +140,7 @@ ENTRY(cpu_do_switch_mm)
b post_ttbr_update_workaround // Back to C code...
ENDPROC(cpu_do_switch_mm)
- .section ".text.init", #alloc, #execinstr
+ .section .text.init, "ax"
/*
* __cpu_setup

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,169 @@
diff --git a/drivers/gpu/msm/adreno_trace.h b/drivers/gpu/msm/adreno_trace.h
index 74c4c4e6e1fa..313f2bb0b117 100644
--- a/drivers/gpu/msm/adreno_trace.h
+++ b/drivers/gpu/msm/adreno_trace.h
@@ -17,7 +17,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kgsl
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/msm/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE adreno_trace
diff --git a/drivers/gpu/msm/kgsl_trace.h b/drivers/gpu/msm/kgsl_trace.h
index 6438c6e65b97..088534fe7e4c 100644
--- a/drivers/gpu/msm/kgsl_trace.h
+++ b/drivers/gpu/msm/kgsl_trace.h
@@ -17,7 +17,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kgsl
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/msm/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE kgsl_trace
diff --git a/drivers/net/ethernet/msm/rndis_ipa_trace.h b/drivers/net/ethernet/msm/rndis_ipa_trace.h
index c0fc573799f2..1e8dd9a7f282 100644
--- a/drivers/net/ethernet/msm/rndis_ipa_trace.h
+++ b/drivers/net/ethernet/msm/rndis_ipa_trace.h
@@ -77,5 +77,5 @@ TRACE_EVENT(
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/net/ethernet/msm/
#include <trace/define_trace.h>
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h b/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h
index a03a49a33f97..218d3e965943 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h
@@ -148,5 +148,5 @@ TRACE_EVENT(
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/platform/msm/ipa/ipa_v2/
#include <trace/define_trace.h>
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h b/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
index b67899ba894e..9e341ab1d203 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
@@ -149,5 +149,5 @@ TRACE_EVENT(
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/platform/msm/ipa/ipa_v3/
#include <trace/define_trace.h>
diff --git a/drivers/soc/qcom/tracer_pkt_private.h b/drivers/soc/qcom/tracer_pkt_private.h
index fc760e6b68d1..5573aec2fe83 100644
--- a/drivers/soc/qcom/tracer_pkt_private.h
+++ b/drivers/soc/qcom/tracer_pkt_private.h
@@ -15,7 +15,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM tracer_pkt
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/soc/qcom/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE tracer_pkt_private
diff --git a/drivers/nfc/pn548/pn548.c b/drivers/nfc/pn548/pn548.c
index dca56a309437..b5f1462e34c2 100644
--- a/drivers/nfc/pn548/pn548.c
+++ b/drivers/nfc/pn548/pn548.c
@@ -40,7 +40,7 @@
#include <linux/wakelock.h>
#include <linux/kthread.h>
-#include <pn548.h>
+#include "pn548.h"
#define MAX_BUFFER_SIZE 512
#define _A1_PN66T_
diff --git a/include/trace/events/msm_cam.h b/include/trace/events/msm_cam.h
index 9a5dd158b4b8..4c1b4659e91e 100644
--- a/include/trace/events/msm_cam.h
+++ b/include/trace/events/msm_cam.h
@@ -16,7 +16,7 @@
#if !defined(_TRACE_MSM_VFE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_MSM_VFE_H
-#include "msm_isp.h"
+#include "../../uapi/media/msm_isp.h"
#include <linux/types.h>
#include <linux/tracepoint.h>
diff --git a/sound/soc/msm/apq8096-auto.c b/sound/soc/msm/apq8096-auto.c
index 2ae78f75c340..62dd641aa79f 100644
--- a/sound/soc/msm/apq8096-auto.c
+++ b/sound/soc/msm/apq8096-auto.c
@@ -33,7 +33,7 @@
#include <sound/q6core.h>
#include <sound/pcm_params.h>
#include <sound/info.h>
-#include <device_event.h>
+#include "device_event.h"
#include "qdsp6v2/msm-pcm-routing-v2.h"
#define DRV_NAME "apq8096-auto-asoc-snd"
diff --git a/sound/soc/msm/apq8096-i2c.c b/sound/soc/msm/apq8096-i2c.c
index 8bcda764af09..8d50c6d79605 100644
--- a/sound/soc/msm/apq8096-i2c.c
+++ b/sound/soc/msm/apq8096-i2c.c
@@ -31,7 +31,7 @@
#include <sound/q6core.h>
#include <sound/pcm_params.h>
#include <sound/info.h>
-#include <device_event.h>
+#include "device_event.h"
#include "qdsp6v2/msm-pcm-routing-v2.h"
#include "../codecs/wcd9xxx-common.h"
#include "../codecs/wcd9330.h"
diff --git a/sound/soc/msm/mdm9650.c b/sound/soc/msm/mdm9650.c
index ee469f10b78a..9c4c90e84134 100644
--- a/sound/soc/msm/mdm9650.c
+++ b/sound/soc/msm/mdm9650.c
@@ -26,7 +26,7 @@
#include <sound/q6afe-v2.h>
#include <sound/info.h>
#include <sound/pcm_params.h>
-#include <device_event.h>
+#include "device_event.h"
#include <soc/qcom/socinfo.h>
#include <qdsp6v2/msm-pcm-routing-v2.h>
#include <sound/q6core.h>
diff --git a/sound/soc/msm/msm8996.c b/sound/soc/msm/msm8996.c
index 1e051b12065a..c135f7b6b86c 100644
--- a/sound/soc/msm/msm8996.c
+++ b/sound/soc/msm/msm8996.c
@@ -31,7 +31,7 @@
#include <sound/q6core.h>
#include <sound/pcm_params.h>
#include <sound/info.h>
-#include <device_event.h>
+#include "device_event.h"
#include "qdsp6v2/msm-pcm-routing-v2.h"
#include "../codecs/wcd9xxx-common.h"
#include "../codecs/wcd9330.h"
diff --git a/drivers/platform/msm/mhi/mhi_ssr.c b/drivers/platform/msm/mhi/mhi_ssr.c
index f4f2e427972f..1c3f305c2144 100644
--- a/drivers/platform/msm/mhi/mhi_ssr.c
+++ b/drivers/platform/msm/mhi/mhi_ssr.c
@@ -11,8 +11,8 @@
*/
#include <linux/pm_runtime.h>
-#include <mhi_sys.h>
-#include <mhi.h>
+#include "mhi_sys.h"
+#include "mhi.h"
#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_notif.h>
#include <linux/esoc_client.h>
--
2.24.1

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc10-extern_YYLOC_global_declaration.patch

View file

@ -0,0 +1,178 @@
Fixes compilation under gcc8 without glibc
---
diff --git a/arch/arm/vdso/vdsomunge.c b/arch/arm/vdso/vdsomunge.c
index 9005b07296c8..f6455273b2f8 100644
--- a/arch/arm/vdso/vdsomunge.c
+++ b/arch/arm/vdso/vdsomunge.c
@@ -45,13 +45,10 @@
* it does.
*/
-#define _GNU_SOURCE
-
-#include <byteswap.h>
#include <elf.h>
#include <errno.h>
-#include <error.h>
#include <fcntl.h>
+#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -61,6 +58,16 @@
#include <sys/types.h>
#include <unistd.h>
+#define swab16(x) \
+ ((((x) & 0x00ff) << 8) | \
+ (((x) & 0xff00) >> 8))
+
+#define swab32(x) \
+ ((((x) & 0x000000ff) << 24) | \
+ (((x) & 0x0000ff00) << 8) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0xff000000) >> 24))
+
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define HOST_ORDER ELFDATA2LSB
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
@@ -82,27 +89,41 @@
#define EF_ARM_ABI_FLOAT_HARD 0x400
#endif
+static int failed;
+static const char *argv0;
static const char *outfile;
+static void fail(const char *fmt, ...)
+{
+ va_list ap;
+
+ failed = 1;
+ fprintf(stderr, "%s: ", argv0);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
static void cleanup(void)
{
- if (error_message_count > 0 && outfile != NULL)
+ if (failed && outfile != NULL)
unlink(outfile);
}
static Elf32_Word read_elf_word(Elf32_Word word, bool swap)
{
- return swap ? bswap_32(word) : word;
+ return swap ? swab32(word) : word;
}
static Elf32_Half read_elf_half(Elf32_Half half, bool swap)
{
- return swap ? bswap_16(half) : half;
+ return swap ? swab16(half) : half;
}
static void write_elf_word(Elf32_Word val, Elf32_Word *dst, bool swap)
{
- *dst = swap ? bswap_32(val) : val;
+ *dst = swap ? swab32(val) : val;
}
int main(int argc, char **argv)
@@ -119,68 +140,66 @@ int main(int argc, char **argv)
int infd;
atexit(cleanup);
+ argv0 = argv[0];
if (argc != 3)
- error(EXIT_FAILURE, 0, "Usage: %s [infile] [outfile]", argv[0]);
+ fail("Usage: %s [infile] [outfile]\n", argv[0]);
infile = argv[1];
outfile = argv[2];
infd = open(infile, O_RDONLY);
if (infd < 0)
- error(EXIT_FAILURE, errno, "Cannot open %s", infile);
+ fail("Cannot open %s: %s\n", infile, strerror(errno));
if (fstat(infd, &stat) != 0)
- error(EXIT_FAILURE, errno, "Failed stat for %s", infile);
+ fail("Failed stat for %s: %s\n", infile, strerror(errno));
inbuf = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, infd, 0);
if (inbuf == MAP_FAILED)
- error(EXIT_FAILURE, errno, "Failed to map %s", infile);
+ fail("Failed to map %s: %s\n", infile, strerror(errno));
close(infd);
inhdr = inbuf;
if (memcmp(&inhdr->e_ident, ELFMAG, SELFMAG) != 0)
- error(EXIT_FAILURE, 0, "Not an ELF file");
+ fail("Not an ELF file\n");
if (inhdr->e_ident[EI_CLASS] != ELFCLASS32)
- error(EXIT_FAILURE, 0, "Unsupported ELF class");
+ fail("Unsupported ELF class\n");
swap = inhdr->e_ident[EI_DATA] != HOST_ORDER;
if (read_elf_half(inhdr->e_type, swap) != ET_DYN)
- error(EXIT_FAILURE, 0, "Not a shared object");
+ fail("Not a shared object\n");
- if (read_elf_half(inhdr->e_machine, swap) != EM_ARM) {
- error(EXIT_FAILURE, 0, "Unsupported architecture %#x",
- inhdr->e_machine);
- }
+ if (read_elf_half(inhdr->e_machine, swap) != EM_ARM)
+ fail("Unsupported architecture %#x\n", inhdr->e_machine);
e_flags = read_elf_word(inhdr->e_flags, swap);
if (EF_ARM_EABI_VERSION(e_flags) != EF_ARM_EABI_VER5) {
- error(EXIT_FAILURE, 0, "Unsupported EABI version %#x",
- EF_ARM_EABI_VERSION(e_flags));
+ fail("Unsupported EABI version %#x\n",
+ EF_ARM_EABI_VERSION(e_flags));
}
if (e_flags & EF_ARM_ABI_FLOAT_HARD)
- error(EXIT_FAILURE, 0,
- "Unexpected hard-float flag set in e_flags");
+ fail("Unexpected hard-float flag set in e_flags\n");
clear_soft_float = !!(e_flags & EF_ARM_ABI_FLOAT_SOFT);
outfd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (outfd < 0)
- error(EXIT_FAILURE, errno, "Cannot open %s", outfile);
+ fail("Cannot open %s: %s\n", outfile, strerror(errno));
if (ftruncate(outfd, stat.st_size) != 0)
- error(EXIT_FAILURE, errno, "Cannot truncate %s", outfile);
+ fail("Cannot truncate %s: %s\n", outfile, strerror(errno));
outbuf = mmap(NULL, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED,
outfd, 0);
if (outbuf == MAP_FAILED)
- error(EXIT_FAILURE, errno, "Failed to map %s", outfile);
+ fail("Failed to map %s: %s\n", outfile, strerror(errno));
close(outfd);
@@ -195,7 +214,7 @@ int main(int argc, char **argv)
}
if (msync(outbuf, stat.st_size, MS_SYNC) != 0)
- error(EXIT_FAILURE, errno, "Failed to sync %s", outfile);
+ fail("Failed to sync %s: %s\n", outfile, strerror(errno));
return EXIT_SUCCESS;
}