xiaomi-monet: new device (MR 4612)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Augis154 2023-12-09 14:22:09 +02:00 committed by Pablo Correa Gómez
parent f012b3b37c
commit 1b4262607d
No known key found for this signature in database
GPG key ID: 7A342565FF635F79
8 changed files with 6489 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Maintainer: Augustas Stankevicius <augustas.stankevicius@gmail.com>
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-monet
pkgdesc="Xiaomi Mi 10 Lite 5G"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-xiaomi-monet
mkbootimg
postmarketos-base
"
makedepends="devicepkg-dev"
source="
deviceinfo
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
ee333c1b98c3e42c5a66f5249c44162d8c6318c750bbab9367f2fac982a38494c3f086d1b8335f10f72ebe9f550c0c4ff23ec977b750d429bf3b9752c37b2c4a deviceinfo
"

View file

@ -0,0 +1,30 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Xiaomi Mi 10 Lite 5G"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-monet"
deviceinfo_year="2020"
deviceinfo_dtb="vendor/qcom/monet-sm7250"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="false"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x237 service_locator.enable=1 androidboot.usbcontroller=a600000.dwc3 swiotlb=2048 loop.max_part=7 cgroup.memory=nokmem,nosocket reboot=panic_warm androidboot.init_fatal_reboot_target=recovery androidboot.selinux=permissive buildvariant=eng"
deviceinfo_generate_bootimg="true"
deviceinfo_flash_pagesize="4096"
deviceinfo_rootfs_image_sector_size="4096"
deviceinfo_header_version="2"
deviceinfo_flash_offset_dtb="0x01f00000"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00000000"
deviceinfo_flash_offset_tags="0x00000100"

View file

@ -0,0 +1,82 @@
From ce0249eb837abad6d8829d5f964a3338be8aca67 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers@google.com>
Date: Tue, 10 Mar 2020 15:36:45 -0700
Subject: [PATCH] Revert "selinux: Relocate ss_initialized and
selinux_enforcing to separate 4k"
This reverts commit 50240fa8416f5fd183cb147fd3c66aeaeb74a1f8.
That out of tree patch causes the resulting kernel image to be too
large, causing ld.lld to error; since .bss is specified twice.
Fixes the observed error:
ld.lld: error: output file too large: 18446743524330100280 bytes
when using LLD without LTO enabled.
Bug: 151154720
Reported-by: Matthias Maennich <maennich@google.com>
Debugged-by: Fangrui Song <maskray@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Iebb8135630132cd4ae49f3d2d1e85bd61cfa6111
---
arch/arm64/kernel/vmlinux.lds.S | 8 --------
include/linux/init.h | 2 --
security/selinux/hooks.c | 2 +-
3 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 86a57e2fa9af..05df6fffedea 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -76,10 +76,6 @@ jiffies = jiffies_64;
#define TRAMP_TEXT
#endif
-#define RTIC_BSS \
- . = ALIGN(PAGE_SIZE); \
- KEEP(*(.bss.rtic)); \
- . = ALIGN(PAGE_SIZE); \
/*
* The size of the PE/COFF section that covers the kernel image, which
* runs from stext to _edata, must be a round multiple of the PE/COFF
@@ -260,10 +256,6 @@ SECTIONS
STABS_DEBUG
HEAD_SYMBOLS
-
- .bss : { /* bss segment */
- RTIC_BSS
- }
}
/*
diff --git a/include/linux/init.h b/include/linux/init.h
index bc719c7da735..586dd187e22f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -322,8 +322,6 @@ void __init parse_early_options(char *cmdline);
/* Data marked not to be saved by software suspend */
#define __nosavedata __section(.data..nosave)
-#define __rticdata __attribute__((section(".bss.rtic")))
-
#ifdef MODULE
#define __exit_p(x) x
#else
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 305890cab97b..d4e1e63a55d6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -100,7 +100,7 @@
#include "audit.h"
#include "avc_ss.h"
-struct selinux_state selinux_state __rticdata;
+struct selinux_state selinux_state;
/* SECMARK reference count */
static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0);
--
2.39.2

View file

