X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tools%2Fdefault_image.c;h=4abff4543a6c46b4016c0e4fabdfcdbfcd8a285a;hb=760b7170c5e44c771397eaf57b7197b621373809;hp=4e5568e06a496fc6b43e865aee7d4093ce111c77;hpb=516457013e5a88f65f9d6c11e9171cb03871cc92;p=u-boot diff --git a/tools/default_image.c b/tools/default_image.c index 4e5568e06a..4abff4543a 100644 --- a/tools/default_image.c +++ b/tools/default_image.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2008 Semihalf * @@ -10,14 +11,13 @@ * some functions added to address abstraction * * All rights reserved. - * - * SPDX-License-Identifier: GPL-2.0+ */ #include "imagetool.h" #include "mkimage.h" #include +#include #include static image_header_t header; @@ -90,6 +90,8 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, uint32_t checksum; time_t time; uint32_t imagesize; + uint32_t ep; + uint32_t addr; image_header_t * hdr = (image_header_t *)ptr; @@ -99,18 +101,26 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, sbuf->st_size - sizeof(image_header_t)); time = imagetool_get_source_date(params, sbuf->st_mtime); + ep = params->ep; + addr = params->addr; + if (params->type == IH_TYPE_FIRMWARE_IVT) /* Add size of CSF minus IVT */ imagesize = sbuf->st_size - sizeof(image_header_t) + 0x1FE0; else imagesize = sbuf->st_size - sizeof(image_header_t); + if (params->os == IH_OS_TEE) { + addr = optee_image_get_load_addr(hdr); + ep = optee_image_get_entry_point(hdr); + } + /* Build new header */ image_set_magic(hdr, IH_MAGIC); image_set_time(hdr, time); image_set_size(hdr, imagesize); - image_set_load(hdr, params->addr); - image_set_ep(hdr, params->ep); + image_set_load(hdr, addr); + image_set_ep(hdr, ep); image_set_dcrc(hdr, checksum); image_set_os(hdr, params->os); image_set_arch(hdr, params->arch);