From patchwork Tue May 12 09:44:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 245644 List-Id: U-Boot discussion From: peng.fan at nxp.com (Peng Fan) Date: Tue, 12 May 2020 17:44:00 +0800 Subject: [PATCH 1/5] spl: romapi: Fix issue for stream mode with secure boot enabled In-Reply-To: <20200512094404.16534-1-peng.fan@nxp.com> References: <20200512094404.16534-1-peng.fan@nxp.com> Message-ID: <20200512094404.16534-2-peng.fan@nxp.com> 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 --- 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) {