@ -0,0 +1,67 @@
# Maintainer: Augustas Stankevicius <augustas.stankevicius@gmail.com>
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/vendor/monet_user_defconfig
pkgname=linux-xiaomi-monet
pkgver=4.19.113
pkgrel=0
pkgdesc="Xiaomi Mi 10 Lite 5G kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-monet"
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
xz
"
_repository="android_kernel_xiaomi_sm7250"
_commit="fe4abf71920f4685218fb9951ca9950ff6dac0a9"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
$_config
Remove-gcc-python-wrapper.patch
selinux_include_generated_headers.patch
Suppress-error-about-static-buffer-overflow.patch
0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
REPLACE_GCCH=0 . downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" -j4 \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
make dtbs_install O="$_outdir" ARCH="$_carch" \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
}
sha512sums="
69ef51f16dbb3af9ad776cc1ca1169bb338a28643dc879841e1ffb2a99562b0ad78af1f445178610a5d0f244fc2ca1f0a90c95875a082325786805d46c044fe6 linux-xiaomi-monet-fe4abf71920f4685218fb9951ca9950ff6dac0a9.tar.gz
35a9077f9351048579df71970095ae1ed715ae23eb20d30f05b54188827f7b2b7639a94863f695063c07f95210286aeb851009c0d9c4eb4ac5ed386ec1b3f794 config-xiaomi-monet.aarch64
359f619b7aac5bab061311f0806018ed04ce96a2233584a507b14c50ce616dfbc1681dd465ca3f0182165a6fc6c7b87435615bd1bd93efe174b95deba071f5fc Remove-gcc-python-wrapper.patch
6ab9db01d35f7f5cc2c19ebe5f65a7dc479a1c68de587300cdde9a6c759d34610666c72f0f321cd450cf56c13df3b54a774e0f7ebdbf0f8608fbfd66b49d04e7 selinux_include_generated_headers.patch
4e7a73a1c6e8424a34d317899525ca3d783de1a5e65cc0ecdf6334bbb233d165b476107e599cbd86868ed91a5a60d2ef0eff975861d61cb2c403b572314b4a94 Suppress-error-about-static-buffer-overflow.patch
16459200092a2fa68054a758ad8fb175c86e6cdaa49e81c0c91568082cd0348526d43b9dfe0faac8b21465240f44253683f9c475c6f7350d7ef74149aa9c1dba 0008-Revert-selinux-Relocate-ss_initialized-and-selinux_e.patch
"

View file

@ -0,0 +1,36 @@
From 966d3ac2409b59f431e1397f5ab8e9ee74ba5ae0 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Sat, 20 Feb 2021 00:49:45 +0200
Subject: [PATCH 3/6] Remove gcc python wrapper
---
Makefile | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 15a18b3cd15f6..e6a72c1a84fe9 100644
--- a/Makefile
+++ b/Makefile
@@ -370,7 +370,7 @@ KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
# Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
-REAL_CC = $(CROSS_COMPILE)gcc
+CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
@@ -389,10 +389,6 @@ PYTHON2 = python2
PYTHON3 = python3
CHECK = sparse
-# Use the wrapper for the compiler. This wrapper scans for new
-# warnings and causes the build to stop upon encountering them
-CC = $(PYTHON) $(srctree)/scripts/gcc-wrapper.py $(REAL_CC)
-
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
NOSTDINC_FLAGS =
--
2.30.1

View file

@ -0,0 +1,22 @@
From e950e514cd6b45f8d1512eef1c959769183caf56 Mon Sep 17 00:00:00 2001
From: Alexandros Feuerstein <32029275+afeuerstein@users.noreply.github.com>
Date: Tue, 13 Jul 2021 11:19:58 +0200
Subject: [PATCH] Update ipa_hw_stats.c
---
drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
index 1b900a27173b..d1e40689709a 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
@@ -2253,7 +2253,7 @@ static ssize_t ipa_debugfs_enable_disable_drop_stats(struct file *file,
goto bail;
}
- missing = copy_from_user(dbg_buff, ubuf, count);
+ missing = _copy_from_user(dbg_buff, ubuf, count);
if (missing) {
ret = -EFAULT;
goto bail;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,33 @@
Arm64 has generated headers that other arches don't, didn't investigate why this
is able to compile in downstream (our upstream). Possibly due to out-of-tree build.
Note the hacky relative include. May not work in more complicated setups.
diff --git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile
index e8c533140..62475f060 100644
--- a/scripts/selinux/genheaders/Makefile
+++ b/scripts/selinux/genheaders/Makefile
@@ -2,6 +2,8 @@
hostprogs-y := genheaders
HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \
- -I$(srctree)/security/selinux/include
+ -I$(srctree)/security/selinux/include \
+ -I./arch/$(ARCH)/include/generated/uapi \
+ -I$(srctree)/arch/$(ARCH)/include/uapi
always := $(hostprogs-y)
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile
index e9c92db7e..09e626fa4 100644
--- a/scripts/selinux/mdp/Makefile
+++ b/scripts/selinux/mdp/Makefile
@@ -2,7 +2,9 @@
hostprogs-y := mdp
HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \
- -I$(srctree)/security/selinux/include
+ -I$(srctree)/security/selinux/include \
+ -I./arch/$(ARCH)/include/generated/uapi \
+ -I$(srctree)/arch/$(ARCH)/include/uapi
always := $(hostprogs-y)
clean-files := policy.* file_contexts