xiaomi-fire: new device (MR 4827)

Working: USB OTG, display, external/internal storage
This commit is contained in:
Eray Tutmaz 2024-02-16 09:51:44 +03:00 committed by Ferass El Hafidi
parent fe54a7be49
commit 65ae048ae5
No known key found for this signature in database
GPG key ID: CAB5A5DBC11B967B
8 changed files with 5774 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Eray Tutmaz <tarkanttmz261@gmail.com>
pkgname=device-xiaomi-fire
pkgdesc="Xiaomi Redmi 12"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
mkbootimg
postmarketos-base
linux-xiaomi-fire
msm-fb-refresher
postmarketos-base-downstream
"
makedepends="devicepkg-dev"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
6857f3cf8723ad8126923135b6349c4cbd82d5e1444a63707eb5d744e8439ebe54dec110ef342599efe47c2a87dc76c302c63a502b3af886acb37369354f157d deviceinfo
"

View file

@ -0,0 +1,37 @@
# 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 Redmi 12"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-fire"
deviceinfo_year="2023"
deviceinfo_dtb="mediatek/mt6768"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="bootopt=64S3,32N2,64N2 firmware_class.path=/lib/firmware/postmarketos"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_sparse="true"
deviceinfo_flash_fastboot_partition_rootfs="super"
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"
# NOTE: Flashing kernel on upgrades unsupported due to "dd: error writing
# '/dev/disk/by-partlabel/boot_a': Operation not permitted"
# (the current slot's boot partition appears to be write-protected :/)

View file

@ -0,0 +1,87 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/fire_defconfig
pkgname=linux-xiaomi-fire
pkgver=4.19.191
pkgrel=0
pkgdesc="Xiaomi Redmi 12 4G kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-fire"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
android-tools
bash
bc
bison
devicepkg-dev
findutils
flex
openssl-dev
perl
linux-headers
cpio
gzip
xz
clang
"
export CC="clang"
export HOSTCC="clang"
# Source
_repository="Xiaomi_Kernel_OpenSource"
_commit="1d1aedfe40b2f5fd06c783b752af0197f38966eb"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/MiCode/$_repository/archive/$_commit.tar.gz
$_config
fix_kernel_genheaders.patch
fix_broken_inline_functions.patch
primary_display_fix.patch
add-mt6768-dtb.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}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
if [ -f "$_outdir"/arch/arm64/boot/Image ]; then
rm "$_outdir"/arch/arm64/boot/Image
fi
mv "$_outdir"/arch/arm64/boot/Image.gz "$_outdir"/arch/arm64/boot/Image
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
make dtbs_install O="$_outdir" ARCH="$_carch" \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
# We also need to convert the kernel DTB into a proper android dtb image with the 64-byte header
mv "$pkgdir"/boot/dtbs/mediatek/mt6768.dtb "$pkgdir"/boot/dtbs/mediatek/mt6768.dtb.bak
mkdtboimg create "$pkgdir"/boot/dtbs/mediatek/mt6768.dtb "$pkgdir"/boot/dtbs/mediatek/mt6768.dtb.bak
rm "$pkgdir"/boot/dtbs/mediatek/mt6768.dtb.bak
}
sha512sums="
d90442e481e6e9589e4e758e095cb246e427fe89607a8b83e2d93f821df0ab1ef71596acd54a08a9cdd1d811fbf2fdc9220d2c40fc3399b0b44b7463076ed33b linux-xiaomi-fire-1d1aedfe40b2f5fd06c783b752af0197f38966eb.tar.gz
45b743eafd5c4eb6aeaaec24df1a7e531f21d0d5a6ea52668f389fd6a6870b381113f8d4755c80e5eb47298cab519c8f323b0480470156efddbcc2491e071dd5 config-xiaomi-fire.aarch64
e683d72073caf32864963b213d9210ad88e675eb5595028f916e6d15d6d4bdcea46e59f7e3615670c4a4e35e048dcee9b6e372559ee5126d243946439c9e3dbb fix_kernel_genheaders.patch
3c45e4748b03164b88780f20a86e21a79e81e5486a0d380226382c5ae40a23a36bd6ccfab4ed221b54a30015203e9ab22ea6876b7c6e166cf6b0c4bc6574ea79 fix_broken_inline_functions.patch
4829b15f0682d5d016da83e44b2b75b221c7415598cf5c4377490146ed7f6f36e7e037ae053698fefb922af293c4415f0409e68398d91285c68b35a87e0929a2 primary_display_fix.patch
580337b2ada8a2684ac5d1beddf8ecbaa23a3e36e21bdae8abc83ff25182c0324bbaf0eb7a05d0d81feb269508a243f087c0a11b8520e1f4251465a5c3a7481b add-mt6768-dtb.patch
"

