[meta-rockchip][PATCH v3 3/7] optee-os: enable rk3399 support, including serial console support


Yann Dirson
 

From: Yann Dirson <yann@blade-group.com>

As discussed in https://github.com/OP-TEE/optee_os/issues/4542, ASLR
support currently has to be disabled for OP-TEE to boot.

Signed-off-by: Yann Dirson <yann@blade-group.com>
---
conf/machine/include/rk3399.inc | 2 +
...399-enable-serial-console-by-default.patch | 52 +++++++++++++++++++
recipes-security/optee/optee%.bbappend | 1 +
recipes-security/optee/optee-os_%.bbappend | 8 +++
4 files changed, 63 insertions(+)
create mode 100644 recipes-security/optee/files/0001-rk3399-enable-seria=
l-console-by-default.patch
create mode 100644 recipes-security/optee/optee%.bbappend
create mode 100644 recipes-security/optee/optee-os_%.bbappend

diff --git a/conf/machine/include/rk3399.inc b/conf/machine/include/rk339=
9.inc
index f6b7826..9ac434e 100644
--- a/conf/machine/include/rk3399.inc
+++ b/conf/machine/include/rk3399.inc
@@ -13,6 +13,8 @@ KBUILD_DEFCONFIG ?=3D "defconfig"
KERNEL_CLASSES =3D "kernel-fitimage"
KERNEL_IMAGETYPE =3D "fitImage"
=20
+OPTEEMACHINE =3D "rockchip-rk3399"
+
TFA_PLATFORM =3D "rk3399"
TFA_BUILD_TARGET =3D "bl31"
=20
diff --git a/recipes-security/optee/files/0001-rk3399-enable-serial-conso=
le-by-default.patch b/recipes-security/optee/files/0001-rk3399-enable-ser=
ial-console-by-default.patch
new file mode 100644
index 0000000..c09cfae
--- /dev/null
+++ b/recipes-security/optee/files/0001-rk3399-enable-serial-console-by-d=
efault.patch
@@ -0,0 +1,52 @@
+From 96a614759ff5572b16929379d72376fa6c805a37 Mon Sep 17 00:00:00 2001
+From: Yann Dirson <yann@blade-group.com>
+Date: Mon, 12 Apr 2021 10:49:18 +0200
+Subject: [PATCH] rk3399: enable serial console by default
+Upstream-Status: Backport
+
+The definition is the same as for rk322x.
+
+Signed-off-by: Yann Dirson <yann@blade-group.com>
+Acked-by: Jerome Forissier <jerome@forissier.org>
+---
+ core/arch/arm/plat-rockchip/conf.mk | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/core/arch/arm/plat-rockchip/conf.mk b/core/arch/arm/plat-ro=
ckchip/conf.mk
+index f6eef865..f180d63a 100644
+--- a/core/arch/arm/plat-rockchip/conf.mk
++++ b/core/arch/arm/plat-rockchip/conf.mk
+@@ -26,8 +26,6 @@ CFG_EARLY_CONSOLE_BAUDRATE ?=3D 1500000
+ CFG_EARLY_CONSOLE_CLK_IN_HZ ?=3D 24000000
+ endif
+=20
+-CFG_EARLY_CONSOLE ?=3D n
+-
+ ifeq ($(PLATFORM_FLAVOR),rk3399)
+ include core/arch/arm/cpu/cortex-armv8-0.mk
+ $(call force,CFG_TEE_CORE_NB_CORE,6)
+@@ -37,6 +35,12 @@ CFG_TZDRAM_START ?=3D 0x30000000
+ CFG_TZDRAM_SIZE ?=3D 0x02000000
+ CFG_SHMEM_START ?=3D 0x32000000
+ CFG_SHMEM_SIZE ?=3D 0x00400000
++
++CFG_EARLY_CONSOLE ?=3D y
++CFG_EARLY_CONSOLE_BASE ?=3D UART2_BASE
++CFG_EARLY_CONSOLE_SIZE ?=3D UART2_SIZE
++CFG_EARLY_CONSOLE_BAUDRATE ?=3D 1500000
++CFG_EARLY_CONSOLE_CLK_IN_HZ ?=3D 24000000
+ endif
+=20
+ ifeq ($(PLATFORM_FLAVOR),px30)
+@@ -47,6 +51,8 @@ CFG_TZDRAM_START ?=3D 0x30000000
+ CFG_TZDRAM_SIZE ?=3D 0x02000000
+ CFG_SHMEM_START ?=3D 0x32000000
+ CFG_SHMEM_SIZE ?=3D 0x00400000
++
++CFG_EARLY_CONSOLE ?=3D n
+ endif
+=20
+ ifeq ($(platform-flavor-armv8),1)
+--=20
+2.30.2
+
diff --git a/recipes-security/optee/optee%.bbappend b/recipes-security/op=
tee/optee%.bbappend
new file mode 100644
index 0000000..9a156bb
--- /dev/null
+++ b/recipes-security/optee/optee%.bbappend
@@ -0,0 +1 @@
+COMPATIBLE_MACHINE_rk3399 ?=3D "rk3399"
diff --git a/recipes-security/optee/optee-os_%.bbappend b/recipes-securit=
y/optee/optee-os_%.bbappend
new file mode 100644
index 0000000..a1b0c4f
--- /dev/null
+++ b/recipes-security/optee/optee-os_%.bbappend
@@ -0,0 +1,8 @@
+EXTRA_OEMAKE_append_rk3399 =3D " \
+ CFG_CORE_ASLR=3Dn \
+"
+
+FILESEXTRAPATHS_prepend :=3D "${THISDIR}/files:"
+SRC_URI +=3D "\
+ file://0001-rk3399-enable-serial-console-by-default.patch \
+"
--=20
2.30.2