aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2021-04-02 14:05:17 +0200
committerPatrice Chotard <patrice.chotard@foss.st.com>2021-04-09 11:53:00 +0200
commit4fb7b3e10891ce8fc2d36e02e6d2f98df672e986 (patch)
treec00df71a6bb0979e32544cca411989a978f8dd91 /arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
parent0441b48570697195b924d83c0fd0dcb9f35e1865 (diff)
stm32mp: stm32prog: add FIP header support
Add support of TF-A FIP header in command stm32prog for all the boot partition and not only the STM32IMAGE. This patch is a preliminary patch to support FIP as second boot stage after TF-A BL2 when CONFIG_TFABOOT is activated for trusted boot chain. The FIP is archive binary loaded by TF-A BL2, which contains the secure OS = OP-TEE and the non secure firmware and device tree = U-Boot. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c')
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index a7e2861764..e36501a86b 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -73,15 +73,16 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
size = simple_strtoul(argv[4], NULL, 16);
/* check STM32IMAGE presence */
- if (size == 0 &&
- !stm32prog_header_check((struct raw_header_s *)addr, &header)) {
- size = header.image_length + BL_HEADER_SIZE;
-
- /* uImage detected in STM32IMAGE, execute the script */
- if (IMAGE_FORMAT_LEGACY ==
- genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
- return image_source_script(addr + BL_HEADER_SIZE,
- "script@1");
+ if (size == 0) {
+ stm32prog_header_check((struct raw_header_s *)addr, &header);
+ if (header.type == HEADER_STM32IMAGE) {
+ size = header.image_length + BL_HEADER_SIZE;
+
+ /* uImage detected in STM32IMAGE, execute the script */
+ if (IMAGE_FORMAT_LEGACY ==
+ genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
+ return image_source_script(addr + BL_HEADER_SIZE, "script@1");
+ }
}
if (IS_ENABLED(CONFIG_DM_VIDEO))