Skip to content
Snippets Groups Projects
Commit 3d9f6fd7 authored by Natalia M. Sother's avatar Natalia M. Sother
Browse files

xiaomi-merlin: new device

parent 46da640a
No related branches found
No related tags found
No related merge requests found
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-merlin
pkgdesc="Xiaomi Redmi Note 9"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-xiaomi-merlin
mkbootimg
postmarketos-base
msm-fb-refresher
"
makedepends="devicepkg-dev"
source="
deviceinfo
modules-initfs
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
06d213071f7c319519327c3c9a1b2197a1fa2c9e2390179de22eace6a4c1ef764d946d3a4bae6ea8732d6891b472dc7df13319affadd995594e57f5d6141bc50 deviceinfo
e70bae17df23dcaaaea0e2d3616556f04baa23f8ee1357785c0f539bf97282d8ddff53953e155b72689bb73beb38c2da3d08de2a61e866684edfa10a6593885d modules-initfs
"
# 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 Note 9"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-merlin"
deviceinfo_year="2020"
deviceinfo_dtb="mediatek/mt6768"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="2340"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="bootopt=64S3,32N2,64N2 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"
# Remove this file if unnecessary (CHANGEME!)
# This file shall contain a list of modules to be included in the initramfs,
# so that they are available in early boot stages. In general, it should
# include modules to support unlocking FDE (touchscreen, panel, etc),
# USB networking, and telnet in the debug-shell.
# The format is one module name per line. Lines starting with the character
# '#', and empty lines are ignored. If there are multiple kernel variants
# with different initramfs module requirements, one modules-initfs.$variant
# file should be created for each of them.
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/(CHANGEME!)
pkgname=linux-xiaomi-merlin
pkgver=4.14.320
pkgrel=0
pkgdesc="Xiaomi Redmi Note 9 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-merlin"
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
dtc
"
# Source
_repository="android_kernel_xiaomi_mt6768"
_commit="210ab80b747a65c0a47c0ac59f117e6201fe2374"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
$_config
selinux_include_generated_headers.patch
use_system_cpio.patch
stop-inlining-blk_crypto_flock-and-ksm_flock.patch
use_system_dtc.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() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
make dtbs_install O="$_outdir" ARCH="$_carch" \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
}
sha512sums="
0e1e39e6b96f93ee6a4ccee2e3fc1821187a75bafc28ab68452f0e83ef6043a1ee9ea4c92ecd5e9b58e1711b5bd18110e6f45fa184caa3b7fc9ee2953703ad5d linux-xiaomi-merlin-210ab80b747a65c0a47c0ac59f117e6201fe2374.tar.gz
402a9fe0f0257df1962fd7f2cc1672dad27ff954477bff918adee1f4aed9d1901488f641f355cd5fc5b1d9a750baf4e4c7c842a4dd6b25724a364a4d52466bce config-xiaomi-merlin.aarch64
6ab9db01d35f7f5cc2c19ebe5f65a7dc479a1c68de587300cdde9a6c759d34610666c72f0f321cd450cf56c13df3b54a774e0f7ebdbf0f8608fbfd66b49d04e7 selinux_include_generated_headers.patch
28975f5aac872eab10bdfe2b29a8685b70ddb0d105c6c66a26de88ac912573b430fa20901b65384c9cb99d9740cdff7804cfd95474176f93a5bffbccf8182208 use_system_cpio.patch
e448a1093c09414be36333fbdb0d4a3bc5b59018d571b702c6607cb32927cf1563bf03aa1f2d502e6040490e0b26198dd8204306ebaad41be810ba2d47a2721c stop-inlining-blk_crypto_flock-and-ksm_flock.patch
c9e562403cd572c66def9adea434731b77617f7561f1ce1079e21e8f02e8fd9cc1febd7e52c581e8e4b1c4aca21c5ca8c5813d2006be13051048d681a640ab3d use_system_dtc.patch
"
This diff is collapsed.
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
Fixes the following build errors under GCC 11:
In file included from ../block/blk-crypto.c:14:
../block/blk-crypto.c: In function 'blk_crypto_flock':
../include/linux/keyslot-manager.h:101:13: error: inlining failed in call to 'always_inline' 'ksm_flock': function body not available
101 | inline void ksm_flock(struct keyslot_manager *ksm, unsigned int flags);
| ^~~~~~~~~
../block/blk-crypto.c:310:9: note: called from here
310 | ksm_flock(ksm, flags);
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/md/dm.c:27:
../drivers/md/dm.c: In function 'dm_derive_raw_secret_callback':
../include/linux/blk-crypto.h:35:13: error: inlining failed in call to 'always_inline' 'blk_crypto_flock': function body not available
35 | inline void blk_crypto_flock(struct keyslot_manager *ksm, unsigned int flags);
| ^~~~~~~~~~~~~~~~
../drivers/md/dm.c:2120:17: note: called from here
2120 | blk_crypto_flock(dev->bdev->bd_queue->ksm, SINGLE_DEPTH_NESTING);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
diff --git a/block/blk-crypto.c b/block/blk-crypto.c
index f15ed0b70ecd..703700d9bf9d 100644
--- a/block/blk-crypto.c
+++ b/block/blk-crypto.c
@@ -305,7 +305,7 @@ int blk_crypto_evict_key(struct request_queue *q,
}
EXPORT_SYMBOL_GPL(blk_crypto_evict_key);
-inline void blk_crypto_flock(struct keyslot_manager *ksm, unsigned int flags)
+void blk_crypto_flock(struct keyslot_manager *ksm, unsigned int flags)
{
ksm_flock(ksm, flags);
}
diff --git a/block/keyslot-manager.c b/block/keyslot-manager.c
index 1ce66f66af20..95afcd9c4874 100644
--- a/block/keyslot-manager.c
+++ b/block/keyslot-manager.c
@@ -681,7 +681,7 @@ EXPORT_SYMBOL_GPL(keyslot_manager_derive_raw_secret);
* detection, set another lock sub-class could avoid it.
*
*/
-inline void ksm_flock(struct keyslot_manager *ksm, unsigned int flags)
+void ksm_flock(struct keyslot_manager *ksm, unsigned int flags)
{
ksm->lock_flags = flags;
}
diff --git a/include/linux/blk-crypto.h b/include/linux/blk-crypto.h
index 43d0dbbeb70f..30ba27226a22 100644
--- a/include/linux/blk-crypto.h
+++ b/include/linux/blk-crypto.h
@@ -32,7 +32,7 @@ int blk_crypto_start_using_mode(enum blk_crypto_mode_num crypto_mode,
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 */
diff --git a/include/linux/keyslot-manager.h b/include/linux/keyslot-manager.h
index e247be8a5d43..dfb1d97d8fb6 100644
--- a/include/linux/keyslot-manager.h
+++ b/include/linux/keyslot-manager.h
@@ -98,7 +98,7 @@ int keyslot_manager_derive_raw_secret(struct keyslot_manager *ksm,
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 */
--- a/kernel/gen_kheaders.sh
+++ b/kernel/gen_kheaders.sh
@@ -8,7 +8,7 @@
outdir="$(pwd)"
tarfile=$1
cpio_dir=$outdir/$tarfile.tmp
-cpio=$KBUILD_SRC/tools/build/cpio
+cpio=cpio
dir_list="
include/
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b442d12ff2fe..5fe57a7d5320 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -312,7 +312,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 \
+ dtc -@ -O dtb -o $@ -b 0 \
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
--
2.36.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment