motorola-odessa: new device (Motorola Moto G9 Plus) (MR 2224)

[ci:skip-build] Already built on CI in MR
This commit is contained in:
YSpoof 2021-06-05 13:00:29 -03:00 committed by Alexey Minnekhanov
parent 501c888dc8
commit 2f6eea09ac
No known key found for this signature in database
GPG key ID: EBF5ECFFFEE34DED
10 changed files with 6455 additions and 0 deletions

View file

@ -0,0 +1,33 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-motorola-odessa
pkgdesc="Motorola Moto G9 Plus"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-motorola-odessa
mesa-dri-gallium
mkbootimg
postmarketos-base
"
makedepends="
devicepkg-dev
"
source="
deviceinfo
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
f8654bd5759234f9485b6d6d8c73e5f22ec751a61fe8bd63720457d2b4a718d6346c7d80e39bd22db8f70e6d4a9c339f46eb2e25e54f14b42f1935885dee0cb6 deviceinfo
"

View file

@ -0,0 +1,35 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Motorola Moto G9 Plus"
deviceinfo_manufacturer="Motorola"
deviceinfo_codename="motorola-odessa"
deviceinfo_year="2020"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="2400"
deviceinfo_no_framebuffer="true"
deviceinfo_getty="ttyMSM0;115200"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=ttyMSM0,115200,n8 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=1 earlycon=msm_geni_serial,0x4a90000 cgroup.memory=nokmem,nosocket androidboot.usbcontroller=4e00000.dwc3 printk.devkmsg=on firmware_class.path=/vendor/firmware_mnt/image androidboot.fastboot=1 androidboot.selinux=permissive buildvariant=eng"
deviceinfo_generate_bootimg="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"

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,73 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/vendor/odessa_defconfig
pkgname=linux-motorola-odessa
pkgver=4.14.117
pkgrel=0
pkgdesc="Motorola Moto G9 Plus kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="motorola-odessa"
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
linux-headers
linux-pam
perl
"
# Source
_repository="android_kernel_motorola_sm6150"
_commit="b228c78f7fdab52fd42893afd6f6838e1e31cd6f"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/sm6150-motorola/$_repository/archive/$_commit.tar.gz
$_config
0006-Suppress-error-about-static-buffer-overflow.patch
dsi-staging-fix-duplicate-static.patch
fix_ipa_buf_size_mismatch.patch
net-phy-micrel-Use-strlcpy-for-ethtool-get_strings.patch
remove_bootloader_cmdline_opts.patch
use-rgba8888-color-mode.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"
#Install Kernel Modules
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
INSTALL_MOD_PATH="$pkgdir" modules_install
}
sha512sums="
cef3e5b5f73fbec135ba99e838a303df56ea24a21337a7ffcefcc0b92c113083f942cc15bfdecdf786b41d24dfe77f9215aa14e23c56fe938356fe03058c1213 linux-motorola-odessa-b228c78f7fdab52fd42893afd6f6838e1e31cd6f.tar.gz
ea6596cd86fd740c79f65c67050f8f492c2720ad3f74436656b35500bf272d0436f4f1082a010151fb8f45cd085272b9ec837b60e116623e4fb150f69055123a config-motorola-odessa.aarch64
3835f7e4fca12aaba82fe21cc9632f0e569a8c4405231d137aea4f2640190d919e1a44612082decfbaaa41faa3c6a3ff0442086afb81d59c984a5697fdb9cac9 0006-Suppress-error-about-static-buffer-overflow.patch
45cd1dded5c56c93aa80a016ec9a96098633d6b38a02f2614cc0d96737409c24230d22eaaf8a244ce5d2eef07fb34cddcb06aea87e4b7805138cb5ac8c62f7cf dsi-staging-fix-duplicate-static.patch
592d87cbb9532e0311a9d23bc10bdbae9859709993e7b88a7202cd7023e8cc3fcdaa1810a2171771222df2ead44b8de048cb5b10b5088f44607d7c7c5b15da1b fix_ipa_buf_size_mismatch.patch
b081e9bfb3eb3f024486de2952d4b0dc6c81facb31ddf4456b386fb5c043a3a11cefe1636dece5cf0ea655746ed35a79c8318cabba8661e39c580e6faed97ba7 net-phy-micrel-Use-strlcpy-for-ethtool-get_strings.patch
9ce867c4254b537ef5d2485780c26b72da8a3a8767ba71557f3b48d6c550e0e14c8c3e575b31bf65d2878f08a8a4926e48a1c2f1be534bf80a7a57f58313b0fd remove_bootloader_cmdline_opts.patch
d64746ff65de81cc894e33cd8f9b3bf0a5ee9e979d95f67a50a4c0bc7072aa459632841db4b64b68cfc01fa3503d2e8122d03f177932a5f0fbe0ddad5db3bb4d use-rgba8888-color-mode.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
---
drivers/gpu/drm/msm/dsi-staging/dsi_display_mot_ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff a/drivers/gpu/drm/msm/dsi-staging/dsi_display_mot_ext.c b/drivers/gpu/drm/msm/dsi-staging/dsi_display_mot_ext.c
--- a/drivers/gpu/drm/msm/dsi-staging/dsi_display_mot_ext.c
+++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display_mot_ext.c
@@ -40,1 +40,1 @@
-static static struct alarm *g_wakeup_timer = NULL;
+static struct alarm *g_wakeup_timer = NULL;
--

