
The existing name is confusing since it includes state as well as parameters. In fact it includes nearly everything known about the tool while it is running. Rename the struct to imgtool to reflect this. Signed-off-by: Simon Glass <sjg@chromium.org> --- tools/aisimage.c | 17 ++++++++--------- tools/atmelimage.c | 10 +++++----- tools/default_image.c | 10 +++++----- tools/dumpimage.c | 2 +- tools/fit_common.c | 5 ++--- tools/fit_common.h | 5 ++--- tools/fit_image.c | 26 +++++++++++++------------- tools/gpheader.h | 2 +- tools/gpimage-common.c | 2 +- tools/gpimage.c | 6 +++--- tools/imagetool.c | 8 ++++---- tools/imagetool.h | 39 ++++++++++++++++++++------------------- tools/imx8image.c | 8 ++++---- tools/imx8mimage.c | 8 ++++---- tools/imximage.c | 10 +++++----- tools/kwbimage.c | 30 +++++++++++++++--------------- tools/lpc32xximage.c | 6 +++--- tools/mkimage.c | 2 +- tools/mtk_image.c | 10 +++++----- tools/mxsimage.c | 10 +++++----- tools/omapimage.c | 6 +++--- tools/pblimage.c | 10 +++++----- tools/renesas_spkgimage.c | 11 +++++------ tools/rkcommon.c | 30 +++++++++++++++--------------- tools/rkcommon.h | 16 ++++++++-------- tools/rkimage.c | 2 +- tools/rkspi.c | 4 ++-- tools/sfspl.c | 12 ++++++------ tools/socfpgaimage.c | 24 ++++++++++++------------ tools/stm32image.c | 6 +++--- tools/sunxi_egon.c | 12 ++++++------ tools/sunxi_toc0.c | 10 +++++----- tools/ublimage.c | 8 ++++---- tools/vybridimage.c | 6 +++--- tools/zynqimage.c | 8 ++++---- tools/zynqmpbif.c | 6 +++--- tools/zynqmpimage.c | 12 ++++++------ tools/zynqmpimage.h | 2 +- 38 files changed, 199 insertions(+), 202 deletions(-) diff --git a/tools/aisimage.c b/tools/aisimage.c index 697b3c0bad7..f17eeb059de 100644 --- a/tools/aisimage.c +++ b/tools/aisimage.c @@ -113,7 +113,7 @@ static int get_ais_table_id(uint32_t *ptr) return -1; } -static void aisimage_print_header(const void *hdr, struct image_tool_params *params) +static void aisimage_print_header(const void *hdr, struct imgtool *params) { struct ais_header *ais_hdr = (struct ais_header *)hdr; uint32_t *ptr; @@ -174,7 +174,7 @@ static uint32_t *ais_insert_cmd_header(uint32_t cmd, uint32_t nargs, } -static uint32_t *ais_alloc_buffer(struct image_tool_params *params) +static uint32_t *ais_alloc_buffer(struct imgtool *params) { int dfd; struct stat sbuf; @@ -215,8 +215,7 @@ static uint32_t *ais_alloc_buffer(struct image_tool_params *params) return ptr; } -static uint32_t *ais_copy_image(struct image_tool_params *params, - uint32_t *aisptr) +static uint32_t *ais_copy_image(struct imgtool *params, uint32_t *aisptr) { int dfd; @@ -251,8 +250,8 @@ static uint32_t *ais_copy_image(struct image_tool_params *params, } -static int aisimage_generate(struct image_tool_params *params, - struct imgtool_funcs *tparams) +static int aisimage_generate(struct imgtool *params, + struct imgtool_funcs *tparams) { FILE *fd = NULL; char *line = NULL; @@ -369,7 +368,7 @@ static int aisimage_check_image_types(uint8_t type) } static int aisimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct ais_header *ais_hdr = (struct ais_header *)ptr; @@ -383,11 +382,11 @@ static int aisimage_verify_header(unsigned char *ptr, int image_size, } static void aisimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { } -int aisimage_check_params(struct image_tool_params *params) +int aisimage_check_params(struct imgtool *params) { if (!params) return CFG_INVALID; diff --git a/tools/atmelimage.c b/tools/atmelimage.c index e1909f39c45..279e26527e3 100644 --- a/tools/atmelimage.c +++ b/tools/atmelimage.c @@ -112,7 +112,7 @@ static int atmel_parse_pmecc_params(char *txt) } static int atmel_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { uint32_t *ints = (uint32_t *)ptr; size_t pos; @@ -182,7 +182,7 @@ static void atmel_print_pmecc_header(const uint32_t word) printf("\t\t====================\n"); } -static void atmel_print_header(const void *ptr, struct image_tool_params *params) +static void atmel_print_header(const void *ptr, struct imgtool *params) { uint32_t *ints = (uint32_t *)ptr; size_t pos; @@ -204,7 +204,7 @@ static void atmel_print_header(const void *ptr, struct image_tool_params *params } static void atmel_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { /* just save the image size into 6'th interrupt vector */ uint32_t *ints = (uint32_t *)ptr; @@ -224,7 +224,7 @@ static void atmel_set_header(void *ptr, struct stat *sbuf, int ifd, ints[pos] = cpu_to_le32(size); } -static int atmel_check_params(struct image_tool_params *params) +static int atmel_check_params(struct imgtool *params) { if (strlen(params->imagename) > 0) if (atmel_parse_pmecc_params(params->imagename)) @@ -237,7 +237,7 @@ static int atmel_check_params(struct image_tool_params *params) (params->lflag && !params->dflag))); } -static int atmel_vrec_header(struct image_tool_params *params, +static int atmel_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { uint32_t tmp; diff --git a/tools/default_image.c b/tools/default_image.c index 04bc85bf932..e7412c1cb2f 100644 --- a/tools/default_image.c +++ b/tools/default_image.c @@ -33,20 +33,20 @@ static int image_check_image_types(uint8_t type) return EXIT_FAILURE; } -static int image_check_params(struct image_tool_params *params) +static int image_check_params(struct imgtool *params) { return ((params->dflag && (params->fflag || params->lflag)) || (params->fflag && (params->dflag || params->lflag)) || (params->lflag && (params->dflag || params->fflag))); } -static void image_print_header(const void *ptr, struct image_tool_params *params) +static void image_print_header(const void *ptr, struct imgtool *params) { image_print_contents(ptr); } static int image_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { uint32_t len; const unsigned char *data; @@ -108,7 +108,7 @@ static int image_verify_header(unsigned char *ptr, int image_size, } static void image_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { uint32_t checksum; time_t time; @@ -165,7 +165,7 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, image_set_hcrc(hdr, checksum); } -static int image_extract_subimage(void *ptr, struct image_tool_params *params) +static int image_extract_subimage(void *ptr, struct imgtool *params) { const struct legacy_img_hdr *hdr = (const struct legacy_img_hdr *)ptr; ulong file_data; diff --git a/tools/dumpimage.c b/tools/dumpimage.c index b15aee934c9..b0a8853c292 100644 --- a/tools/dumpimage.c +++ b/tools/dumpimage.c @@ -12,7 +12,7 @@ static void usage(void); /* parameters initialized by core will be used by the image type code */ -static struct image_tool_params params; +static struct imgtool params; /* * dumpimage_extract_subimage - diff --git a/tools/fit_common.c b/tools/fit_common.c index d1cde16c1cb..9e7646ac0ef 100644 --- a/tools/fit_common.c +++ b/tools/fit_common.c @@ -25,13 +25,12 @@ #define COPYFILE_BUFSIZE (64 * 1024) -void fit_print_header(const void *fit, struct image_tool_params *params) +void fit_print_header(const void *fit, struct imgtool *itl) { fit_print_contents(fit); } -int fit_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) +int fit_verify_header(unsigned char *ptr, int image_size, struct imgtool *itl) { int ret; diff --git a/tools/fit_common.h b/tools/fit_common.h index 2da4b9422d4..b1c46bfe74f 100644 --- a/tools/fit_common.h +++ b/tools/fit_common.h @@ -10,7 +10,7 @@ #include "mkimage.h" #include <image.h> -void fit_print_header(const void *fit, struct image_tool_params *params); +void fit_print_header(const void *fit, struct imgtool *params); /** * Verify the format of FIT header pointed to by ptr @@ -20,8 +20,7 @@ void fit_print_header(const void *fit, struct image_tool_params *params); * @params: mkimage parameters * Return: 0 if OK, -1 on error */ -int fit_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params); +int fit_verify_header(unsigned char *ptr, int image_size, struct imgtool *itl); int fit_check_image_types(uint8_t type); diff --git a/tools/fit_image.c b/tools/fit_image.c index caed8d5f901..be9779e0686 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -24,7 +24,7 @@ static struct legacy_img_hdr header; -static int fit_add_file_data(struct image_tool_params *params, size_t size_inc, +static int fit_add_file_data(struct imgtool *params, size_t size_inc, const char *tmpfile) { int tfd, destfd = 0; @@ -97,7 +97,7 @@ err_keydest: /** * fit_calc_size() - Calculate the approximate size of the FIT we will generate */ -static int fit_calc_size(struct image_tool_params *params) +static int fit_calc_size(struct imgtool *params) { struct content_info *cont; int size, total_size; @@ -129,7 +129,7 @@ static int fit_calc_size(struct image_tool_params *params) return total_size; } -static int fdt_property_file(struct image_tool_params *params, +static int fdt_property_file(struct imgtool *params, void *fdt, const char *name, const char *fname) { struct stat sbuf; @@ -211,7 +211,7 @@ static void get_basename(char *str, int size, const char *fname) * a sign node to parent. Otherwise, just add a CRC. Rationale: if conf have * to be signed, image/dt have to be hashed even if there is a key name hint. */ -static void fit_add_hash_or_sign(struct image_tool_params *params, void *fdt, +static void fit_add_hash_or_sign(struct imgtool *params, void *fdt, bool is_images_subnode) { const char *hash_algo = "crc32"; @@ -262,7 +262,7 @@ static void fit_add_hash_or_sign(struct image_tool_params *params, void *fdt, * We always include the main image (params->datafile). If there are device * tree files, we include an fdt- node for each of those too. */ -static int fit_write_images(struct image_tool_params *params, char *fdt) +static int fit_write_images(struct imgtool *params, char *fdt) { struct content_info *cont; const char *typename; @@ -357,7 +357,7 @@ static int fit_write_images(struct image_tool_params *params, char *fdt) * * Otherwise we just create a configuration with the main image in it. */ -static void fit_write_configs(struct image_tool_params *params, char *fdt) +static void fit_write_configs(struct imgtool *params, char *fdt) { struct content_info *cont; const char *typename; @@ -410,7 +410,7 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt) fdt_end_node(fdt); } -static int fit_build_fdt(struct image_tool_params *params, char *fdt, int size) +static int fit_build_fdt(struct imgtool *params, char *fdt, int size) { int ret; @@ -436,7 +436,7 @@ static int fit_build_fdt(struct image_tool_params *params, char *fdt, int size) return fdt_totalsize(fdt); } -static int fit_build(struct image_tool_params *params, const char *fname) +static int fit_build(struct imgtool *params, const char *fname) { char *buf; int size; @@ -493,7 +493,7 @@ err_buf: * This function cannot cope with FITs with 'data-offset' properties. All * data must be in 'data' properties on entry. */ -static int fit_extract_data(struct image_tool_params *params, const char *fname) +static int fit_extract_data(struct imgtool *params, const char *fname) { void *buf = NULL; int buf_ptr; @@ -617,7 +617,7 @@ err: return ret; } -static int fit_import_data(struct image_tool_params *params, const char *fname) +static int fit_import_data(struct imgtool *params, const char *fname) { void *fdt, *old_fdt; void *data = NULL; @@ -744,7 +744,7 @@ err: * returns: * only on success, otherwise calls exit (EXIT_FAILURE); */ -static int fit_handle_file(struct image_tool_params *params) +static int fit_handle_file(struct imgtool *params) { char tmpfile[MKIMAGE_MAX_TMPFILE_LEN]; char bakfile[MKIMAGE_MAX_TMPFILE_LEN + 4] = {0}; @@ -894,7 +894,7 @@ static int fit_image_extract( * returns: * zero in case of success or a negative value if fail. */ -static int fit_extract_contents(void *ptr, struct image_tool_params *params) +static int fit_extract_contents(void *ptr, struct imgtool *params) { int images_noffset; int noffset; @@ -948,7 +948,7 @@ static int fit_extract_contents(void *ptr, struct image_tool_params *params) return 0; } -static int fit_check_params(struct image_tool_params *params) +static int fit_check_params(struct imgtool *params) { if (params->auto_fit) return 0; diff --git a/tools/gpheader.h b/tools/gpheader.h index d5bf86e5893..7f71a1db3f9 100644 --- a/tools/gpheader.h +++ b/tools/gpheader.h @@ -35,5 +35,5 @@ int gph_verify_header(struct gp_header *gph, int be); void gph_print_header(const struct gp_header *gph, int be); void gph_set_header(struct gp_header *gph, uint32_t size, uint32_t load_addr, int be); -int gpimage_check_params(struct image_tool_params *params); +int gpimage_check_params(struct imgtool *params); #endif diff --git a/tools/gpimage-common.c b/tools/gpimage-common.c index fc6406b9133..3486819f4ca 100644 --- a/tools/gpimage-common.c +++ b/tools/gpimage-common.c @@ -72,7 +72,7 @@ void gph_set_header(struct gp_header *gph, uint32_t size, uint32_t load_addr, to_be32(&gph->size, &gph->load_addr); } -int gpimage_check_params(struct image_tool_params *params) +int gpimage_check_params(struct imgtool *params) { return (params->dflag && (params->fflag || params->lflag)) || (params->fflag && (params->dflag || params->lflag)) || diff --git a/tools/gpimage.c b/tools/gpimage.c index d2bc79d46b9..ac138ac9a6b 100644 --- a/tools/gpimage.c +++ b/tools/gpimage.c @@ -34,14 +34,14 @@ static int gpimage_check_image_types(uint8_t type) } static int gpimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct gp_header *gph = (struct gp_header *)ptr; return gph_verify_header(gph, 1); } -static void gpimage_print_header(const void *ptr, struct image_tool_params *params) +static void gpimage_print_header(const void *ptr, struct imgtool *params) { const struct gp_header *gph = (struct gp_header *)ptr; @@ -49,7 +49,7 @@ static void gpimage_print_header(const void *ptr, struct image_tool_params *para } static void gpimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct gp_header *gph = (struct gp_header *)ptr; diff --git a/tools/imagetool.c b/tools/imagetool.c index b36b8d735a4..726c3ceb2b2 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -30,13 +30,13 @@ static int imagetool_verify_print_header_by_type( void *ptr, struct stat *sbuf, struct imgtool_funcs *tparams, - struct image_tool_params *params); + struct imgtool *params); int imagetool_verify_print_header( void *ptr, struct stat *sbuf, struct imgtool_funcs *tparams, - struct image_tool_params *params) + struct imgtool *params) { int retval = -1; struct imgtool_funcs **curr; @@ -89,7 +89,7 @@ static int imagetool_verify_print_header_by_type( void *ptr, struct stat *sbuf, struct imgtool_funcs *tparams, - struct image_tool_params *params) + struct imgtool *params) { int retval = -1; @@ -150,7 +150,7 @@ int imagetool_save_subimage( return 0; } -int imagetool_get_filesize(struct image_tool_params *params, const char *fname) +int imagetool_get_filesize(struct imgtool *params, const char *fname) { struct stat sbuf; int fd; diff --git a/tools/imagetool.h b/tools/imagetool.h index 3cbb053e42b..42c8d8c8742 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -48,11 +48,13 @@ enum af_mode { }; /* + * struct imgtool() - Defines mkimage/dumpimage parameters and variables + * * This structure defines all such variables those are initialized by - * mkimage and dumpimage main core and need to be referred by image - * type specific functions + * mkimage and dumpimage main core and need to be referred by + * image-type-specific functions */ -struct image_tool_params { +struct imgtool { int dflag; int eflag; int fflag; @@ -120,7 +122,7 @@ struct imgtool_funcs { * * Returns 1 if parameter check is successful */ - int (*check_params) (struct image_tool_params *); + int (*check_params)(struct imgtool *itl); /* * This function is used by list command (i.e. mkimage -l <filename>) * image type verification code must be put here @@ -128,17 +130,17 @@ struct imgtool_funcs { * Returns 0 if image header verification is successful * otherwise, returns respective negative error codes */ - int (*verify_header) (unsigned char *, int, struct image_tool_params *); + int (*verify_header)(unsigned char *, int, struct imgtool *itl); /* Prints image information abstracting from image header */ - void (*print_header) (const void *, struct image_tool_params *); + void (*print_header)(const void *, struct imgtool *itl); /* * The header or image contents need to be set as per image type to * be generated using this callback function. * further output file post processing (for ex. checksum calculation, * padding bytes etc..) can also be done in this callback function. */ - void (*set_header) (void *, struct stat *, int, - struct image_tool_params *); + void (*set_header)(void *data, struct stat *sbuf, int ifd, + struct imgtool *itl); /* * This function is used by the command to retrieve a component * (sub-image) from the image (i.e. dumpimage -p <position> @@ -148,7 +150,7 @@ struct imgtool_funcs { * Returns 0 if the file was successfully retrieved from the image, * or a negative value on error. */ - int (*extract_subimage)(void *, struct image_tool_params *); + int (*extract_subimage)(void *, struct imgtool *itl); /* * Some image generation support for ex (default image type) supports * more than one type_ids, this callback function is used to check @@ -157,7 +159,7 @@ struct imgtool_funcs { */ int (*check_image_type) (uint8_t); /* This callback function will be executed if fflag is defined */ - int (*fflag_handle) (struct image_tool_params *); + int (*fflag_handle)(struct imgtool *itl); /* * This callback function will be executed for variable size record * It is expected to build this header in memory and return its length @@ -166,8 +168,7 @@ struct imgtool_funcs { * additional padding should be used when copying the data image * by returning the padding length. */ - int (*vrec_header)(struct image_tool_params *, - struct imgtool_funcs *funcs); + int (*vrec_header)(struct imgtool *itl, struct imgtool_funcs *funcs); }; /** @@ -202,7 +203,7 @@ int imagetool_verify_print_header( void *ptr, struct stat *sbuf, struct imgtool_funcs *tparams, - struct image_tool_params *params); + struct imgtool *params); /** * imagetool_save_subimage - store data into a file @@ -231,7 +232,7 @@ int imagetool_save_subimage( * @fname: filename to check * Return: size of file, or -ve value on error */ -int imagetool_get_filesize(struct image_tool_params *params, const char *fname); +int imagetool_get_filesize(struct imgtool *params, const char *fname); /** * imagetool_get_source_date() - Get timestamp for build output. @@ -254,11 +255,11 @@ time_t imagetool_get_source_date( * for ex. default_image.c, fit_image.c */ -void pbl_load_uboot(int fd, struct image_tool_params *mparams); -int zynqmpbif_copy_image(int fd, struct image_tool_params *mparams); -int imx8image_copy_image(int fd, struct image_tool_params *mparams); -int imx8mimage_copy_image(int fd, struct image_tool_params *mparams); -int rockchip_copy_image(int fd, struct image_tool_params *mparams); +void pbl_load_uboot(int fd, struct imgtool *mparams); +int zynqmpbif_copy_image(int fd, struct imgtool *mparams); +int imx8image_copy_image(int fd, struct imgtool *mparams); +int imx8mimage_copy_image(int fd, struct imgtool *mparams); +int rockchip_copy_image(int fd, struct imgtool *mparams); #define ___cat(a, b) a ## b #define __cat(a, b) ___cat(a, b) diff --git a/tools/imx8image.c b/tools/imx8image.c index a333ded46e2..bb15f078541 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -22,17 +22,17 @@ static uint16_t sw_version; static uint32_t custom_partition; static uint32_t scfw_flags; -int imx8image_check_params(struct image_tool_params *params) +int imx8image_check_params(struct imgtool *params) { return 0; } static void imx8image_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { } -static void imx8image_print_header(const void *ptr, struct image_tool_params *params) +static void imx8image_print_header(const void *ptr, struct imgtool *params) { } @@ -1125,7 +1125,7 @@ static int build_container(soc_type_t soc, uint32_t sector_size, return 0; } -int imx8image_copy_image(int outfd, struct image_tool_params *mparams) +int imx8image_copy_image(int outfd, struct imgtool *itl) { image_t *img_sp = param_stack; diff --git a/tools/imx8mimage.c b/tools/imx8mimage.c index 0f24ba75c0f..ecff9aff04d 100644 --- a/tools/imx8mimage.c +++ b/tools/imx8mimage.c @@ -49,17 +49,17 @@ static uint32_t get_cfg_value(char *token, char *name, int linenr) return value; } -int imx8mimage_check_params(struct image_tool_params *params) +int imx8mimage_check_params(struct imgtool *params) { return 0; } static void imx8mimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { } -static void imx8mimage_print_header(const void *ptr, struct image_tool_params *params) +static void imx8mimage_print_header(const void *ptr, struct imgtool *params) { } @@ -688,7 +688,7 @@ void build_image(int ofd) sld_load_addr, sld_header_off, sld_csf_off - sld_header_off); } -int imx8mimage_copy_image(int outfd, struct image_tool_params *mparams) +int imx8mimage_copy_image(int outfd, struct imgtool *mparams) { /* * SECO FW is a container image, this is to calculate the diff --git a/tools/imximage.c b/tools/imximage.c index 7a5dde617d9..9dd962e144f 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -803,7 +803,7 @@ static int imximage_check_image_types(uint8_t type) } static int imximage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct imx_header *imx_hdr = (struct imx_header *) ptr; @@ -813,7 +813,7 @@ static int imximage_verify_header(unsigned char *ptr, int image_size, return 0; } -static void imximage_print_header(const void *ptr, struct image_tool_params *params) +static void imximage_print_header(const void *ptr, struct imgtool *params) { struct imx_header *imx_hdr = (struct imx_header *) ptr; uint32_t version = detect_imximage_version(imx_hdr); @@ -832,7 +832,7 @@ static void imximage_print_header(const void *ptr, struct image_tool_params *par } static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct imx_header *imxhdr = (struct imx_header *)ptr; uint32_t dcd_len; @@ -886,7 +886,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd, } } -int imximage_check_params(struct image_tool_params *params) +int imximage_check_params(struct imgtool *params) { if (!params) return CFG_INVALID; @@ -966,7 +966,7 @@ static void generate_fspi_header(int ifd) } #endif -static int imximage_generate(struct image_tool_params *params, +static int imximage_generate(struct imgtool *params, struct imgtool_funcs *tparams) { struct imx_header *imxhdr; diff --git a/tools/kwbimage.c b/tools/kwbimage.c index d6c7206868e..03c818221c2 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -486,7 +486,7 @@ static int kwb_load_rsa_key(const char *keydir, const char *name, RSA **p_rsa) return 0; } -static int kwb_load_cfg_key(struct image_tool_params *params, +static int kwb_load_cfg_key(struct imgtool *params, unsigned int cfg_option, const char *key_name, RSA **p_key) { @@ -513,12 +513,12 @@ static int kwb_load_cfg_key(struct image_tool_params *params, return 0; } -static int kwb_load_kak(struct image_tool_params *params, RSA **p_kak) +static int kwb_load_kak(struct imgtool *params, RSA **p_kak) { return kwb_load_cfg_key(params, IMAGE_CFG_KAK, "KAK", p_kak); } -static int kwb_load_csk(struct image_tool_params *params, RSA **p_csk) +static int kwb_load_csk(struct imgtool *params, RSA **p_csk) { return kwb_load_cfg_key(params, IMAGE_CFG_CSK, "CSK", p_csk); } @@ -929,7 +929,7 @@ done: return ret; } -static int image_fill_xip_header(void *image, struct image_tool_params *params) +static int image_fill_xip_header(void *image, struct imgtool *params) { struct main_hdr_v1 *main_hdr = image; /* kwbimage v0 and v1 have same XIP members */ int version = kwbimage_version(image); @@ -1039,7 +1039,7 @@ static size_t image_headersz_v0(int *hasext) return headersz; } -static void *image_create_v0(size_t *dataoff, struct image_tool_params *params, +static void *image_create_v0(size_t *dataoff, struct imgtool *params, int payloadsz) { struct image_cfg_element *e; @@ -1369,7 +1369,7 @@ static int export_pub_kak_hash(RSA *kak, struct secure_hdr_v1 *secure_hdr) return res < 0 ? 1 : 0; } -static int kwb_sign_csk_with_kak(struct image_tool_params *params, +static int kwb_sign_csk_with_kak(struct imgtool *params, struct secure_hdr_v1 *secure_hdr, RSA *csk) { RSA *kak = NULL; @@ -1411,7 +1411,7 @@ static int kwb_sign_csk_with_kak(struct image_tool_params *params, return 0; } -static int add_secure_header_v1(struct image_tool_params *params, uint8_t *image_ptr, +static int add_secure_header_v1(struct imgtool *params, uint8_t *image_ptr, size_t image_size, uint8_t *header_ptr, size_t headersz, struct secure_hdr_v1 *secure_hdr) { @@ -1474,7 +1474,7 @@ static void finish_register_set_header_v1(uint8_t **cur, uint8_t **next_ext, *datai = 0; } -static void *image_create_v1(size_t *dataoff, struct image_tool_params *params, +static void *image_create_v1(size_t *dataoff, struct imgtool *params, uint8_t *ptr, int payloadsz) { struct image_cfg_element *e; @@ -1905,7 +1905,7 @@ static int image_get_version(void) } static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { FILE *fcfg; void *image = NULL; @@ -1997,7 +1997,7 @@ static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd, free(image); } -static void kwbimage_print_header(const void *ptr, struct image_tool_params *params) +static void kwbimage_print_header(const void *ptr, struct imgtool *params) { struct main_hdr_v0 *mhdr = (struct main_hdr_v0 *)ptr; struct bin_hdr_v0 *bhdr; @@ -2052,7 +2052,7 @@ static int kwbimage_check_image_types(uint8_t type) } static int kwbimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { size_t header_size = kwbheader_size(ptr); uint8_t blockid; @@ -2159,7 +2159,7 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size, return 0; } -static int kwbimage_generate(struct image_tool_params *params, +static int kwbimage_generate(struct imgtool *params, struct imgtool_funcs *tparams) { FILE *fcfg; @@ -2291,7 +2291,7 @@ static int kwbimage_generate(struct image_tool_params *params, } } -static int kwbimage_generate_config(void *ptr, struct image_tool_params *params) +static int kwbimage_generate_config(void *ptr, struct imgtool *params) { struct main_hdr_v0 *mhdr0 = (struct main_hdr_v0 *)ptr; struct main_hdr_v1 *mhdr = (struct main_hdr_v1 *)ptr; @@ -2511,7 +2511,7 @@ static int kwbimage_generate_config(void *ptr, struct image_tool_params *params) return 0; } -static int kwbimage_extract_subimage(void *ptr, struct image_tool_params *params) +static int kwbimage_extract_subimage(void *ptr, struct imgtool *params) { struct main_hdr_v1 *mhdr = (struct main_hdr_v1 *)ptr; size_t header_size = kwbheader_size(ptr); @@ -2581,7 +2581,7 @@ static int kwbimage_extract_subimage(void *ptr, struct image_tool_params *params return imagetool_save_subimage(params->outfile, image, size); } -static int kwbimage_check_params(struct image_tool_params *params) +static int kwbimage_check_params(struct imgtool *params) { if (!params->lflag && !params->iflag && !params->pflag && (!params->imagename || !strlen(params->imagename))) { diff --git a/tools/lpc32xximage.c b/tools/lpc32xximage.c index 715a55a5b5b..d1e5efea44c 100644 --- a/tools/lpc32xximage.c +++ b/tools/lpc32xximage.c @@ -80,7 +80,7 @@ static int lpc32xximage_check_image_types(uint8_t type) } static int lpc32xximage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct nand_page_0_boot_header *hdr = (struct nand_page_0_boot_header *)ptr; @@ -125,7 +125,7 @@ static void print_hdr_byte(struct nand_page_0_boot_header *hdr, int ofs) printf("header[%d] = %02x\n", ofs, hdr->data[ofs]); } -static void lpc32xximage_print_header(const void *ptr, struct image_tool_params *params) +static void lpc32xximage_print_header(const void *ptr, struct imgtool *params) { struct nand_page_0_boot_header *hdr = (struct nand_page_0_boot_header *)ptr; @@ -137,7 +137,7 @@ static void lpc32xximage_print_header(const void *ptr, struct image_tool_params } static void lpc32xximage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct nand_page_0_boot_header *hdr = (struct nand_page_0_boot_header *)ptr; diff --git a/tools/mkimage.c b/tools/mkimage.c index 6e50254452d..03492c795aa 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -19,7 +19,7 @@ #endif /* parameters initialized by core will be used by the image type code */ -static struct image_tool_params params = { +static struct imgtool params = { .os = IH_OS_LINUX, .arch = IH_ARCH_PPC, .type = IH_TYPE_KERNEL, diff --git a/tools/mtk_image.c b/tools/mtk_image.c index 8a22b4ef789..deaa2ed930f 100644 --- a/tools/mtk_image.c +++ b/tools/mtk_image.c @@ -228,7 +228,7 @@ static int mtk_brom_parse_imagename(const char *imagename) return 0; } -static int mtk_image_check_params(struct image_tool_params *params) +static int mtk_image_check_params(struct imgtool *params) { if (!params->addr) { fprintf(stderr, "Error: Load Address must be set.\n"); @@ -243,7 +243,7 @@ static int mtk_image_check_params(struct image_tool_params *params) return mtk_brom_parse_imagename(params->imagename); } -static int mtk_image_vrec_header(struct image_tool_params *params, +static int mtk_image_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { if (use_lk_hdr) { @@ -488,7 +488,7 @@ static int mtk_image_verify_mt7621_header(const uint8_t *ptr, int print) } static int mtk_image_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr; union lk_hdr *lk = (union lk_hdr *)ptr; @@ -510,7 +510,7 @@ static int mtk_image_verify_header(unsigned char *ptr, int image_size, return -1; } -static void mtk_image_print_header(const void *ptr, struct image_tool_params *params) +static void mtk_image_print_header(const void *ptr, struct imgtool *params) { struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr; union lk_hdr *lk = (union lk_hdr *)ptr; @@ -730,7 +730,7 @@ static void mtk_image_set_mt7621_header(void *ptr, off_t filesize, } static void mtk_image_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { union lk_hdr *lk = (union lk_hdr *)ptr; diff --git a/tools/mxsimage.c b/tools/mxsimage.c index 45c6e3624c9..1e483a74c9d 100644 --- a/tools/mxsimage.c +++ b/tools/mxsimage.c @@ -2171,11 +2171,11 @@ static int mxsimage_check_image_types(uint8_t type) } static void mxsimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { } -int mxsimage_check_params(struct image_tool_params *params) +int mxsimage_check_params(struct imgtool *params) { if (!params) return -1; @@ -2216,7 +2216,7 @@ static int mxsimage_verify_print_header(char *file, int silent) char *imagefile; static int mxsimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct sb_boot_image_header *hdr; @@ -2238,7 +2238,7 @@ static int mxsimage_verify_header(unsigned char *ptr, int image_size, return mxsimage_verify_print_header(params->imagefile, 1); } -static void mxsimage_print_header(const void *hdr, struct image_tool_params *params) +static void mxsimage_print_header(const void *hdr, struct imgtool *params) { if (imagefile) mxsimage_verify_print_header(imagefile, 0); @@ -2314,7 +2314,7 @@ static int sb_build_image(struct sb_image_ctx *ictx, return 0; } -static int mxsimage_generate(struct image_tool_params *params, +static int mxsimage_generate(struct imgtool *params, struct imgtool_funcs *tparams) { int ret; diff --git a/tools/omapimage.c b/tools/omapimage.c index b79c1c3b648..428dc782f9b 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -37,7 +37,7 @@ static int omapimage_check_image_types(uint8_t type) } static int omapimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct ch_toc *toc = (struct ch_toc *)ptr; struct gp_header *gph = (struct gp_header *)(ptr+OMAP_CH_HDR_SIZE); @@ -85,7 +85,7 @@ static void omapimage_print_section(struct ch_settings *chs) chs->flags); } -static void omapimage_print_header(const void *ptr, struct image_tool_params *params) +static void omapimage_print_header(const void *ptr, struct imgtool *params) { const struct ch_toc *toc = (struct ch_toc *)ptr; const struct gp_header *gph = @@ -124,7 +124,7 @@ static int toc_offset(void *hdr, void *member) } static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct ch_toc *toc = (struct ch_toc *)ptr; struct ch_settings *chs = (struct ch_settings *) diff --git a/tools/pblimage.c b/tools/pblimage.c index 34650cf7b7c..17dff95c46d 100644 --- a/tools/pblimage.c +++ b/tools/pblimage.c @@ -185,7 +185,7 @@ static void add_end_cmd(void) pbl_size += 4; } -void pbl_load_uboot(int ifd, struct image_tool_params *params) +void pbl_load_uboot(int ifd, struct imgtool *params) { FILE *fp_uboot; int size, ret; @@ -232,7 +232,7 @@ static int pblimage_check_image_types(uint8_t type) } static int pblimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct pbl_header *pbl_hdr = (struct pbl_header *) ptr; uint32_t rcwheader; @@ -259,18 +259,18 @@ static int pblimage_verify_header(unsigned char *ptr, int image_size, return 0; } -static void pblimage_print_header(const void *ptr, struct image_tool_params *params) +static void pblimage_print_header(const void *ptr, struct imgtool *params) { printf("Image Type: Freescale PBL Boot Image\n"); } static void pblimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { /*nothing need to do, pbl_load_uboot takes care of whole file. */ } -int pblimage_check_params(struct image_tool_params *params) +int pblimage_check_params(struct imgtool *params) { FILE *fp_uboot; int fd; diff --git a/tools/renesas_spkgimage.c b/tools/renesas_spkgimage.c index ed80aec3c6b..8cc3a62081a 100644 --- a/tools/renesas_spkgimage.c +++ b/tools/renesas_spkgimage.c @@ -115,7 +115,7 @@ static int spkgimage_parse_config_file(char *filename) return 0; } -static int spkgimage_check_params(struct image_tool_params *params) +static int spkgimage_check_params(struct imgtool *params) { if (!params->addr) { fprintf(stderr, "Error: Load Address must be set.\n"); @@ -136,7 +136,7 @@ static int spkgimage_check_params(struct image_tool_params *params) } static int spkgimage_verify_header(unsigned char *ptr, int size, - struct image_tool_params *param) + struct imgtool *param) { struct spkg_file *file = (struct spkg_file *)ptr; struct spkg_hdr *header = (struct spkg_hdr *)ptr; @@ -182,8 +182,7 @@ static int spkgimage_verify_header(unsigned char *ptr, int size, return 0; } -static void spkgimage_print_header(const void *ptr, - struct image_tool_params *image) +static void spkgimage_print_header(const void *ptr, struct imgtool *image) { const struct spkg_hdr *h = ptr; uint32_t offset = le32_to_cpu(h->execution_offset); @@ -216,7 +215,7 @@ static inline uint32_t roundup(uint32_t x, uint32_t y) return ((x + y - 1) / y) * y; } -static int spkgimage_vrec_header(struct image_tool_params *params, +static int spkgimage_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { struct stat s; @@ -282,7 +281,7 @@ static int spkgimage_vrec_header(struct image_tool_params *params, } static void spkgimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { uint8_t *payload = ptr + SPKG_HEADER_SIZE * SPKG_HEADER_COUNT; uint8_t *file_end = payload + conf.blp_len + params->orig_file_size; diff --git a/tools/rkcommon.c b/tools/rkcommon.c index f938b524329..860008d4c81 100644 --- a/tools/rkcommon.c +++ b/tools/rkcommon.c @@ -177,7 +177,7 @@ static struct spl_info *rkcommon_get_spl_info(char *imagename) return NULL; } -static int rkcommon_get_aligned_size(struct image_tool_params *params, +static int rkcommon_get_aligned_size(struct imgtool *params, const char *fname) { int size; @@ -193,7 +193,7 @@ static int rkcommon_get_aligned_size(struct image_tool_params *params, return ROUND(size, RK_SIZE_ALIGN); } -int rkcommon_check_params(struct image_tool_params *params) +int rkcommon_check_params(struct imgtool *params) { int i, size; @@ -249,7 +249,7 @@ err_spl_info: return EXIT_FAILURE; } -const char *rkcommon_get_spl_hdr(struct image_tool_params *params) +const char *rkcommon_get_spl_hdr(struct imgtool *params) { struct spl_info *info = rkcommon_get_spl_info(params->imagename); @@ -259,7 +259,7 @@ const char *rkcommon_get_spl_hdr(struct image_tool_params *params) return info->spl_hdr; } -int rkcommon_get_spl_size(struct image_tool_params *params) +int rkcommon_get_spl_size(struct imgtool *params) { struct spl_info *info = rkcommon_get_spl_info(params->imagename); @@ -269,7 +269,7 @@ int rkcommon_get_spl_size(struct image_tool_params *params) return info->spl_size; } -bool rkcommon_need_rc4_spl(struct image_tool_params *params) +bool rkcommon_need_rc4_spl(struct imgtool *params) { struct spl_info *info = rkcommon_get_spl_info(params->imagename); @@ -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) +bool rkcommon_is_header_v2(struct imgtool *params) { struct spl_info *info = rkcommon_get_spl_info(params->imagename); @@ -295,7 +295,7 @@ static void do_sha256_hash(uint8_t *buf, uint32_t size, uint8_t *out) sha256_finish(&ctx, out); } -static void rkcommon_set_header0(void *buf, struct image_tool_params *params) +static void rkcommon_set_header0(void *buf, struct imgtool *params) { struct header0_info *hdr = buf; uint32_t init_boot_size; @@ -323,7 +323,7 @@ static void rkcommon_set_header0(void *buf, struct image_tool_params *params) rc4_encode(buf, RK_BLK_SIZE, rc4_key); } -static void rkcommon_set_header0_v2(void *buf, struct image_tool_params *params) +static void rkcommon_set_header0_v2(void *buf, struct imgtool *params) { struct header0_info_v2 *hdr = buf; uint32_t sector_offset, image_sector_count; @@ -357,7 +357,7 @@ static void rkcommon_set_header0_v2(void *buf, struct image_tool_params *params) } void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct header1_info *hdr = buf + RK_SPL_HDR_START; @@ -449,7 +449,7 @@ static int rkcommon_parse_header_v2(const void *buf, struct header0_info_v2 *hea } int rkcommon_verify_header(unsigned char *buf, int size, - struct image_tool_params *params) + struct imgtool *params) { struct header0_info header0; struct spl_info *img_spl_info, *spl_info; @@ -483,7 +483,7 @@ int rkcommon_verify_header(unsigned char *buf, int size, return -ENOENT; } -void rkcommon_print_header(const void *buf, struct image_tool_params *params) +void rkcommon_print_header(const void *buf, struct imgtool *params) { struct header0_info header0; struct header0_info_v2 header0_v2; @@ -543,7 +543,7 @@ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size) } } -int rkcommon_vrec_header(struct image_tool_params *params, +int rkcommon_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { /* @@ -591,7 +591,7 @@ int rkcommon_vrec_header(struct image_tool_params *params, return 0; } -static int pad_file(struct image_tool_params *params, int ifd, int pad) +static int pad_file(struct imgtool *params, int ifd, int pad) { uint8_t zeros[4096]; @@ -614,7 +614,7 @@ static int pad_file(struct image_tool_params *params, int ifd, int pad) return 0; } -static int copy_file(struct image_tool_params *params, int ifd, +static int copy_file(struct imgtool *params, int ifd, const char *file, int padded_size) { int dfd; @@ -667,7 +667,7 @@ err_close: return -1; } -int rockchip_copy_image(int ifd, struct image_tool_params *params) +int rockchip_copy_image(int ifd, struct imgtool *params) { int ret; diff --git a/tools/rkcommon.h b/tools/rkcommon.h index 792a046c7af..50db6d3799c 100644 --- a/tools/rkcommon.h +++ b/tools/rkcommon.h @@ -21,7 +21,7 @@ enum { * * Return: 0 if OK, -1 if ERROR. */ -int rkcommon_check_params(struct image_tool_params *params); +int rkcommon_check_params(struct imgtool *params); /** * rkcommon_get_spl_hdr() - get 4-bytes spl hdr for a Rockchip boot image @@ -29,7 +29,7 @@ int rkcommon_check_params(struct image_tool_params *params); * Rockchip's bootrom requires the spl loader to start with a 4-bytes * header. The content of this header depends on the chip type. */ -const char *rkcommon_get_spl_hdr(struct image_tool_params *params); +const char *rkcommon_get_spl_hdr(struct imgtool *params); /** * rkcommon_get_spl_size() - get spl size for a Rockchip boot image @@ -39,7 +39,7 @@ const char *rkcommon_get_spl_hdr(struct image_tool_params *params); * for the bootrom. * The spl loader size should be sram size minus reserved size(if needed) */ -int rkcommon_get_spl_size(struct image_tool_params *params); +int rkcommon_get_spl_size(struct imgtool *params); /** * rkcommon_set_header() - set up the header for a Rockchip boot image @@ -49,7 +49,7 @@ int rkcommon_get_spl_size(struct image_tool_params *params); * @buf: Pointer to header place (must be at least 2KB in size) */ void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, - struct image_tool_params *params); + struct imgtool *params); /** * rkcommon_verify_header() - verify the header for a Rockchip boot image @@ -59,7 +59,7 @@ void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, * Return: 0 if OK */ int rkcommon_verify_header(unsigned char *buf, int size, - struct image_tool_params *params); + struct imgtool *params); /** * rkcommon_print_header() - print the header for a Rockchip boot image @@ -68,7 +68,7 @@ int rkcommon_verify_header(unsigned char *buf, int size, * * @buf: Pointer to the image (can be a read-only file-mapping) */ -void rkcommon_print_header(const void *buf, struct image_tool_params *params); +void rkcommon_print_header(const void *buf, struct imgtool *params); /** * rkcommon_need_rc4_spl() - check if rc4 encoded spl is required @@ -78,7 +78,7 @@ void rkcommon_print_header(const void *buf, struct image_tool_params *params); * handle unencrypted binaries. * Return: true or false depending on rc4 being required. */ -bool rkcommon_need_rc4_spl(struct image_tool_params *params); +bool rkcommon_need_rc4_spl(struct imgtool *params); /** * rkcommon_rc4_encode_spl() - encode the spl binary @@ -101,7 +101,7 @@ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size); * * Return: 0 (always) */ -int rkcommon_vrec_header(struct image_tool_params *params, +int rkcommon_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams); #endif diff --git a/tools/rkimage.c b/tools/rkimage.c index 1c5540b1c3d..0fcf75f1b90 100644 --- a/tools/rkimage.c +++ b/tools/rkimage.c @@ -13,7 +13,7 @@ static uint32_t header; static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { memcpy(buf, rkcommon_get_spl_hdr(params), RK_SPL_HDR_SIZE); diff --git a/tools/rkspi.c b/tools/rkspi.c index 284d9dbc02c..4409b96dc10 100644 --- a/tools/rkspi.c +++ b/tools/rkspi.c @@ -17,7 +17,7 @@ enum { }; static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { int sector; unsigned int size; @@ -57,7 +57,7 @@ static int rkspi_check_image_type(uint8_t type) * The SPI payload needs to make space for odd half-sector layout used in flash * (i.e. only the first 2K of each 4K sector is used). */ -static int rkspi_vrec_header(struct image_tool_params *params, +static int rkspi_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { rkcommon_vrec_header(params, tparams); diff --git a/tools/sfspl.c b/tools/sfspl.c index e0c15243c9d..996f9009c52 100644 --- a/tools/sfspl.c +++ b/tools/sfspl.c @@ -46,7 +46,7 @@ struct spl_hdr { unsigned int zero2[91]; }; -static int sfspl_check_params(struct image_tool_params *params) +static int sfspl_check_params(struct imgtool *params) { /* Only the RISC-V architecture is supported */ if (params->Aflag && params->arch != IH_ARCH_RISCV) @@ -56,7 +56,7 @@ static int sfspl_check_params(struct image_tool_params *params) } static int sfspl_verify_header(unsigned char *buf, int size, - struct image_tool_params *params) + struct imgtool *params) { struct spl_hdr *hdr = (void *)buf; unsigned int hdr_size = le32_to_cpu(hdr->hdr_size); @@ -87,7 +87,7 @@ static int sfspl_verify_header(unsigned char *buf, int size, } static void sfspl_print_header(const void *buf, - struct image_tool_params *params) + struct imgtool *params) { struct spl_hdr *hdr = (void *)buf; unsigned int hdr_size = le32_to_cpu(hdr->hdr_size); @@ -98,7 +98,7 @@ static void sfspl_print_header(const void *buf, } static int sfspl_image_extract_subimage(void *ptr, - struct image_tool_params *params) + struct imgtool *params) { struct spl_hdr *hdr = (void *)ptr; unsigned char *buf = ptr; @@ -134,7 +134,7 @@ static int sfspl_check_image_type(uint8_t type) } static void sfspl_set_header(void *buf, struct stat *sbuf, int infd, - struct image_tool_params *params) + struct imgtool *params) { struct spl_hdr *hdr = buf; unsigned int file_size; @@ -152,7 +152,7 @@ static void sfspl_set_header(void *buf, struct stat *sbuf, int infd, hdr->crc32 = cpu_to_le32(crc); } -static int sfspl_vrec_header(struct image_tool_params *params, +static int sfspl_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { tparams->hdr = calloc(sizeof(struct spl_hdr), 1); diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c index 64c5f498355..9f3b459a243 100644 --- a/tools/socfpgaimage.c +++ b/tools/socfpgaimage.c @@ -131,7 +131,7 @@ static uint16_t sfp_hdr_checksum(uint8_t *buf, unsigned char ver) static void sfp_build_header(uint8_t *buf, uint8_t ver, uint8_t flags, uint32_t length_bytes, - struct image_tool_params *params) + struct imgtool *params) { uint32_t entry_offset = params->eflag ? params->ep : ENTRY_POINT_OFFSET; struct socfpga_header_v0 header_v0 = { @@ -212,7 +212,7 @@ static int sfp_verify_header(const uint8_t *buf, uint8_t *ver) /* Sign the buffer and return the signed buffer size */ static int sfp_sign_buffer(uint8_t *buf, uint8_t ver, uint8_t flags, int len, int pad_64k, - struct image_tool_params *params) + struct imgtool *params) { uint32_t calc_crc; uint32_t crc_off; @@ -275,7 +275,7 @@ static int sfp_verify_buffer(const uint8_t *buf) /* mkimage glue functions */ static int socfpgaimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { if (image_size < 0x80) return -1; @@ -313,7 +313,7 @@ static void socfpgaimage_print_header_v1(struct socfpga_header_v1 *header) le16_to_cpu(header->checksum)); } -static void socfpgaimage_print_header(const void *ptr, struct image_tool_params *params) +static void socfpgaimage_print_header(const void *ptr, struct imgtool *params) { const void *header = ptr + HEADER_OFFSET; struct socfpga_header_v0 *header_v0; @@ -330,7 +330,7 @@ static void socfpgaimage_print_header(const void *ptr, struct image_tool_params } } -static int socfpgaimage_check_params_v0(struct image_tool_params *params) +static int socfpgaimage_check_params_v0(struct imgtool *params) { /* Not sure if we should be accepting fflags */ return (params->dflag && (params->fflag || params->lflag)) || @@ -338,7 +338,7 @@ static int socfpgaimage_check_params_v0(struct image_tool_params *params) (params->lflag && (params->dflag || params->fflag)); } -static int socfpgaimage_check_params_v1(struct image_tool_params *params) +static int socfpgaimage_check_params_v1(struct imgtool *params) { /* * If the entry point is specified, ensure it is >= ENTRY_POINT_OFFSET @@ -397,7 +397,7 @@ static int sfp_fake_header_size(unsigned int size, uint8_t ver) return align_size - size; } -static int sfp_vrec_header(struct image_tool_params *params, +static int sfp_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams, uint8_t ver) { struct stat sbuf; @@ -412,20 +412,20 @@ static int sfp_vrec_header(struct image_tool_params *params, } -static int socfpgaimage_vrec_header_v0(struct image_tool_params *params, +static int socfpgaimage_vrec_header_v0(struct imgtool *params, struct imgtool_funcs *tparams) { return sfp_vrec_header(params, tparams, 0); } -static int socfpgaimage_vrec_header_v1(struct image_tool_params *params, +static int socfpgaimage_vrec_header_v1(struct imgtool *params, struct imgtool_funcs *tparams) { return sfp_vrec_header(params, tparams, 1); } static void sfp_set_header(void *ptr, unsigned char ver, - struct image_tool_params *params) + struct imgtool *params) { uint8_t *buf = (uint8_t *)ptr; @@ -443,13 +443,13 @@ static void sfp_set_header(void *ptr, unsigned char ver, } static void socfpgaimage_set_header_v0(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { sfp_set_header(ptr, 0, params); } static void socfpgaimage_set_header_v1(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { sfp_set_header(ptr, 1, params); } diff --git a/tools/stm32image.c b/tools/stm32image.c index 5c6991f35de..52511af51e8 100644 --- a/tools/stm32image.c +++ b/tools/stm32image.c @@ -78,7 +78,7 @@ static int stm32image_check_image_types(uint8_t type) } static int stm32image_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct stm32_header *stm32hdr = (struct stm32_header *)ptr; int i; @@ -99,7 +99,7 @@ static int stm32image_verify_header(unsigned char *ptr, int image_size, return 0; } -static void stm32image_print_header(const void *ptr, struct image_tool_params *params) +static void stm32image_print_header(const void *ptr, struct imgtool *params) { struct stm32_header *stm32hdr = (struct stm32_header *)ptr; @@ -121,7 +121,7 @@ static void stm32image_print_header(const void *ptr, struct image_tool_params *p } static void stm32image_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct stm32_header *stm32hdr = (struct stm32_header *)ptr; diff --git a/tools/sunxi_egon.c b/tools/sunxi_egon.c index d0a55226a9e..26031497257 100644 --- a/tools/sunxi_egon.c +++ b/tools/sunxi_egon.c @@ -15,7 +15,7 @@ #define PAD_SIZE 8192 #define PAD_SIZE_MIN 512 -static int egon_get_arch(struct image_tool_params *params) +static int egon_get_arch(struct imgtool *params) { if (params->Aflag) return params->arch; @@ -24,7 +24,7 @@ static int egon_get_arch(struct image_tool_params *params) return IH_ARCH_ARM; } -static int egon_check_params(struct image_tool_params *params) +static int egon_check_params(struct imgtool *params) { /* * Check whether the architecture is supported. @@ -42,7 +42,7 @@ static int egon_check_params(struct image_tool_params *params) } static int egon_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { const struct boot_file_head *header = (void *)ptr; uint32_t length; @@ -82,7 +82,7 @@ static int egon_verify_header(unsigned char *ptr, int image_size, return EXIT_SUCCESS; } -static void egon_print_header(const void *buf, struct image_tool_params *params) +static void egon_print_header(const void *buf, struct imgtool *params) { const struct boot_file_head *header = buf; @@ -104,7 +104,7 @@ static void egon_print_header(const void *buf, struct image_tool_params *params) } static void egon_set_header(void *buf, struct stat *sbuf, int infd, - struct image_tool_params *params) + struct imgtool *params) { struct boot_file_head *header = buf; uint32_t *buf32 = buf; @@ -171,7 +171,7 @@ static int egon_check_image_type(uint8_t type) return type == IH_TYPE_SUNXI_EGON ? 0 : 1; } -static int egon_vrec_header(struct image_tool_params *params, +static int egon_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { int pad_size = ALIGN(params->bl_len ?: PAD_SIZE, PAD_SIZE_MIN); diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c index e52cbe325a3..478c1abcbb4 100644 --- a/tools/sunxi_toc0.c +++ b/tools/sunxi_toc0.c @@ -667,7 +667,7 @@ err: return ret; } -static int toc0_check_params(struct image_tool_params *params) +static int toc0_check_params(struct imgtool *params) { if (!params->dflag) return -EINVAL; @@ -717,7 +717,7 @@ static int toc0_check_params(struct image_tool_params *params) } static int toc0_verify_header(unsigned char *buf, int image_size, - struct image_tool_params *params) + struct imgtool *params) { int ret = EXIT_FAILURE; RSA *root_key = NULL; @@ -757,7 +757,7 @@ static const char *toc0_item_name(uint32_t name) return "(unknown)"; } -static void toc0_print_header(const void *buf, struct image_tool_params *params) +static void toc0_print_header(const void *buf, struct imgtool *params) { const struct toc0_main_info *main_info = buf; const struct toc0_item_info *item_info = (void *)(main_info + 1); @@ -802,7 +802,7 @@ static void toc0_print_header(const void *buf, struct image_tool_params *params) } static void toc0_set_header(void *buf, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { uint32_t key_item_len = 0; uint8_t *key_item = NULL; @@ -888,7 +888,7 @@ static int toc0_check_image_type(uint8_t type) return type == IH_TYPE_SUNXI_TOC0 ? 0 : 1; } -static int toc0_vrec_header(struct image_tool_params *params, +static int toc0_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { tparams->hdr = calloc(tparams->header_size, 1); diff --git a/tools/ublimage.c b/tools/ublimage.c index a1bd807bfa0..70514285111 100644 --- a/tools/ublimage.c +++ b/tools/ublimage.c @@ -193,7 +193,7 @@ static int ublimage_check_image_types(uint8_t type) } static int ublimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct ubl_header *ubl_hdr = (struct ubl_header *)ptr; @@ -203,7 +203,7 @@ static int ublimage_verify_header(unsigned char *ptr, int image_size, return 0; } -static void ublimage_print_header(const void *ptr, struct image_tool_params *params) +static void ublimage_print_header(const void *ptr, struct imgtool *params) { struct ubl_header *ubl_hdr = (struct ubl_header *) ptr; @@ -211,7 +211,7 @@ static void ublimage_print_header(const void *ptr, struct image_tool_params *par } static void ublimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct ubl_header *ublhdr = (struct ubl_header *)ptr; @@ -219,7 +219,7 @@ static void ublimage_set_header(void *ptr, struct stat *sbuf, int ifd, parse_cfg_file(ublhdr, params->imagename); } -int ublimage_check_params(struct image_tool_params *params) +int ublimage_check_params(struct imgtool *params) { if (!params) return CFG_INVALID; diff --git a/tools/vybridimage.c b/tools/vybridimage.c index c38886fa903..31119d04554 100644 --- a/tools/vybridimage.c +++ b/tools/vybridimage.c @@ -59,7 +59,7 @@ static uint8_t vybridimage_sw_ecc(uint8_t byte) } static int vybridimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct nand_page_0_boot_header *hdr = (struct nand_page_0_boot_header *)ptr; @@ -93,7 +93,7 @@ static int vybridimage_verify_header(unsigned char *ptr, int image_size, } static void vybridimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct nand_page_0_boot_header *hdr = (struct nand_page_0_boot_header *)ptr; @@ -134,7 +134,7 @@ static void vybridimage_print_hdr_field(struct nand_page_0_boot_header *hdr, printf("header.fcb[%d] = %08x\n", idx, hdr->fcb[idx]); } -static void vybridimage_print_header(const void *ptr, struct image_tool_params *params) +static void vybridimage_print_header(const void *ptr, struct imgtool *params) { struct nand_page_0_boot_header *hdr = (struct nand_page_0_boot_header *)ptr; diff --git a/tools/zynqimage.c b/tools/zynqimage.c index 359c93d1acd..af7b6f65629 100644 --- a/tools/zynqimage.c +++ b/tools/zynqimage.c @@ -139,7 +139,7 @@ static void zynqimage_default_header(struct zynq_header *ptr) /* mkimage glue functions */ static int zynqimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct zynq_header *zynqhdr = (struct zynq_header *)ptr; @@ -163,7 +163,7 @@ static int zynqimage_verify_header(unsigned char *ptr, int image_size, return 0; } -static void zynqimage_print_header(const void *ptr, struct image_tool_params *params) +static void zynqimage_print_header(const void *ptr, struct imgtool *params) { struct zynq_header *zynqhdr = (struct zynq_header *)ptr; int i; @@ -198,7 +198,7 @@ static void zynqimage_print_header(const void *ptr, struct image_tool_params *pa } } -static int zynqimage_check_params(struct image_tool_params *params) +static int zynqimage_check_params(struct imgtool *params) { if (!params) return 0; @@ -266,7 +266,7 @@ static void zynqimage_parse_initparams(struct zynq_header *zynqhdr, } static void zynqimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct zynq_header *zynqhdr = (struct zynq_header *)ptr; zynqimage_default_header(zynqhdr); diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c index 82ce0ac1a52..f8acc07244f 100644 --- a/tools/zynqmpbif.c +++ b/tools/zynqmpbif.c @@ -84,7 +84,7 @@ static uint32_t zynqmp_csum(void *start, void *end) return ~checksum; } -static int zynqmpbif_check_params(struct image_tool_params *params) +static int zynqmpbif_check_params(struct imgtool *params) { if (!params) return 0; @@ -825,7 +825,7 @@ static char *skip_whitespace(char *str) return str; } -int zynqmpbif_copy_image(int outfd, struct image_tool_params *mparams) +int zynqmpbif_copy_image(int outfd, struct imgtool *mparams) { char *bif, *bifp, *bifpn; char *line; @@ -995,7 +995,7 @@ err: /* Needs to be stubbed out so we can print after creation */ static void zynqmpbif_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { } diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index a075ac22bdd..5bef2a935bb 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -117,7 +117,7 @@ void zynqmpimage_default_header(struct zynqmp_header *ptr) /* mkimage glue functions */ static int zynqmpimage_verify_header(unsigned char *ptr, int image_size, - struct image_tool_params *params) + struct imgtool *params) { struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; @@ -263,7 +263,7 @@ static void print_partition(const void *ptr, const struct partition_header *ph) printf(" Checksum : 0x%08x\n", le32_to_cpu(ph->checksum)); } -void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params) +void zynqmpimage_print_header(const void *ptr, struct imgtool *params) { struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; struct partition_header *ph; @@ -311,7 +311,7 @@ void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params) free(dynamic_header); } -static int zynqmpimage_check_params(struct image_tool_params *params) +static int zynqmpimage_check_params(struct imgtool *params) { if (!params) return 0; @@ -439,7 +439,7 @@ static void zynqmpimage_parse_initparams(struct zynqmp_header *zynqhdr, } static void zynqmpimage_set_header(void *ptr, struct stat *sbuf, int ifd, - struct image_tool_params *params) + struct imgtool *params) { struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; zynqmpimage_default_header(zynqhdr); @@ -483,7 +483,7 @@ static int zynqmpimage_partition_extract(struct zynqmp_header *zynqhdr, * returns: * zero in case of success or a negative value if fail. */ -static int zynqmpimage_extract_contents(void *ptr, struct image_tool_params *params) +static int zynqmpimage_extract_contents(void *ptr, struct imgtool *params) { struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; struct partition_header *ph; @@ -498,7 +498,7 @@ static int zynqmpimage_extract_contents(void *ptr, struct image_tool_params *par return -1; } -static int zynqmpimage_vrec_header(struct image_tool_params *params, +static int zynqmpimage_vrec_header(struct imgtool *params, struct imgtool_funcs *tparams) { struct stat path_stat; diff --git a/tools/zynqmpimage.h b/tools/zynqmpimage.h index 7c47dc0763b..a79d4773d2c 100644 --- a/tools/zynqmpimage.h +++ b/tools/zynqmpimage.h @@ -141,7 +141,7 @@ struct zynqmp_header { }; void zynqmpimage_default_header(struct zynqmp_header *ptr); -void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params); +void zynqmpimage_print_header(const void *ptr, struct imgtool *params); static inline struct image_header_table * zynqmp_get_iht(const struct zynqmp_header *zynqhdr) -- 2.43.0