samsung-a32: new device (MR 4859)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Veronika Bušová 2024-02-25 14:44:57 +01:00 committed by Pablo Correa Gómez
parent ed1447cac9
commit e891b5117a
No known key found for this signature in database
GPG key ID: 7A342565FF635F79
12 changed files with 6357 additions and 0 deletions

View file

@ -0,0 +1,35 @@
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Veronika Bušová <paricbat@email.cz>
pkgname=device-samsung-a32
pkgdesc="Samsung Galaxy A32 4G"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-samsung-a32
mkbootimg
postmarketos-base
postmarketos-base-downstream
msm-fb-refresher
"
makedepends="devicepkg-dev"
source="
deviceinfo
initfs-hook.sh
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
83f381b48e08f88e0392ec5a46121890ec4d788b287b4446693e07e35aef0b75298c4c08d5910f9e46d967aefd6baf13b1f3674c7aa8b34762cc29f81abb8db7 deviceinfo
a47b56e5c8cb2bbf3450198d254b0de4c207329af971ea5006277e841541aa6a3f6a5f5457b0a24b767f53cede1bf9d4b8d0bfaf937dac9b231597cb6f449b6b initfs-hook.sh
"

View file

@ -0,0 +1,34 @@
# 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 A32 4G"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-a32"
deviceinfo_year="2021"
deviceinfo_dtb="mediatek/mt6768"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline="bootopt=64S3,32N2,64N2 androidboot.selinux=permissive androidboot.init_fatal_reboot_target=recovery buildvariant=userdebug"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_pagesize="2048"
deviceinfo_header_version="2"
deviceinfo_append_dtb="false"
deviceinfo_flash_offset_dtb="0x0bc08000"
deviceinfo_flash_offset_base="0x40078000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x07c08000"
deviceinfo_flash_offset_second="0xbff88000"
deviceinfo_flash_offset_tags="0x0bc08000"
deviceinfo_flash_heimdall_partition_kernel="boot"
deviceinfo_flash_heimdall_partition_rootfs="super"

View file

@ -0,0 +1 @@
echo 1080,4800 > /sys/class/graphics/fb0/virtual_size

View file

@ -0,0 +1,13 @@
diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh
index 8ffa6b894..73d59d8cf 100755
--- a/kernel/gen_kheaders.sh
+++ b/kernel/gen_kheaders.sh
@@ -8,7 +8,7 @@ sfile="$(readlink -f "$0")"
outdir="$(pwd)"
tarfile=$1
cpio_dir=$outdir/$tarfile.tmp
-cpio=$KBUILD_SRC/tools/build/cpio
+cpio=/usr/bin/cpio
dir_list="
include/
arch/$SRCARCH/include/

View file

