From 13a04fa2decf6a58d3fda0802571b7cd3c11ddbe Mon Sep 17 00:00:00 2001
From: Frieder Schrempf <frieder.schrempf@kontron.de>
Date: Wed, 21 Dec 2022 12:53:46 +0100
Subject: [PATCH] meta-ktn-stm32mp: u-boot-stm32mp: Add legacy 2020.10 recipe

At the moment we don't want to upgrade to the 2021.10 version from
the OpenST Linux Kirkstone release. Therefore let's add a copy
of the legacy recipe from Dunfell for now.
---
 .../u-boot/u-boot-stm32mp-common_2020.10.inc  | 65 +++++++++++++++++++
 .../u-boot/u-boot-stm32mp_2020.10.bb          | 17 +++++
 .../u-boot/u-boot-stm32mp_2020.10.bbappend    |  4 --
 3 files changed, 82 insertions(+), 4 deletions(-)
 create mode 100644 layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp-common_2020.10.inc
 create mode 100644 layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bb

diff --git a/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp-common_2020.10.inc b/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp-common_2020.10.inc
new file mode 100644
index 00000000..6a971aa0
--- /dev/null
+++ b/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp-common_2020.10.inc
@@ -0,0 +1,65 @@
+# Adaptation from u-boot-common_${PV}.inc
+
+HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
+SECTION = "bootloaders"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025"
+
+DEPENDS += "dtc-native bc-native"
+DEPENDS += "flex-native bison-native"
+
+COMPATIBLE_MACHINE = "(stm32mpcommon)"
+
+SRC_URI = "git://github.com/u-boot/u-boot.git;protocol=https"
+SRCREV  = "050acee119b3757fee3bd128f55d720fdd9bb890"
+
+SRC_URI += "\
+    file://0001-ARM-v2020.10-stm32mp-r1-MACHINE.patch \
+    file://0002-ARM-v2020.10-stm32mp-r1-BOARD.patch \
+    file://0003-ARM-v2020.10-stm32mp-r1-MISC-DRIVERS.patch \
+    file://0004-ARM-v2020.10-stm32mp-r1-DEVICETREE.patch \
+    file://0005-ARM-v2020.10-stm32mp-r1-CONFIG.patch \
+    \
+    file://0006-ARM-v2020.10-stm32mp-r1.1.patch \
+    file://0007-ARM-v2020.10-stm32mp-r2-MACHINE.patch \
+    file://0008-ARM-v2020.10-stm32mp-r2-BOARD.patch \
+    file://0009-ARM-v2020.10-stm32mp-r2-MISC-DRIVERS.patch \
+    file://0010-ARM-v2020.10-stm32mp-r2-DEVICETREE.patch \
+    file://0011-ARM-v2020.10-stm32mp-r2-CONFIG.patch \
+    \
+    file://0012-ARM-v2020.10-stm32mp-r2.1.patch \
+    file://0013-ARM-v2020.10-stm32mp-r2.2-rc1.patch \
+    \
+    file://0099-Add-external-var-to-allow-build-of-new-devicetree-fi.patch \
+"
+
+# debug and trace
+SRC_URI += "${@bb.utils.contains('ST_UBOOT_DEBUG_TRACE', '1', '', 'file://0098-silent_mode.patch', d)}"
+
+U_BOOT_VERSION = "v2020.10"
+U_BOOT_SUBVERSION = "stm32mp"
+U_BOOT_RELEASE = "r2.2"
+PV = "${U_BOOT_VERSION}-${U_BOOT_SUBVERSION}-${U_BOOT_RELEASE}"
+
+ARCHIVER_ST_BRANCH = "${U_BOOT_VERSION}-${U_BOOT_SUBVERSION}"
+ARCHIVER_ST_REVISION = "${PV}"
+ARCHIVER_COMMUNITY_BRANCH = "master"
+ARCHIVER_COMMUNITY_REVISION = "${U_BOOT_VERSION}"
+
+S = "${WORKDIR}/git"
+
+# ---------------------------------
+# Configure devupstream class usage
+# ---------------------------------
+BBCLASSEXTEND = "devupstream:target"
+
+SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/u-boot.git;protocol=https;branch=${ARCHIVER_ST_BRANCH}"
+SRCREV_class-devupstream = "b1233459c34eb14c5070f605655e72e74be5ea5c"
+
+# ---------------------------------
+# Configure default preference to manage dynamic selection between tarball and github
+# ---------------------------------
+STM32MP_SOURCE_SELECTION ?= "tarball"
+
+DEFAULT_PREFERENCE = "${@bb.utils.contains('STM32MP_SOURCE_SELECTION', 'github', '-1', '1', d)}"
diff --git a/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bb b/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bb
new file mode 100644
index 00000000..c949635b
--- /dev/null
+++ b/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bb
@@ -0,0 +1,17 @@
+# OpenST v2020.10-stm32mp-r2.1 + KTN Patches
+# Based on OpenST 3.1.1 (22-06-08)
+# -> u-boot 2020.10 + Patches
+
+require u-boot-stm32mp-common_${PV}.inc
+require recipes-bsp/u-boot/u-boot-stm32mp.inc
+
+SUMMARY = "Universal Boot Loader for embedded devices for stm32mp"
+LICENSE = "GPL-2.0-or-later"
+
+PROVIDES += "u-boot"
+RPROVIDES:${PN} += "u-boot"
+
+# ---------------------------------
+# Configure archiver use
+# ---------------------------------
+include ${@oe.utils.ifelse(d.getVar('ST_ARCHIVER_ENABLE') == '1', 'u-boot-stm32mp-archiver.inc','')}
diff --git a/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bbappend b/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bbappend
index 47d9c276..e7e94db2 100644
--- a/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bbappend
+++ b/layers/meta-ktn-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp_2020.10.bbappend
@@ -1,7 +1,3 @@
-# OpenST v2020.10-stm32mp-r2.1 + KTN Patches
-# Based on OpenST 3.1.1 (22-06-08)
-# -> u-boot 2020.10 + Patches
-
 U_BOOT_VERSION = "v2020.10"
 U_BOOT_SUBVERSION = "stm32mp"
 U_BOOT_RELEASE = "r2.1-ktn"
-- 
GitLab