[PATCH v1 12/12] ARM: stm32mp157c-dk2: boot kernel in nonsecure mode

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jun 17 08:07:51 PDT 2019


The mainline kernel expects the firmware to have installed a secure boot
monitor for PSCI. The only means to do this is via the environment,
thus do the necessary changes.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/boards/stm32mp157c-dk2/Makefile             |  1 +
 arch/arm/boards/stm32mp157c-dk2/board.c              | 12 ++++++++++++
 .../defaultenv-dk2/nv/bootm.secure_state             |  1 +
 arch/arm/mach-stm32mp/Kconfig                        |  1 +
 4 files changed, 15 insertions(+)
 create mode 100644 arch/arm/boards/stm32mp157c-dk2/defaultenv-dk2/nv/bootm.secure_state

diff --git a/arch/arm/boards/stm32mp157c-dk2/Makefile b/arch/arm/boards/stm32mp157c-dk2/Makefile
index 092c31d6b28d..03f46111206c 100644
--- a/arch/arm/boards/stm32mp157c-dk2/Makefile
+++ b/arch/arm/boards/stm32mp157c-dk2/Makefile
@@ -1,2 +1,3 @@
 lwl-y += lowlevel.o
 obj-y += board.o
+bbenv-y += defaultenv-dk2
diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
index 5572231d525c..6c4f874d6bd8 100644
--- a/arch/arm/boards/stm32mp157c-dk2/board.c
+++ b/arch/arm/boards/stm32mp157c-dk2/board.c
@@ -5,6 +5,7 @@
 #include <asm/memory.h>
 #include <mach/stm32.h>
 #include <mfd/syscon.h>
+#include <envfs.h>
 
 #define SYSCFG_BOOTR		0x00
 #define SYSCFG_PMCSETR		0x04
@@ -65,6 +66,17 @@ static int dk2_postcore_init(void)
 }
 mem_initcall(dk2_postcore_init);
 
+static int dk2_devices_init(void)
+{
+	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
+		return 0;
+
+	defaultenv_append_directory(defaultenv_dk2);
+
+	return 0;
+}
+device_initcall(dk2_devices_init);
+
 static int dk2_sysconf_init(void)
 {
 	struct regmap *syscfg;
diff --git a/arch/arm/boards/stm32mp157c-dk2/defaultenv-dk2/nv/bootm.secure_state b/arch/arm/boards/stm32mp157c-dk2/defaultenv-dk2/nv/bootm.secure_state
new file mode 100644
index 000000000000..83bc509e8d95
--- /dev/null
+++ b/arch/arm/boards/stm32mp157c-dk2/defaultenv-dk2/nv/bootm.secure_state
@@ -0,0 +1 @@
+nonsecure
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 94205aaf5508..c0a1c202f7ce 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -7,6 +7,7 @@ config ARCH_STM32MP1157
 config MACH_STM32MP157C_DK2
 	select ARCH_STM32MP1157
 	select ARM_USE_COMPRESSED_DTB
+	select ENVIRONMENT_VARIABLES
 	bool "STM32MP157C-DK2 board"
 
 endif
-- 
2.20.1




More information about the barebox mailing list