diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 3 | ||||
-rw-r--r-- | tools/aisimage.c | 2 | ||||
-rw-r--r-- | tools/fdtgrep.c | 4 | ||||
-rw-r--r-- | tools/fit_check_sign.c | 2 | ||||
-rw-r--r-- | tools/fit_image.c | 92 | ||||
-rw-r--r-- | tools/fit_info.c | 2 | ||||
-rw-r--r-- | tools/imagetool.h | 2 | ||||
-rw-r--r-- | tools/imx8image.c | 2 | ||||
-rw-r--r-- | tools/imx8mimage.c | 4 | ||||
-rw-r--r-- | tools/mkimage.c | 19 | ||||
-rw-r--r-- | tools/rkcommon.c | 2 | ||||
-rwxr-xr-x | tools/zynqmp_psu_init_minimize.sh | 2 |
12 files changed, 114 insertions, 22 deletions
diff --git a/tools/Makefile b/tools/Makefile index 02297e8c93a..ae6a3052646 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -333,7 +333,9 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \ -D__KERNEL_STRICT_NAMES \ -D_GNU_SOURCE +ifeq ($(CROSS_BUILD_TOOLS),) __build: $(LOGO-y) +endif $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ @@ -344,7 +346,6 @@ $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) else $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@ -#endif endif # Let clean descend into subdirs diff --git a/tools/aisimage.c b/tools/aisimage.c index c5b33b559b0..7a44b2d6ab6 100644 --- a/tools/aisimage.c +++ b/tools/aisimage.c @@ -387,7 +387,7 @@ static void aisimage_set_header(void *ptr, struct stat *sbuf, int ifd, { } -int aisimage_check_params(struct image_tool_params *params) +static int aisimage_check_params(struct image_tool_params *params) { if (!params) return CFG_INVALID; diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c index 037176bc9ef..b4c041070f5 100644 --- a/tools/fdtgrep.c +++ b/tools/fdtgrep.c @@ -1040,7 +1040,7 @@ static const char * const usage_opts_help[] = { #define util_getopt_long() getopt_long(argc, argv, usage_short_opts, \ usage_long_opts, NULL) -void util_usage(const char *errmsg, const char *synopsis, +static void util_usage(const char *errmsg, const char *synopsis, const char *short_opts, struct option const long_opts[], const char * const opts_help[]) { @@ -1109,7 +1109,7 @@ void util_usage(const char *errmsg, const char *synopsis, util_usage(errmsg, usage_synopsis, usage_short_opts, \ usage_long_opts, usage_opts_help) -void util_version(void) +static void util_version(void) { printf("Version: %s\n", "(U-Boot)"); exit(0); diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c index 32d0fdb8829..ab3266aff20 100644 --- a/tools/fit_check_sign.c +++ b/tools/fit_check_sign.c @@ -23,7 +23,7 @@ #include <image.h> #include <u-boot/crc.h> -void usage(char *cmdname) +static void usage(char *cmdname) { fprintf(stderr, "Usage: %s -f fit file -k key file -c config name\n" " -f ==> set fit file which should be checked'\n" diff --git a/tools/fit_image.c b/tools/fit_image.c index 331be5ae71d..0306333141e 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -173,6 +173,13 @@ static int fit_calc_size(struct image_tool_params *params) total_size += size; } + if (params->fit_tfa_bl31) { + size = imagetool_get_filesize(params, params->fit_tfa_bl31); + if (size < 0) + return -1; + total_size += size; + } + for (cont = params->content_head; cont; cont = cont->next) { size = imagetool_get_filesize(params, cont->fname); if (size < 0) @@ -402,6 +409,30 @@ static int fit_write_images(struct image_tool_params *params, char *fdt) fdt_end_node(fdt); } + /* And a TFA BL31 file if available */ + if (params->fit_tfa_bl31) { + fdt_begin_node(fdt, FIT_TFA_BL31_PROP "-1"); + + fdt_property_string(fdt, FIT_TYPE_PROP, FIT_TFA_BL31_PROP); + fdt_property_string(fdt, FIT_OS_PROP, + genimg_get_os_short_name(params->os)); + fdt_property_string(fdt, FIT_ARCH_PROP, + genimg_get_arch_short_name(params->arch)); + get_basename(str, sizeof(str), params->fit_tfa_bl31); + fdt_property_string(fdt, FIT_DESC_PROP, str); + + ret = fdt_property_file(params, fdt, FIT_DATA_PROP, + params->fit_tfa_bl31); + if (ret) + return ret; + fdt_property_u32(fdt, FIT_LOAD_PROP, params->fit_tfa_bl31_addr); + fdt_property_u32(fdt, FIT_ENTRY_PROP, params->fit_tfa_bl31_addr); + fit_add_hash_or_sign(params, fdt, true); + if (ret) + return ret; + fdt_end_node(fdt); + } + fdt_end_node(fdt); return 0; @@ -421,7 +452,7 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt) struct content_info *cont; const char *typename; char str[100]; - int upto; + int upto, len; fdt_begin_node(fdt, "configurations"); fdt_property_string(fdt, FIT_DEFAULT_PROP, "conf-1"); @@ -439,8 +470,16 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt) typename = genimg_get_type_short_name(params->fit_image_type); snprintf(str, sizeof(str), "%s-1", typename); + len = strlen(str); fdt_property_string(fdt, typename, str); - fdt_property_string(fdt, FIT_LOADABLE_PROP, str); + + if (params->fit_tfa_bl31) { + snprintf(str, sizeof(str), "%s-1." FIT_TFA_BL31_PROP "-1", typename); + str[len] = 0; + len += strlen(FIT_TFA_BL31_PROP "-1") + 1; + } + + fdt_property(fdt, FIT_LOADABLE_PROP, str, len + 1); if (params->fit_ramdisk) fdt_property_string(fdt, FIT_RAMDISK_PROP, @@ -456,8 +495,17 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt) fdt_begin_node(fdt, "conf-1"); typename = genimg_get_type_short_name(params->fit_image_type); snprintf(str, sizeof(str), "%s-1", typename); + len = strlen(str); fdt_property_string(fdt, typename, str); + if (params->fit_tfa_bl31) { + snprintf(str, sizeof(str), "%s-1." FIT_TFA_BL31_PROP "-1", typename); + str[len] = 0; + len += strlen(FIT_TFA_BL31_PROP "-1") + 1; + } + + fdt_property(fdt, FIT_LOADABLE_PROP, str, len + 1); + if (params->fit_ramdisk) fdt_property_string(fdt, FIT_RAMDISK_PROP, FIT_RAMDISK_PROP "-1"); @@ -610,13 +658,25 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname) } if (params->external_offset > 0) { /* An external offset positions the data absolutely. */ - fdt_setprop_u32(fdt, node, FIT_DATA_POSITION_PROP, - params->external_offset + buf_ptr); + ret = fdt_setprop_u32(fdt, node, FIT_DATA_POSITION_PROP, + params->external_offset + buf_ptr); } else { - fdt_setprop_u32(fdt, node, FIT_DATA_OFFSET_PROP, - buf_ptr); + ret = fdt_setprop_u32(fdt, node, FIT_DATA_OFFSET_PROP, + buf_ptr); + } + + if (ret) { + ret = -EINVAL; + goto err_munmap; + } + + ret = fdt_setprop_u32(fdt, node, FIT_DATA_SIZE_PROP, len); + + if (ret) { + ret = -EINVAL; + goto err_munmap; } - fdt_setprop_u32(fdt, node, FIT_DATA_SIZE_PROP, len); + buf_ptr += ALIGN(len, align_size); } @@ -745,14 +805,28 @@ static int fit_import_data(struct image_tool_params *params, const char *fname) debug("Importing data size %x\n", len); ret = fdt_setprop(fdt, node, FIT_DATA_PROP, data, len); - ret = fdt_delprop(fdt, node, ext_data_prop); - if (ret) { debug("%s: Failed to write property: %s\n", __func__, fdt_strerror(ret)); ret = -EINVAL; goto err_munmap; } + + ret = fdt_delprop(fdt, node, ext_data_prop); + if (ret) { + debug("%s: Failed to erase property: %s\n", __func__, + fdt_strerror(ret)); + ret = -EINVAL; + goto err_munmap; + } + + ret = fdt_delprop(fdt, node, FIT_DATA_SIZE_PROP); + if (ret) { + debug("%s: Failed to erase %s property: %s\n", __func__, + FIT_DATA_SIZE_PROP, fdt_strerror(ret)); + ret = -EINVAL; + goto err_munmap; + } } confs = fdt_path_offset(fdt, FIT_CONFS_PATH); diff --git a/tools/fit_info.c b/tools/fit_info.c index b2642ec5b76..c9e4236d09f 100644 --- a/tools/fit_info.c +++ b/tools/fit_info.c @@ -26,7 +26,7 @@ #include <image.h> #include <u-boot/crc.h> -void usage(char *cmdname) +static void usage(char *cmdname) { fprintf(stderr, "Usage: %s -f fit file -n node -p property\n" " -f ==> set fit file which is used'\n" diff --git a/tools/imagetool.h b/tools/imagetool.h index 57be608210a..866b8834fd7 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -99,6 +99,8 @@ struct image_tool_params { const char *engine_id; /* Engine to use for signing */ bool reset_timestamp; /* Reset the timestamp on an existing image */ struct image_summary summary; /* results of signing process */ + char *fit_tfa_bl31; /* TFA BL31 file to include */ + unsigned int fit_tfa_bl31_addr; /* TFA BL31 load and entry point address */ }; /* diff --git a/tools/imx8image.c b/tools/imx8image.c index 5a76643c06e..3cea536b8e8 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -23,7 +23,7 @@ static uint8_t cntr_version; static uint32_t custom_partition; static uint32_t scfw_flags; -int imx8image_check_params(struct image_tool_params *params) +static int imx8image_check_params(struct image_tool_params *params) { return 0; } diff --git a/tools/imx8mimage.c b/tools/imx8mimage.c index 0f24ba75c0f..3e974923652 100644 --- a/tools/imx8mimage.c +++ b/tools/imx8mimage.c @@ -49,7 +49,7 @@ static uint32_t get_cfg_value(char *token, char *name, int linenr) return value; } -int imx8mimage_check_params(struct image_tool_params *params) +static int imx8mimage_check_params(struct image_tool_params *params) { return 0; } @@ -475,7 +475,7 @@ static int generate_fspi_header (int ifd) } #endif -void build_image(int ofd) +static void build_image(int ofd) { int file_off, header_hdmi_off = 0, header_image_off; diff --git a/tools/mkimage.c b/tools/mkimage.c index 361711c53b2..a800f9507bf 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -101,6 +101,8 @@ static void usage(const char *msg) " -d ==> use image data from 'datafile'\n" " -x ==> set XIP (execute in place)\n" " -s ==> create an image with no data\n" + " -y ==> append TFA BL31 file to the image\n" + " -Y ==> set TFA BL31 file load and entry point address\n" " -v ==> verbose\n", params.cmdname); fprintf(stderr, @@ -160,7 +162,7 @@ static int add_content(int type, const char *fname) } static const char optstring[] = - "a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVx"; + "a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVxy:Y:"; static const struct option longopts[] = { { "load-address", required_argument, NULL, 'a' }, @@ -196,6 +198,8 @@ static const struct option longopts[] = { { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, { "xip", no_argument, NULL, 'x' }, + { "tfa-bl31-file", no_argument, NULL, 'y' }, + { "tfa-bl31-addr", no_argument, NULL, 'Y' }, { /* sentinel */ }, }; @@ -367,6 +371,17 @@ static void process_args(int argc, char **argv) case 'x': params.xflag++; break; + case 'y': + params.fit_tfa_bl31 = optarg; + break; + case 'Y': + params.fit_tfa_bl31_addr = strtoull(optarg, &ptr, 16); + if (*ptr) { + fprintf(stderr, "%s: invalid TFA BL31 address %s\n", + params.cmdname, optarg); + exit(EXIT_FAILURE); + } + break; default: usage("Invalid option"); } @@ -445,7 +460,7 @@ static void verify_image(const struct image_type_params *tparams) (void)close(ifd); } -void copy_datafile(int ifd, char *file) +static void copy_datafile(int ifd, char *file) { if (!file) return; diff --git a/tools/rkcommon.c b/tools/rkcommon.c index a0caa029cc0..d191ea72c63 100644 --- a/tools/rkcommon.c +++ b/tools/rkcommon.c @@ -279,7 +279,7 @@ bool rkcommon_need_rc4_spl(struct image_tool_params *params) return info->spl_rc4; } -bool rkcommon_is_header_v2(struct image_tool_params *params) +static bool rkcommon_is_header_v2(struct image_tool_params *params) { struct spl_info *info = rkcommon_get_spl_info(params->imagename); diff --git a/tools/zynqmp_psu_init_minimize.sh b/tools/zynqmp_psu_init_minimize.sh index 5c8b73703bf..f8b729ebc97 100755 --- a/tools/zynqmp_psu_init_minimize.sh +++ b/tools/zynqmp_psu_init_minimize.sh @@ -82,7 +82,7 @@ for i in $FUNCS_TO_REMOVE; do sed -i "/$i/,/^}$/d" ${OUT} done -scripts/Lindent ${OUT} +clang-format -i -style=file ${OUT} # Prepend 'static' to internal functions sed -i 's/^.*data(void)$/static &/g' ${OUT} |