[PATCH 1/5] spl: romapi: Fix issue for stream mode with secure boot enabled

Peng Fan peng.fan at nxp.com
Tue May 12 11:44:00 CEST 2020


When download image through ROM API for stream mode (USB, eMMC fastboot).
We uses tricky way to get the total image size:
The spl_load_simple_fit is called but the data reading is invalid,
so the image data is not really downloaded.
We should not call HAB authenticate in this tricky way. Otherwise it
will alway fail.
This patch skip the authentication only for this tricky using.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/mach-imx/spl_imx_romapi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c
index 5dc0f7174e..1a695ea837 100644
--- a/arch/arm/mach-imx/spl_imx_romapi.c
+++ b/arch/arm/mach-imx/spl_imx_romapi.c
@@ -13,6 +13,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static bool fit_skip_processing = false;
+
 static int is_boot_from_stream_device(u32 boot)
 {
 	u32 interface;
@@ -245,10 +247,14 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
 		}
 	}
 
+	fit_skip_processing = true;
+
 	total = get_fit_image_size(pfit);
 	total += 3;
 	total &= ~0x3;
 
+	fit_skip_processing = false;
+
 	imagesize = total - (p - pfit);
 
 	imagesize += pagesize - 1;
@@ -269,6 +275,11 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
 	return spl_load_simple_fit(spl_image, &load, (ulong)pfit, pfit);
 }
 
+bool spl_load_simple_fit_skip_processing(void)
+{
+	return fit_skip_processing;
+}
+
 int board_return_to_bootrom(struct spl_image_info *spl_image,
 			    struct spl_boot_device *bootdev)
 {
-- 
2.16.4



More information about the U-Boot mailing list