From b5c6a70b55bb1d16e639473c91691ad522b4d59c Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Thu, 14 Oct 2021 13:27:49 +0100
Subject: [PATCH] linux-raspberrypi: Provide/backport a 5.10.63 version

This was done to support OTA which in turn takes advantage of the
tryboot functionality.

It also unifies the kernel version as per the project's requirements.

Related: https://git.ostc-eu.org/OSTC/OHOS/meta-ohos/-/issues/159
Related: https://git.ostc-eu.org/OSTC/OHOS/manifest/-/issues/74

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../linux/linux-raspberrypi/android-drivers.cfg   |  8 ++++++++
 .../linux/linux-raspberrypi/powersave.cfg         | 13 +++++++++++++
 .../linux/linux-raspberrypi_5.10.bb               | 13 +++++++++++++
 .../linux/linux-raspberrypi_5.10.inc              | 15 +++++++++++++++
 4 files changed, 49 insertions(+)
 create mode 100644 meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/android-drivers.cfg
 create mode 100644 meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/powersave.cfg
 create mode 100644 meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb
 create mode 100644 meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.inc

diff --git a/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/android-drivers.cfg b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/android-drivers.cfg
new file mode 100644
index 00000000..f74ac0e1
--- /dev/null
+++ b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/android-drivers.cfg
@@ -0,0 +1,8 @@
+CONFIG_ANDROID=y
+
+#CONFIG_ANDROID_BINDERFS is not set
+CONFIG_ANDROID_BINDER_IPC=y
+CONFIG_ANDROID_BINDER_DEVICES="binder"
+
+CONFIG_ASHMEM=y
+
diff --git a/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/powersave.cfg b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/powersave.cfg
new file mode 100644
index 00000000..9c48eff1
--- /dev/null
+++ b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi/powersave.cfg
@@ -0,0 +1,13 @@
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_HIBERNATE_CALLBACKS=y
+CONFIG_HIBERNATION=y
+CONFIG_PM_STD_PARTITION="/dev/mmcblk0p2"
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_AUTOSLEEP=y
+CONFIG_PM_WAKELOCKS=y
+CONFIG_PM_WAKELOCKS_LIMIT=100
+CONFIG_PM_WAKELOCKS_GC=y
+CONFIG_PM_GENERIC_DOMAINS_SLEEP=y
+CONFIG_ARCH_HIBERNATION_HEADER=y
diff --git a/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb
new file mode 100644
index 00000000..0adf8cec
--- /dev/null
+++ b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb
@@ -0,0 +1,13 @@
+LINUX_VERSION ?= "5.10.63"
+LINUX_RPI_BRANCH ?= "rpi-5.10.y"
+LINUX_RPI_KMETA_BRANCH ?= "yocto-5.10"
+
+SRCREV_machine = "4117cba235d24a7c4630dc38cb55cc80a04f5cf3"
+SRCREV_meta = "e0147386e9f3c4cabc6f6d256d457fd4e67eb221"
+
+require linux-raspberrypi_5.10.inc
+
+SRC_URI += "\
+    file://powersave.cfg \
+    file://android-drivers.cfg \
+    "
diff --git a/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.inc b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.inc
new file mode 100644
index 00000000..fd7c93cf
--- /dev/null
+++ b/meta-ohos-core/recipes-kernel/linux/linux-raspberrypi_5.10.inc
@@ -0,0 +1,15 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"
+
+KMETA = "kernel-meta"
+
+SRC_URI = " \
+    git://github.com/raspberrypi/linux.git;name=machine;branch=${LINUX_RPI_BRANCH} \
+    git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${LINUX_RPI_KMETA_BRANCH};destsuffix=${KMETA} \
+    "
+SRC_URI_remove = "file://rpi-kernel-misc.cfg"
+
+require recipes-kernel/linux/linux-raspberrypi.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
+
+KERNEL_EXTRA_ARGS_append_rpi = " DTC_FLAGS='-@ -H epapr'"
-- 
GitLab