[PATCH v8 11/19] spl: imx: use trampoline buffer to load images to secure region

Marek Vasut marex at denx.de
Sat Mar 22 03:14:48 CET 2025


On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

[...]

> @@ -42,12 +53,30 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image,
>   
>   	debug("%s: container: %p offset: %lu size: %lu\n", __func__,
>   	      container, offset, size);
> -	if (info->read(info, offset, size,
> -		       map_sysmem(images[image_index].dst - overhead,
> -				  images[image_index].size)) <
> -	    images[image_index].size) {
> -		printf("%s wrong\n", __func__);
> -		return NULL;
> +
> +	buf = map_sysmem(images[image_index].dst - overhead, images[image_index].size);
> +	if (IS_ENABLED(CONFIG_SPL_IMX_CONTAINER_USE_TRAMPOLINE) &&
> +	    arch_check_dst_in_secure(buf, size)) {
> +		trampoline = arch_get_container_trampoline();
> +		if (!trampoline) {
> +			printf("%s: trampoline size is zero\n", __func__);
> +			return NULL;
> +		}
> +
> +		if (info->read(info, offset, size, trampoline) < images[image_index].size) {
> +			printf("%s wrong\n", __func__);
> +			return NULL;
> +		}
> +
> +		memcpy(buf, trampoline, images[image_index].size);
> +	} else {
> +		if (info->read(info, offset, size,
> +			       map_sysmem(images[image_index].dst - overhead,
> +					  images[image_index].size)) <
> +		    images[image_index].size) {
> +			printf("%s wrong\n", __func__);

Can you please make those debug prints a bit more informative about the 
failure that occurred ?


More information about the U-Boot mailing list