From 0a2878cce1db653b707ba01b93d3050754ec203b Mon Sep 17 00:00:00 2001
From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
Date: Thu, 21 Oct 2021 10:51:46 +0000
Subject: [PATCH] linux: enable features recommended by RAUC

RAUC recommends using the "verity" format for update bundles.
Those put additional requirements on available kernel features.

Use configuration recommended by RAUC documentation setting:
CONFIG_{MD,BLK_DEV_{DM,LOOP},DM_VERITY,SQUASHFS}=y.

Closes: https://git.ostc-eu.org/distro/oniro/-/issues/157
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
---
 .../recipes-kernel/linux/linux-intel_%.bbappend       |  5 ++++-
 .../recipes-kernel/linux/linux-oniro-tweaks-all.inc   |  1 +
 .../recipes-kernel/linux/linux-raspberrypi_5.10.bb    |  1 +
 .../recipes-kernel/linux/linux-seco_%.bbappend        |  5 ++++-
 meta-oniro-core/recipes-kernel/linux/linux/rauc.cfg   | 11 +++++++++++
 5 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100644 meta-oniro-core/recipes-kernel/linux/linux/rauc.cfg

diff --git a/meta-oniro-core/recipes-kernel/linux/linux-intel_%.bbappend b/meta-oniro-core/recipes-kernel/linux/linux-intel_%.bbappend
index 04be9ac1..7d652faa 100644
--- a/meta-oniro-core/recipes-kernel/linux/linux-intel_%.bbappend
+++ b/meta-oniro-core/recipes-kernel/linux/linux-intel_%.bbappend
@@ -4,4 +4,7 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
 
-SRC_URI += "file://squashfs.cfg"
+SRC_URI += "\
+    file://squashfs.cfg \
+    file://rauc.cfg \
+    "
diff --git a/meta-oniro-core/recipes-kernel/linux/linux-oniro-tweaks-all.inc b/meta-oniro-core/recipes-kernel/linux/linux-oniro-tweaks-all.inc
index 6c59f53c..85d4cf0e 100644
--- a/meta-oniro-core/recipes-kernel/linux/linux-oniro-tweaks-all.inc
+++ b/meta-oniro-core/recipes-kernel/linux/linux-oniro-tweaks-all.inc
@@ -18,6 +18,7 @@ SRC_URI += "file://hardening_memory.cfg"
 SRC_URI += "file://hardening_toolchain.cfg"
 SRC_URI += "file://hardening_usercopy.cfg"
 SRC_URI += "file://hardening_validation_checks.cfg"
+SRC_URI += "file://rauc.cfg"
 
 # For the gcc-plugins build of the kernel we need to ensure the right include
 # path for headers is picked up to use the natively build dependencies.
diff --git a/meta-oniro-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb b/meta-oniro-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb
index 0adf8cec..817870fe 100644
--- a/meta-oniro-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb
+++ b/meta-oniro-core/recipes-kernel/linux/linux-raspberrypi_5.10.bb
@@ -10,4 +10,5 @@ require linux-raspberrypi_5.10.inc
 SRC_URI += "\
     file://powersave.cfg \
     file://android-drivers.cfg \
+    file://rauc.cfg \
     "
diff --git a/meta-oniro-core/recipes-kernel/linux/linux-seco_%.bbappend b/meta-oniro-core/recipes-kernel/linux/linux-seco_%.bbappend
index 04be9ac1..7d652faa 100644
--- a/meta-oniro-core/recipes-kernel/linux/linux-seco_%.bbappend
+++ b/meta-oniro-core/recipes-kernel/linux/linux-seco_%.bbappend
@@ -4,4 +4,7 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
 
-SRC_URI += "file://squashfs.cfg"
+SRC_URI += "\
+    file://squashfs.cfg \
+    file://rauc.cfg \
+    "
diff --git a/meta-oniro-core/recipes-kernel/linux/linux/rauc.cfg b/meta-oniro-core/recipes-kernel/linux/linux/rauc.cfg
new file mode 100644
index 00000000..6df8e706
--- /dev/null
+++ b/meta-oniro-core/recipes-kernel/linux/linux/rauc.cfg
@@ -0,0 +1,11 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Enable support for RAUC verity bundle format.
+# https://rauc.readthedocs.io/en/v1.5.1/integration.html#kernel-configuration
+CONFIG_MD=y
+CONFIG_BLK_DEV_DM=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_DM_VERITY=y
+CONFIG_SQUASHFS=y
-- 
GitLab