Skip to content
Snippets Groups Projects
Commit 1e452fbb authored by Iskren Chernev's avatar Iskren Chernev
Browse files

oneplus-billie2: new device (OnePlus Nord N100)

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.
parent 0f561503
No related branches found
No related tags found
No related merge requests found
Showing
with 6061 additions and 0 deletions
# 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"
# 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"
From 63ffb678357b8df70db7b6c36e85dd68d06141c8 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/8] Fix function definition
The current code was causing the compiler to complain about old-style
definition:
error: this old-style function definition is not preceded by
a prototype [-Werror,-Wstrict-prototypes]
Signed-off-by: Iskren Chernev <me@iskren.info>
---
drivers/oneplus/coretech/memplus/core/memplus_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/oneplus/coretech/memplus/core/memplus_core.c b/drivers/oneplus/coretech/memplus/core/memplus_core.c
index 1f351cacca2f1..c2262df2efb35 100755
--- a/drivers/oneplus/coretech/memplus/core/memplus_core.c
+++ b/drivers/oneplus/coretech/memplus/core/memplus_core.c
@@ -128,7 +128,7 @@ static inline bool current_is_gcd(void)
return current == gc_tsk;
}
-bool ctech_current_is_swapind() {
+bool ctech_current_is_swapind(void) {
return current == swapind_tsk;
}
--
2.30.1
From b0398ea6d9cfc476b24e1f9a261007eb81b075ec 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/8] 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
From 580eff984aef7745157ca68885cb1622e93d8a04 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Thu, 18 Feb 2021 15:11:04 +0200
Subject: [PATCH 3/8] Fix yylloc declaration
gcc 10 will default to -fno-common, which causes this error at link
time:
(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
This is because both dtc-lexer as well as dtc-parser define the same
global symbol yyloc. Before with -fcommon those were merged into one
defintion. The proper solution would be to to mark this as "extern",
Signed-off-by: Iskren Chernev <me@iskren.info>
---
scripts/dtc/dtc-lexer.l | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index 615b7ec6588f1..a26c7636c704f 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -38,7 +38,7 @@ LINECOMMENT "//".*\n
#include "srcpos.h"
#include "dtc-parser.tab.h"
-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
extern bool treesource_error;
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
--
2.30.1
From 6847044a47c0ab67240255082b24abac457a5c12 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Sat, 20 Feb 2021 00:49:45 +0200
Subject: [PATCH 4/8] 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
From 40afb896434f1ec59d88f2da24542545755bc583 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:22:17 +0200
Subject: [PATCH 5/8] 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
From 066eb995b48c7543f8e142d62693dad37cadae21 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:23:15 +0200
Subject: [PATCH 6/8] 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
From bb34739b961a064c8eb20a8bfd2795ff02aedab4 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:24:04 +0200
Subject: [PATCH 7/8] 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
From 963254f21a784effdfa7240a06dc42841e048400 Mon Sep 17 00:00:00 2001
From: Iskren Chernev <me@iskren.info>
Date: Mon, 22 Feb 2021 19:25:23 +0200
Subject: [PATCH 8/8] Fix function declarations that make gcc unhappy
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 c2262df2efb35..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(void) {
+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
# 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-definition.patch
0002-Fix-dangerous-relocation.patch
0003-Fix-yylloc-declaration.patch
0004-Remove-gcc-python-wrapper.patch
0005-Fix-reading-after-array-end.patch
0006-Remove-inline-from-external-functions.patch
0007-Suppress-error-about-static-buffer-overflow.patch
0008-Fix-function-declarations-that-make-gcc-unhappy.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
3facad28b1b3aa806597418e25ff616deeef42755c0fa6593148e5d0abe0ccdc7b6ecdce9ad5a0e766d91c302d2c148005da1bd23bde74257f9cc4e705ae5f1f 0001-Fix-function-definition.patch
09ec2587a7f33dcf90da4e622fddad8a5d82e195f14f73b5d1a3fc709997e89a609a66f39da0b1dc3adcbd1cc90866d8c259e372d7becb1e9ea4974535417cc5 0002-Fix-dangerous-relocation.patch
9a806549402b55abeb2e1b1290a9abfc296dbf69522cfaedb0de2e5f69998f6423c10815956aa11516640112d948a4f53225a73f68fe4b2e16b2525ae7b9bd31 0003-Fix-yylloc-declaration.patch
81e835d26edc1d002419adaab277611dc3f426123db789e49fb0352e6e4337d85fa0992078a862de3cf845c42afc2327bb60ceaf112c3368bc11421c0431d479 0004-Remove-gcc-python-wrapper.patch
85c593add3d4e08c8606e0c237cd178be4f7954fe03c49a83148492d08e0b6134ed2e55fe86155338e15d2264a3cccb7a926bb46accefa4bcc17a725c9dc9175 0005-Fix-reading-after-array-end.patch
3a760a8d7fd9c5016b126496000fa7b752d5618bdaab0ce471eb0001fd1761adf937451eb8f0a08815b33b9feeed2a4b4b2ce80e62e71f451b69235f8eccf39d 0006-Remove-inline-from-external-functions.patch
7685962ce71d83329e6f11ec09db0ba3436105c068fc2bf45ffb9542900c06be858f903a179035108cce356afc34b24d4d480229bf1154f820f82c9f30f86eb9 0007-Suppress-error-about-static-buffer-overflow.patch
afde9baa05c9d454802c8a07d4a539342eb65ed4b6201d6b86118fe010f31a81bb5116d6fefb9b9f4cd655a1161f549d7b5538ccc476cad40f1e92945479370b 0008-Fix-function-declarations-that-make-gcc-unhappy.patch"
This diff is collapsed.
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