oneplus-billie2: new device (OnePlus Nord N100) (MR 1989)

So far the debug-shell in initfs works. The device uses dynamic
partitions, so that has to be figured out to get a proper rootfs.

One thing to look out for is that mount_subpartitions task in initfs
hangs, so pmos_boot=sth was added to kernel cmdline to skip it. This is
also related to dynamic partitions, anyway.

[ci:skip-build] Already built on CI
This commit is contained in:
Iskren Chernev 2021-02-25 15:59:17 +02:00 committed by Alexey Min
parent f65516e2cf
commit d8ac6e9a35
No known key found for this signature in database
GPG key ID: EBF5ECFFFEE34DED
11 changed files with 5997 additions and 0 deletions

View file

@ -0,0 +1,22 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-oneplus-billie2
pkgdesc="OnePlus Nord N100"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-oneplus-billie2 mkbootimg"
makedepends="devicepkg-dev"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="ff8ad6324809de35a146bd3186ba5c607a56bb6bf2c279987a958afdcda7899a640fe1147b7faf242ad18f3d5af368c43cc4ece5847912f9f8cd3d2daf1e6467 deviceinfo"

View file

@ -0,0 +1,36 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="OnePlus Nord N100"
deviceinfo_manufacturer="OnePlus"
deviceinfo_codename="oneplus-billie2"
deviceinfo_year="2020"
deviceinfo_dtb="bengal-qrd"
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1600"
deviceinfo_no_framebuffer="true"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=2048 loop.max_part=7 buildvariant=user pmos_boot=dont_mount_subpartitions"
deviceinfo_generate_bootimg="true"
deviceinfo_append_dtb="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="4096"
deviceinfo_flash_fastboot_partition_vbmeta="vbmeta"

View file

@ -0,0 +1,63 @@
From 857d33abc880163966fcbbfc05da69bd681ea161 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Thu, 18 Feb 2021 14:59:40 +0200
Subject: [PATCH 1/6] Fix function declarations
- Functions without args, should be declared f(void) [for clang]
- Add missing return type [for gcc]
- Add static to a few places [for gcc]
Signed-off-by: Iskren Chernev <me@iskren.info>
---
drivers/oneplus/coretech/control_center/control_center.c | 2 +-
drivers/oneplus/coretech/memplus/core/memplus_core.c | 4 ++--
drivers/power/oneplus/charger_ic/oneplus_battery_pmi632.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/oneplus/coretech/control_center/control_center.c b/drivers/oneplus/coretech/control_center/control_center.c
index 1d9c22cea1ea4..9d49af5d2e278 100644
--- a/drivers/oneplus/coretech/control_center/control_center.c
+++ b/drivers/oneplus/coretech/control_center/control_center.c
@@ -295,7 +295,7 @@ static struct list_head cc_pending_list;
static DEFINE_SPINLOCK(cc_async_lock);
static struct workqueue_struct *cc_wq;
-extern cc_cal_next_freq_with_extra_util(
+extern unsigned cc_cal_next_freq_with_extra_util(
struct cpufreq_policy *pol, unsigned int next_freq);
extern void clk_get_ddr_freq(u64* val);
static void cc_queue_rq(struct cc_command *cc);
diff --git a/drivers/oneplus/coretech/memplus/core/memplus_core.c b/drivers/oneplus/coretech/memplus/core/memplus_core.c
index 1f351cacca2f1..9bd0d155587b6 100755
--- a/drivers/oneplus/coretech/memplus/core/memplus_core.c
+++ b/drivers/oneplus/coretech/memplus/core/memplus_core.c
@@ -128,11 +128,11 @@ static inline bool current_is_gcd(void)
return current == gc_tsk;
}
-bool ctech_current_is_swapind() {
+static bool ctech_current_is_swapind(void) {
return current == swapind_tsk;
}
-bool ctech_memplus_check_isolate_page(struct page*page)
+static bool ctech_memplus_check_isolate_page(struct page*page)
{
return (memplus_enabled() && (!PageSwapCache(page) || PageWillneed(page)));
}
diff --git a/drivers/power/oneplus/charger_ic/oneplus_battery_pmi632.c b/drivers/power/oneplus/charger_ic/oneplus_battery_pmi632.c
index 4ccd81bd8aa38..6a00d21ad76e4 100755
--- a/drivers/power/oneplus/charger_ic/oneplus_battery_pmi632.c
+++ b/drivers/power/oneplus/charger_ic/oneplus_battery_pmi632.c
@@ -14099,7 +14099,7 @@ static int oneplus_chg_get_charger_subtype(void)
return CHARGER_SUBTYPE_DEFAULT;
}
-static int oneplus_set_qc_config()
+static int oneplus_set_qc_config(void)
{
return 0;
}
--
2.30.1