View file

@ -0,0 +1,8 @@
--- a/arch/arm64/boot/dts/mediatek/Makefile 2024-02-12 20:15:23.410216868 +0300
+++ b/arch/arm64/boot/dts/mediatek/Makefile 2024-02-12 20:16:30.621493436 +0300
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_ARCH_MEDIATEK) += auto2712p1v1-ivi-boot.dtb
dtb-$(CONFIG_ARCH_MEDIATEK) += auto2712p1v1-ivi-nand-boot.dtb
-
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt6768.dtb

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,41 @@
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2362,7 +2362,7 @@
extern struct mutex uclamp_mutex;
unsigned long uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id);
-inline void uclamp_se_set(struct uclamp_se *uc_se,
+void uclamp_se_set(struct uclamp_se *uc_se,
unsigned int value, bool user_defined);
void
uclamp_update_active_tasks(struct cgroup_subsys_state *css,
--- a/include/linux/blk-crypto.h
+++ b/include/linux/blk-crypto.h
@@ -30,7 +30,7 @@
int blk_crypto_evict_key(struct request_queue *q,
const struct blk_crypto_key *key);
-inline void blk_crypto_flock(struct keyslot_manager *ksm, unsigned int flags);
+void blk_crypto_flock(struct keyslot_manager *ksm, unsigned int flags);
#else /* CONFIG_BLK_INLINE_ENCRYPTION */
@@ -45,7 +45,7 @@
return true;
}
-static inline void blk_crypto_flock(struct keyslot_manager *ksm,
+static void blk_crypto_flock(struct keyslot_manager *ksm,
unsigned int flags) {}
#endif /* CONFIG_BLK_INLINE_ENCRYPTION */
--- a/include/linux/keyslot-manager.h
+++ b/include/linux/keyslot-manager.h
@@ -98,7 +98,7 @@
unsigned int wrapped_key_size,
u8 *secret, unsigned int secret_size);
-inline void ksm_flock(struct keyslot_manager *ksm, unsigned int flags);
+void ksm_flock(struct keyslot_manager *ksm, unsigned int flags);
#endif /* CONFIG_BLK_INLINE_ENCRYPTION */

View file

@ -0,0 +1,29 @@
--- a/kernel/gen_kheaders.sh
+++ b/kernel/gen_kheaders.sh
@@ -8,7 +8,6 @@
outdir="$(pwd)"
tarfile=$1
cpio_dir=$outdir/$tarfile.tmp
-cpio=$KBUILD_SRC/tools/build/cpio
dir_list="
include/
@@ -59,7 +58,7 @@
pushd $srctree > /dev/null
for f in $dir_list;
do find "$f" -name "*.h";
-done | $cpio --quiet -pd $cpio_dir
+done | cpio --quiet -pd $cpio_dir
popd > /dev/null
@@ -67,7 +66,7 @@
# happen with out of tree builds. Just silence CPIO for now.
for f in $dir_list;
do find "$f" -name "*.h";
-done | $cpio --quiet -pd $cpio_dir >/dev/null 2>&1
+done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
# Remove comments except SDPX lines

View file

@ -0,0 +1,20 @@
--- a/drivers/misc/mediatek/video/mt6768/videox/primary_display.c 2024-02-12 12:22:54.865660409 +0300
+++ b/drivers/misc/mediatek/video/mt6768/videox/primary_display.c 2024-02-12 19:56:55.926758389 +0300
@@ -8636,7 +8636,7 @@
} else {
_cmdq_insert_wait_frame_done_token_mira(cmdq_handle_lcm_cmd);
disp_lcm_set_lcm_cmd(pgc->plcm, cmdq_handle_lcm_cmd, lcm_cmd,
- lcm_count, level);
+ lcm_count, &level);
_cmdq_flush_config_handle_mira(cmdq_handle_lcm_cmd, 1);
}
DISPCHECK("[CMD]%s ret=%d\n", __func__, ret);
@@ -8648,7 +8648,7 @@
_cmdq_insert_wait_frame_done_token_mira(cmdq_handle_lcm_cmd);
disp_lcm_set_lcm_cmd(pgc->plcm, cmdq_handle_lcm_cmd, lcm_cmd,
- lcm_count, level);
+ lcm_count, &level);
cmdqRecSetEventToken(cmdq_handle_lcm_cmd,
CMDQ_SYNC_TOKEN_CONFIG_DIRTY);
mmprofile_log_ex(ddp_mmp_get_events()->primary_set_cmd,