View file

@ -0,0 +1,13 @@
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c
index ce536940a3bc..ea9f19880eb5 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c
@@ -5934,7 +5934,7 @@ static ssize_t ipa3_write(struct file *file, const char __user *buf,
if (sizeof(dbg_buff) < count + 1)
return -EFAULT;
- missing = copy_from_user(dbg_buff, buf, count);
+ missing = copy_from_user(dbg_buff, buf, sizeof(buf));
if (missing) {
IPAERR("Unable to copy data from user\n");

View file

@ -0,0 +1,39 @@
From 1f7d62fdd8dd974808c4c4c5dcc35b908d92cb3b Mon Sep 17 00:00:00 2001
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 2 Mar 2018 15:08:38 -0800
Subject: [PATCH] net: phy: micrel: Use strlcpy() for ethtool::get_strings
commit 55f53567afe5f0cd2fd9e006b174c08c31c466f8 upstream.
Our statistics strings are allocated at initialization without being
bound to a specific size, yet, we would copy ETH_GSTRING_LEN bytes using
memcpy() which would create out of bounds accesses, this was flagged by
KASAN. Replace this with strlcpy() to make sure we are bound the source
buffer size and we also always NUL-terminate strings.
Fixes: 2b2427d06426 ("phy: micrel: Add ethtool statistics counters")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/phy/micrel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 5be7fc354e33..ef5e5b621ec5 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -674,8 +674,8 @@ static void kszphy_get_strings(struct phy_device *phydev, u8 *data)
int i;
for (i = 0; i < ARRAY_SIZE(kszphy_hw_stats); i++) {
- memcpy(data + i * ETH_GSTRING_LEN,
- kszphy_hw_stats[i].string, ETH_GSTRING_LEN);
+ strlcpy(data + i * ETH_GSTRING_LEN,
+ kszphy_hw_stats[i].string, ETH_GSTRING_LEN);
}
}
--
2.29.2

View file

@ -0,0 +1,80 @@
From 92e3310d2db157deacb86ef5db8c8c8d38251312 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Wed, 11 Sep 2019 21:51:40 +0300
Subject: [PATCH 3/6] Add config option to fix bootloader cmdline args
Android bootloader passes some arguments in kernel command
line, that make booting custom OSes harder:
* skip_initramfs
* root=PARTUUID=...
* init=/init
Those parameters override default boot partition to hardcoded,
set init binary to /init, disable booting from initramfs.
If enabled, those parameters will be erased from bootloader's
command line, and custom OS can boot the way it likes.
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
arch/arm64/Kconfig | 17 +++++++++++++++++
drivers/of/fdt.c | 14 ++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2829edba6aa5..bd9f05f83c7e 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1125,6 +1125,23 @@ config CMDLINE_FORCE
command-line options your boot loader passes to the kernel.
endchoice
+config CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ bool "Drop certain dangerous options from cmdline"
+ default n
+ help
+ Android bootloader passes some arguments in kernel command
+ line, that make booting custom OSes harder:
+
+ * skip_initramfs
+ * root=PARTUUID=...
+ * init=/init
+
+ Those parameters override default boot partition to hardcoded,
+ set init binary to /init, disable booting from initramfs.
+
+ If enabled, those parameters will be erased from bootloader's
+ command line, and custom OS can boot the way it likes.
+
config EFI_STUB
bool
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ca175710c4c8..fd8257589648 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1012,6 +1012,20 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
pr_debug("Command line is: %s\n", (char*)data);
+#ifdef CONFIG_CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ pr_err("Replacing dangerous cmdline options...");
+ cmdline = strstr((const char *)data, "skip_initramfs");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "root=");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "init=");
+ if (cmdline)
+ *cmdline = '_';
+ pr_err("Command line now is: %s\n", (char*)data);
+#endif
+
/* break now */
return 1;
}
--
2.24.1

View file

@ -0,0 +1,42 @@
This is needed for the display to display colors correctly.
---
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index 075ee8a3880..b4531f66a06 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -868,7 +868,8 @@ static int mdss_fb_probe(struct platform_device *pdev)
mfd->bl_scale = 1024;
mfd->bl_min_lvl = 30;
mfd->ad_bl_level = 0;
- mfd->fb_imgType = MDP_RGBA_8888;
+ // Default framebuffer format.
+ mfd->fb_imgType = MDP_BGRA_8888;
mfd->calib_mode_bl = 0;
if (mfd->panel.type == MIPI_VIDEO_PANEL ||
@@ -2143,6 +2144,25 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
bpp = 4;
break;
+ case MDP_BGRA_8888:
+ fix->type = FB_TYPE_PACKED_PIXELS;
+ fix->xpanstep = 1;
+ fix->ypanstep = 1;
+ var->vmode = FB_VMODE_NONINTERLACED;
+ var->blue.offset = 0;
+ var->green.offset = 8;
+ var->red.offset = 16;
+ var->blue.length = 8;
+ var->green.length = 8;
+ var->red.length = 8;
+ var->blue.msb_right = 0;
+ var->green.msb_right = 0;
+ var->red.msb_right = 0;
+ var->transp.offset = 24;
+ var->transp.length = 8;
+ bpp = 4;
+ break;
+
case MDP_YCRYCB_H2V1:
fix->type = FB_TYPE_INTERLEAVED_PLANES;
fix->xpanstep = 2;