View file

@ -0,0 +1,39 @@
From 8ad6ace96fbe7aba0846872cb18120b76a505bf5 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Thu, 18 Feb 2021 15:05:50 +0200
Subject: [PATCH 2/6] Fix dangerous relocation
Without this fix the linker complains:
WARNING: EXPORT symbol "gsi_write_channel_scratch" [vmlinux] version generation failed, symbol will not be versioned.
aarch64-linux-gnu-ld: warning: -z norelro ignored
aarch64-linux-gnu-ld: drivers/platform/msm/gsi/gsi.o: relocation R_AARCH64_ABS32 against `__crc_gsi_write_channel_scratch' can not be used when making a shared object
drivers/platform/msm/gsi/gsi.o:(.data+0x0): dangerous relocation: unsupported relocation
drivers/platform/msm/gsi/gsi.o:(.data+0x28): dangerous relocation: unsupported relocation
drivers/platform/msm/gsi/gsi.o:(.data+0x50): dangerous relocation: unsupported relocation
make[1]: *** [/home/iskren/src/pmos/android_kernel_samsung_msm8974/Makefile:1124: vmlinux] Error 1
The problem is actually that genksyms doesn't understand __packed in
function return type.
Signed-off-by: Iskren Chernev <me@iskren.info>
---
drivers/platform/msm/gsi/gsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c
index 391ff6f0325c0..793d253442f36 100644
--- a/drivers/platform/msm/gsi/gsi.c
+++ b/drivers/platform/msm/gsi/gsi.c
@@ -2620,7 +2620,7 @@ static void __gsi_read_channel_scratch(unsigned long chan_hdl,
gsi_ctx->per.ee));
}
-static union __packed gsi_channel_scratch __gsi_update_mhi_channel_scratch(
+static union gsi_channel_scratch __gsi_update_mhi_channel_scratch(
unsigned long chan_hdl, struct __packed gsi_mhi_channel_scratch mscr)
{
union __packed gsi_channel_scratch scr;
--
2.30.1

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,29 @@
From f994379fff7e7208559d3cdb195b6751155f5d79 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:22:17 +0200
Subject: [PATCH 4/6] Fix reading after array end
Signed-off-by: Iskren Chernev <me@iskren.info>
---
.../oneplus_touchscreen/ilitek/ilitek9882n/ili9882n_qcom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/oneplus_touchscreen/ilitek/ilitek9882n/ili9882n_qcom.c b/drivers/input/touchscreen/oneplus_touchscreen/ilitek/ilitek9882n/ili9882n_qcom.c
index 31d1eee8f1f86..7c6054e60bfaf 100755
--- a/drivers/input/touchscreen/oneplus_touchscreen/ilitek/ilitek9882n/ili9882n_qcom.c
+++ b/drivers/input/touchscreen/oneplus_touchscreen/ilitek/ilitek9882n/ili9882n_qcom.c
@@ -258,10 +258,10 @@ static int ili_spi_pll_clk_wakeup(void)
wdata[1] = wlen >> 8;
wdata[2] = wlen & 0xff;
index = 3;
- wlen += index;
ipio_memcpy(&wdata[index], wakeup, wlen, wlen);
+ wlen += index;
ILI_INFO("Write dummy to wake up spi pll clk\n");
if (ilits->spi_write_then_read(ilits->spi, wdata, wlen, NULL, 0) < 0) {
ILI_INFO("spi slave write error\n");
--
2.30.1

View file

@ -0,0 +1,51 @@
From c9b57d68eb48b1f9626e82d45313466b4b3e4a15 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:23:15 +0200
Subject: [PATCH 5/6] Remove inline from external functions
Signed-off-by: Iskren Chernev <me@iskren.info>
---
fs/f2fs/f2fs.h | 4 ++--
fs/f2fs/segment.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 76f02a621ed95..016be262190d2 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3802,8 +3802,8 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
extern int f2fs_odiscard_enable;
-extern inline void wake_up_odiscard_of2fs(struct f2fs_sb_info *sbi);
-extern inline void wake_up_otrim_of2fs(struct f2fs_sb_info *sbi);
+extern void wake_up_odiscard_of2fs(struct f2fs_sb_info *sbi);
+extern void wake_up_otrim_of2fs(struct f2fs_sb_info *sbi);
enum {
F2FS_TRIM_START,
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index bbd60419054f5..f8c95e94a58c1 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -5167,7 +5167,7 @@ static int select_discard_type_of2fs(struct f2fs_sb_info *sbi, int expect_discar
return DPOLICY_BG;
}
-inline void wake_up_odiscard_of2fs(struct f2fs_sb_info *sbi)
+void wake_up_odiscard_of2fs(struct f2fs_sb_info *sbi)
{
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
@@ -5178,7 +5178,7 @@ inline void wake_up_odiscard_of2fs(struct f2fs_sb_info *sbi)
}
-inline void wake_up_otrim_of2fs(struct f2fs_sb_info *sbi)
+void wake_up_otrim_of2fs(struct f2fs_sb_info *sbi)
{
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
--
2.30.1

View file

@ -0,0 +1,29 @@
From 672029f8923fd77543044cfcf680b2c0adc226dd Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:24:04 +0200
Subject: [PATCH 6/6] Suppress error about static buffer overflow
There is a check just before the function call to ensure there is enough
space.
Signed-off-by: Iskren Chernev <me@iskren.info>
---
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 1b900a27173be..d1e40689709ad 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;
--
2.30.1

View file

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

View file

@ -0,0 +1,71 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/vendor/bengal_defconfig
pkgname=linux-oneplus-billie2
pkgver=4.19.95
pkgrel=0
pkgdesc="OnePlus Nord N100 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="oneplus-billie2"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl linux-headers"
# Source
_repository="android_kernel_oneplus_sm4250"
_commit="6db26f433f9a8722d0858562804da13f3090bfd7"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/OnePlusOSS/$_repository/archive/$_commit.tar.gz
$_config
0001-Fix-function-declarations.patch
0002-Fix-dangerous-relocation.patch
0003-Remove-gcc-python-wrapper.patch
0004-Fix-reading-after-array-end.patch
0005-Remove-inline-from-external-functions.patch
0006-Suppress-error-about-static-buffer-overflow.patch
0007-linux4.17-gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
mkdir -p "$builddir/$_outdir"
cp "$srcdir/$_config" "$builddir"/"$_outdir"/.config
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
}
package() {
KERNEL_IMAGE_NAME=Image.gz downstreamkernel_package \
"$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
mkdir -p "$pkgdir/usr/share/dtb"
install -Dm644 "$_outdir/arch/arm64/boot/dts/vendor/20882/bengal-qrd.dtb" \
"$pkgdir/usr/share/dtb"
make O="$_outdir" \
ARCH="$_carch" \
INSTALL_MOD_STRIP=1 \
INSTALL_MOD_PATH="$pkgdir" \
modules_install
}
sha512sums="9995a00adeceb30d4a64421e17c85a8349fe674b8a20dc2462cf21af867197f23e62326f0948ca12b52c7cb954388a3767122cea85eb033ff9525e15aa5af9b5 linux-oneplus-billie2-6db26f433f9a8722d0858562804da13f3090bfd7.tar.gz
53d5c7e98bcf0621f15e249393a610f685c9c9b20086dd1d463ce3d6c85df9bb7bed229ba65b80f0b28951ec174981613a48fad0c9d07228b0ae861eac8b98f7 config-oneplus-billie2.aarch64
c6739758f857f3da23702e005b1ed11e30fa28981a4307fa8d5d7419931400c419c3bd0c2dcfb2c0aff8972e5a19125be5074597e094195315d8a760e373802a 0001-Fix-function-declarations.patch
39007dd285b502633c7bbf398acd6841a14fb6f5e0a3ad8570d31be77763b537b2352401701d67c53d36ddbf4068ee32446bf3b4ef9aa20c39f052ca491d2be4 0002-Fix-dangerous-relocation.patch
359f619b7aac5bab061311f0806018ed04ce96a2233584a507b14c50ce616dfbc1681dd465ca3f0182165a6fc6c7b87435615bd1bd93efe174b95deba071f5fc 0003-Remove-gcc-python-wrapper.patch
f8727c9c3b6c42ac921bd31fd05dc507e02a53c1c158fe7b67e75db482067b77ab9e2ffe33088c047a699b79642d6be1722d854cdf74cea6db5b46f586315bd0 0004-Fix-reading-after-array-end.patch
aba7ae12986a2df81c6993f369390c6b3f5586fa70ab747e03d59aaf08cb79482a44eab723aed4469e98cadea0f70912f4e67caaf67cc279e1dc85e485b93a0f 0005-Remove-inline-from-external-functions.patch
3835f7e4fca12aaba82fe21cc9632f0e569a8c4405231d137aea4f2640190d919e1a44612082decfbaaa41faa3c6a3ff0442086afb81d59c984a5697fdb9cac9 0006-Suppress-error-about-static-buffer-overflow.patch
27827877040007fc1c4c719f7e2e19e5c272d44972415cfc53feba0313d87e4074f8204bdb13cbc5fe21ea61bf595314b68f10c081e7b7bac3c888b60f008acf 0007-linux4.17-gcc10-extern_YYLOC_global_declaration.patch"

File diff suppressed because it is too large Load diff