[U-Boot] [PATCH] mx5: Add HAB boot support

andrej.rosano at f-secure.com andrej.rosano at f-secure.com
Wed Feb 14 16:41:04 UTC 2018


From: Andrej Rosano <andrej.rosano at f-secure.com>

Add SEC_CONFIG[1] fuse checking.

Signed-off-by: Andrej Rosano <andrej.rosano at f-secure.com>
---
 arch/arm/mach-imx/Makefile  | 5 +++++
 arch/arm/mach-imx/hab.c     | 5 +++++
 arch/arm/mach-imx/mx5/soc.c | 8 ++++++++
 drivers/crypto/fsl/Makefile | 2 ++
 4 files changed, 20 insertions(+)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 95a542fa01..687c28c932 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -49,14 +49,19 @@ ifeq ($(SOC),$(filter $(SOC),mx7ulp))
 obj-y  += cache.o
 obj-$(CONFIG_SECURE_BOOT) += hab.o
 endif
+ifeq ($(SOC),$(filter $(SOC),mx5))
+obj-$(CONFIG_SECURE_BOOT) += hab.o
+endif
 ifeq ($(SOC),$(filter $(SOC),vf610))
 obj-y += ddrmc-vf610.o
 endif
 ifneq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
 obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
+ifneq ($(SOC),$(filter $(SOC),mx5))
 obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o
 endif
+endif
 
 PLUGIN = board/$(BOARDDIR)/plugin
 
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 5f197775c1..a2b91af7d5 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -498,7 +498,9 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
 	printf("\nAuthenticate image from DDR location 0x%x...\n",
 	       ddr_start);
 
+#if !defined(CONFIG_MX5)
 	hab_caam_clock_enable(1);
+#endif
 
 	/* Calculate IVT address header */
 	ivt_addr = ddr_start + ivt_offset;
@@ -592,7 +594,10 @@ hab_exit_failure_print_status:
 #endif
 
 hab_caam_clock_disable:
+
+#if !defined(CONFIG_MX5)
 	hab_caam_clock_enable(0);
+#endif
 
 	if (load_addr != 0)
 		result = 0;
diff --git a/arch/arm/mach-imx/mx5/soc.c b/arch/arm/mach-imx/mx5/soc.c
index 2b63871bc4..fab3958702 100644
--- a/arch/arm/mach-imx/mx5/soc.c
+++ b/arch/arm/mach-imx/mx5/soc.c
@@ -15,11 +15,19 @@
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/hab.h>
 
 #if !(defined(CONFIG_MX51) || defined(CONFIG_MX53))
 #error "CPU_TYPE not defined"
 #endif
 
+#if defined(CONFIG_SECURE_BOOT)
+struct imx_sec_config_fuse_t const imx_sec_config_fuse = {
+	.bank = 0,
+	.word = 4,
+};
+#endif
+
 u32 get_cpu_rev(void)
 {
 #ifdef CONFIG_MX51
diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
index ea878e1822..13e4a95459 100644
--- a/drivers/crypto/fsl/Makefile
+++ b/drivers/crypto/fsl/Makefile
@@ -6,6 +6,8 @@
 
 obj-y += sec.o
 obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
+ifneq ($(SOC),$(filter $(SOC),mx5))
 obj-$(CONFIG_CMD_BLOB) += fsl_blob.o
 obj-$(CONFIG_CMD_DEKBLOB) += fsl_blob.o
+endif
 obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
-- 
2.16.1



More information about the U-Boot mailing list