@ -0,0 +1,23 @@
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 8d7ab8809..499139552 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -348,8 +348,8 @@ int set_selection(const struct tiocl_selection __user *v, struct tty_struct *tty
return ret;
}
-int set_selection(const struct tiocl_selection __user *v,
- struct tty_struct *tty)
+/*
+int set_selection(const struct tiocl_selection __user *v, struct tty_struct *tty)
{
int ret;
@@ -359,6 +359,7 @@ int set_selection(const struct tiocl_selection __user *v,
return ret;
}
+*/
/* Insert the contents of the selection buffer into the
* queue of the tty associated with the current console.

View file

@ -0,0 +1,22 @@
diff --git a/drivers/clk/mediatek/clkdbg.c b/drivers/clk/mediatek/clkdbg.c
index b48a1715e..5728e5262 100644
--- a/drivers/clk/mediatek/clkdbg.c
+++ b/drivers/clk/mediatek/clkdbg.c
@@ -467,7 +467,7 @@ static bool pvdck_pwr_is_on(struct provider_clk *pvdck, u32 *spm_pwr_status, int
struct clk_hw *c_hw = __clk_get_hw(c);
if (array_size == 1)
- return clk_hw_pwr_sta_is_on(c_hw, spm_pwr_status, pvdck);
+ return clk_hw_pwr_sta_is_on(c_hw, *spm_pwr_status, pvdck);
return clk_hw_pwr_is_on(c_hw, spm_pwr_status, pvdck);
}
@@ -2020,7 +2020,7 @@ static void show_save_point(struct save_point *sp)
static void store_save_point(struct save_point *sp)
{
save_pwr_status(sp->spm_pwr_status);
- save_all_clks_state(sp->clks_states, sp->spm_pwr_status);
+ save_all_clks_state(sp->clks_states, &sp->spm_pwr_status);
#if CLKDBG_PM_DOMAIN
save_all_genpd_state(sp->genpd_states, sp->genpd_dev_states);

View file

@ -0,0 +1,26 @@
diff --git a/crypto/tcrypt_procfs.c b/crypto/tcrypt_procfs.c
index 3606b8c31..464cd3092 100644
--- a/crypto/tcrypt_procfs.c
+++ b/crypto/tcrypt_procfs.c
@@ -972,7 +972,7 @@ static int crypto_test_show(struct seq_file *m, void *v)
case -ERANGE:
p = ERR_RANGE; break;
case -ENOENT:
- p = ENOENT; break;
+ p = (char *)ENOENT; break;
case -EOPNOTSUPP:
p = ERR_OPNOTSUPP; break;
}
diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
index 4472397a3..913f268d6 100644
--- a/drivers/soc/mediatek/mtk-cmdq-helper.c
+++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
@@ -595,7 +595,7 @@ void *cmdq_pkt_get_curr_buf_va(struct cmdq_pkt *pkt)
if (unlikely(!pkt->avail_buf_size))
if (cmdq_pkt_add_cmd_buffer(pkt) < 0)
- return -ENOMEM;
+ return (void *)-ENOMEM;
buf = list_last_entry(&pkt->buf, typeof(*buf), list_entry);

View file

@ -0,0 +1,13 @@
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1e67d6a08..a554f41bf 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -330,7 +330,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
quiet_cmd_dtc = DTC $@
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(srctree)/scripts/dtc/dtc_overlay -@ -O dtb -o $@ -b 0 \
+ $(srctree)/out/scripts/dtc/dtc -@ -O dtb -o $@ -b 0 \
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) 2>$@.dtout || $(call show_dtc_error, $@.dtout) ;\
$(DTC) -q -O dts -I dtb -o $@.reverse.dts $@ ; \

View file

@ -0,0 +1,12 @@
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 64c23a20f..7ef7559fd 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -102,6 +102,7 @@ config ARM64
select HAVE_GENERIC_DMA_COHERENT
select HAVE_HW_BREAKPOINT if PERF_EVENTS
select HAVE_IRQ_TIME_ACCOUNTING
+ select HAVE_KERNEL_GZIP
select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP if NUMA
select HAVE_NMI if ACPI_APEI_SEA

View file

@ -0,0 +1,123 @@
From 5934637641c863cc2c1765a0d01c5b6f53ecc4fc Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers@google.com>
Date: Wed, 26 Aug 2020 15:21:29 +1000
Subject: lib/string.c: implement stpcpy
LLVM implemented a recent "libcall optimization" that lowers calls to
`sprintf(dest, "%s", str)` where the return value is used to `stpcpy(dest,
str) - dest`. This generally avoids the machinery involved in parsing
format strings. `stpcpy` is just like `strcpy` except it returns the
pointer to the new tail of `dest`. This optimization was introduced into
clang-12.
Implement this so that we don't observe linkage failures due to missing
symbol definitions for `stpcpy`.
Similar to last year's fire drill with: commit 5f074f3e192f
("lib/string.c: implement a basic bcmp")
The kernel is somewhere between a "freestanding" environment (no full
libc) and "hosted" environment (many symbols from libc exist with the same
type, function signature, and semantics).
As H. Peter Anvin notes, there's not really a great way to inform the
compiler that you're targeting a freestanding environment but would like
to opt-in to some libcall optimizations (see pr/47280 below), rather than
opt-out.
Arvind notes, -fno-builtin-* behaves slightly differently between GCC and
Clang, and Clang is missing many __builtin_* definitions, which I consider
a bug in Clang and am working on fixing.
Masahiro summarizes the subtle distinction between compilers justly:
To prevent transformation from foo() into bar(), there are two ways in
Clang to do that; -fno-builtin-foo, and -fno-builtin-bar. There is
only one in GCC; -fno-buitin-foo.
(Any difference in that behavior in Clang is likely a bug from a missing
__builtin_* definition.)
Masahiro also notes:
We want to disable optimization from foo() to bar(),
but we may still benefit from the optimization from
foo() into something else. If GCC implements the same transform, we
would run into a problem because it is not -fno-builtin-bar, but
-fno-builtin-foo that disables that optimization.
In this regard, -fno-builtin-foo would be more future-proof than
-fno-built-bar, but -fno-builtin-foo is still potentially overkill. We
may want to prevent calls from foo() being optimized into calls to
bar(), but we still may want other optimization on calls to foo().
It seems that compilers today don't quite provide the fine grain control
over which libcall optimizations pseudo-freestanding environments would
prefer.
Finally, Kees notes that this interface is unsafe, so we should not
encourage its use. As such, I've removed the declaration from any header,
but it still needs to be exported to avoid linkage errors in modules.
Link: https://lkml.kernel.org/r/20200825140001.2941001-1-ndesaulniers@google.com
Link: https://bugs.llvm.org/show_bug.cgi?id=47162
Link: https://bugs.llvm.org/show_bug.cgi?id=47280
Link: https://github.com/ClangBuiltLinux/linux/issues/1126
Link: https://man7.org/linux/man-pages/man3/stpcpy.3.html
Link: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stpcpy.html
Link: https://reviews.llvm.org/D85963
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Suggested-by: Andy Lavr <andy.lavr@gmail.com>
Suggested-by: Arvind Sankar <nivedita@alum.mit.edu>
Suggested-by: Joe Perches <joe@perches.com>
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: <stable@vger.kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
lib/string.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/lib/string.c b/lib/string.c
index 6012c385fb314d..6bd0cf0fb009a2 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -272,6 +272,30 @@ ssize_t strscpy_pad(char *dest, const char *src, size_t count)
}
EXPORT_SYMBOL(strscpy_pad);
+/**
+ * stpcpy - copy a string from src to dest returning a pointer to the new end
+ * of dest, including src's %NUL-terminator. May overrun dest.
+ * @dest: pointer to end of string being copied into. Must be large enough
+ * to receive copy.
+ * @src: pointer to the beginning of string being copied from. Must not overlap
+ * dest.
+ *
+ * stpcpy differs from strcpy in a key way: the return value is the new
+ * %NUL-terminated character. (for strcpy, the return value is a pointer to
+ * src. This interface is considered unsafe as it doesn't perform bounds
+ * checking of the inputs. As such it's not recommended for usage. Instead,
+ * its definition is provided in case the compiler lowers other libcalls to
+ * stpcpy.
+ */
+char *stpcpy(char *__restrict__ dest, const char *__restrict__ src);
+char *stpcpy(char *__restrict__ dest, const char *__restrict__ src)
+{
+ while ((*dest++ = *src++) != '\0')
+ /* nothing */;
+ return --dest;
+}
+EXPORT_SYMBOL(stpcpy);
+
#ifndef __HAVE_ARCH_STRCAT
/**
* strcat - Append one %NUL-terminated string to another
--
cgit 1.2.3-korg

View file

@ -0,0 +1,80 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/a32_defconfig
# Maintainer: Veronika Bušová <paricbat@email.cz>
pkgname=linux-samsung-a32
pkgver=4.14.195
pkgrel=0
pkgdesc="Samsung Galaxy A32 4G kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-a32"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
bash
bc
bison
devicepkg-dev
findutils
flex
openssl-dev
perl
linux-headers
clang
cpio
xz
"
# Source
_repository="kernel_samsung_a32"
_commit="69ebc099071238de52ad4a3ac4a65fbda1865fda"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/A325F/$_repository/archive/$_commit.tar.gz
$_config
01_use_system_cpio.patch
02_remove_duplicate_set_selection.patch
03_fix_pointer_ref_and_deref_errors.patch
04_cast_ints_to_the_correct_return_type.patch
05_dont_use_prebuilt_dtc.patch
06_enable_gzip_compression.patch
10_add_stpcpy.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
REPLACE_GCCH=0 . downstreamkernel_prepare
}
build() {
unset LDFLAGS
export CC="clang"
export HOSTCC="clang"
make O="$_outdir" ARCH="$_carch" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
cp $_outdir/arch/$_carch/boot/Image.gz $_outdir/arch/$_carch/boot/zImage
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
make dtbs_install O="$_outdir" ARCH="$_carch" \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
}
sha512sums="
99484dd228a1f894792fc34da74a92787174b1b2f5de059d7cba91401e337ef152907491092de214df06ac254d7ad5f0ffedfe5a7b165a2e121dab5094d292f8 linux-samsung-a32-69ebc099071238de52ad4a3ac4a65fbda1865fda.tar.gz
2ca8154e922baa037dfd1e5271c27153655c17299008b16d8698a1b11c0b8d27cd214ce63f6f80b2526b2077c4d65b37922da9fa469ca0bb86bb8540180fbada config-samsung-a32.aarch64
3b139f775eec7d41c4baae6550c3d1036e9d853f5fedcb1992d7cff56b2922fcf42f363f79ad7a718fe79ee10bd0bc87c4c68187fa6332f478d4ec288d12a2cf 01_use_system_cpio.patch
5a724f4ea619ba222f2b39fcd5aaabf9a5439e1d5430bb74ca64dfdc3b47d83a92b2e64969e5f6d198b9d57ba1c192618fc47f18f6a6bb1be3ac54d0e8dab58e 02_remove_duplicate_set_selection.patch
bde0ddf1d41e0d736a5aad88d78bdc8ad1448397e7af19f411ef544c0241723a8c1d548aacae410a1553afbfa2a7ef838113dcc127fcb649498f2d85cc37199a 03_fix_pointer_ref_and_deref_errors.patch
d6eb027d525a385a191b0fb11b0d0ce12685f0b69f67fc192d92d6c1c90c4ccf78c5ccbf2a3f83d3a50f5544b078761222f23b58464cda3a2096747a0057444b 04_cast_ints_to_the_correct_return_type.patch
80f52b1abf6f05c4b28553ed6a08e0ecb536a2c74118eb25926f682a808814fb340d50662d1085edb99248e8f50d59f476c7a4bc124894fd3720510f291a916f 05_dont_use_prebuilt_dtc.patch
5bc48f3a3971f6e4ec16b80f56aaac72010d9a06290738b4b8de5e72faa429777490d0eeb9dea2c6404ef5858fcc0fcef3bd95bb89e0a6dfe9031c44fc978f4d 06_enable_gzip_compression.patch
706c2d3a178231d9f79f5f594cebaafdc6a39add602cca4c8a381ca181d27a82afb49aef494dc7b11905089d337c344cb9ce05b6d94199af37a4a46cc9cf22f1 10_add_stpcpy.patch
"

File diff suppressed because it is too large Load diff