diff mbox series

[v3,6/6] image-fit: Accept OP-TEE images when booting a FIT

Message ID 20210401182531.2147653-7-mr.nuke.me@gmail.com
State Accepted
Commit 033ac4ebbad82241e2d7da3ead662ccb495b9e89
Delegated to: Tom Rini
Headers show
Series SPL: FIT: Fix some omissions of SPL_LOAD_FIT_FULL and bootm | expand

Commit Message

Alexandru Gagniuc April 1, 2021, 6:25 p.m. UTC
OP-TEE images are normally packaged with
	type = "tee;
	os = "tee";

However, fit_image_load() thinks that is somehow invalid. However if
they were declared as type = "kernel", os = "linux", fit_image_load()
would happily accept them and allow the boot to continue. There is no
technical limitation to excluding "tee".

Allowing "tee" images is useful in a boot flow where OP-TEE is
executed before linux.

In fact, I think it's unintuitive for a "load"ing function to also do
parsing and contain a bunch ad-hoc heuristics that only its caller
might know. But I don't make the rules, I just write fixes. In more
polite terms: refactoring the fit_image API is beyond the scope of
this change.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 common/image-fit.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini April 16, 2021, 12:26 p.m. UTC | #1
On Thu, Apr 01, 2021 at 01:25:31PM -0500, Alexandru Gagniuc wrote:

> OP-TEE images are normally packaged with
> 	type = "tee;
> 	os = "tee";
> 
> However, fit_image_load() thinks that is somehow invalid. However if
> they were declared as type = "kernel", os = "linux", fit_image_load()
> would happily accept them and allow the boot to continue. There is no
> technical limitation to excluding "tee".
> 
> Allowing "tee" images is useful in a boot flow where OP-TEE is
> executed before linux.
> 
> In fact, I think it's unintuitive for a "load"ing function to also do
> parsing and contain a bunch ad-hoc heuristics that only its caller
> might know. But I don't make the rules, I just write fixes. In more
> polite terms: refactoring the fit_image API is beyond the scope of
> this change.
> 
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/image-fit.c b/common/image-fit.c
index 970e3f89da..ee51f5e76f 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -2089,6 +2089,7 @@  int fit_image_load(bootm_headers_t *images, ulong addr,
 	bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);
 	type_ok = fit_image_check_type(fit, noffset, image_type) ||
 		  fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE) ||
+		  fit_image_check_type(fit, noffset, IH_TYPE_TEE) ||
 		  (image_type == IH_TYPE_KERNEL &&
 		   fit_image_check_type(fit, noffset, IH_TYPE_KERNEL_NOLOAD));
 
@@ -2096,6 +2097,7 @@  int fit_image_load(bootm_headers_t *images, ulong addr,
 		image_type == IH_TYPE_FPGA ||
 		fit_image_check_os(fit, noffset, IH_OS_LINUX) ||
 		fit_image_check_os(fit, noffset, IH_OS_U_BOOT) ||
+		fit_image_check_os(fit, noffset, IH_OS_TEE) ||
 		fit_image_check_os(fit, noffset, IH_OS_OPENRTOS) ||
 		fit_image_check_os(fit, noffset, IH_OS_EFI) ||
 		fit_image_check_os(fit, noffset, IH_OS_VXWORKS);