From: "Pali Rohár" <pali@kernel.org>
To: Martin Rowe <martin.p.rowe@gmail.com>,
Tony Dinh <mibodhi@gmail.com>, Stefan Roese <sr@denx.de>,
Chris Packham <judge.packham@gmail.com>,
Baruch Siach <baruch@tkos.co.il>
Cc: u-boot@lists.denx.de
Subject: [PATCH u-boot-mvebu 3/7] tools: imagetool: Extend print_header() by params argument
Date: Wed, 29 Mar 2023 21:25:54 +0200 [thread overview]
Message-ID: <20230329192558.12417-4-pali@kernel.org> (raw)
In-Reply-To: <20230329192558.12417-1-pali@kernel.org>
This allows image type print_header() callback to access struct
image_tool_params *params.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
tools/aisimage.c | 2 +-
tools/atmelimage.c | 2 +-
tools/default_image.c | 7 ++++++-
tools/fit_common.c | 5 +++++
tools/fit_common.h | 2 ++
tools/fit_image.c | 2 +-
tools/gpimage.c | 2 +-
tools/imagetool.c | 4 ++--
tools/imagetool.h | 2 +-
tools/imx8image.c | 2 +-
tools/imx8mimage.c | 2 +-
tools/imximage.c | 2 +-
tools/kwbimage.c | 2 +-
tools/lpc32xximage.c | 2 +-
tools/mkimage.c | 2 +-
tools/mtk_image.c | 2 +-
tools/mxsimage.c | 2 +-
tools/omapimage.c | 2 +-
tools/pblimage.c | 2 +-
tools/rkcommon.c | 2 +-
tools/rkcommon.h | 2 +-
tools/socfpgaimage.c | 2 +-
tools/stm32image.c | 2 +-
tools/sunxi_egon.c | 2 +-
tools/sunxi_toc0.c | 2 +-
tools/ublimage.c | 2 +-
tools/vybridimage.c | 2 +-
tools/zynqimage.c | 2 +-
tools/zynqmpimage.c | 2 +-
tools/zynqmpimage.h | 2 +-
30 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/tools/aisimage.c b/tools/aisimage.c
index b8b3ee32070f..c5b33b559b02 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)
+static void aisimage_print_header(const void *hdr, struct image_tool_params *params)
{
struct ais_header *ais_hdr = (struct ais_header *)hdr;
uint32_t *ptr;
diff --git a/tools/atmelimage.c b/tools/atmelimage.c
index 7b3b243d58b7..6a2d9d8feab2 100644
--- a/tools/atmelimage.c
+++ b/tools/atmelimage.c
@@ -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)
+static void atmel_print_header(const void *ptr, struct image_tool_params *params)
{
uint32_t *ints = (uint32_t *)ptr;
size_t pos;
diff --git a/tools/default_image.c b/tools/default_image.c
index dc429ce9e462..0e49ab330156 100644
--- a/tools/default_image.c
+++ b/tools/default_image.c
@@ -41,6 +41,11 @@ static int image_check_params(struct image_tool_params *params)
(params->lflag && (params->dflag || params->fflag)));
}
+static void image_print_header(const void *ptr, struct image_tool_params *params)
+{
+ image_print_contents(ptr);
+}
+
static int image_verify_header(unsigned char *ptr, int image_size,
struct image_tool_params *params)
{
@@ -201,7 +206,7 @@ U_BOOT_IMAGE_TYPE(
(void *)&header,
image_check_params,
image_verify_header,
- image_print_contents,
+ image_print_header,
image_set_header,
image_extract_subimage,
image_check_image_types,
diff --git a/tools/fit_common.c b/tools/fit_common.c
index 01649760ac00..2d417d471988 100644
--- a/tools/fit_common.c
+++ b/tools/fit_common.c
@@ -23,6 +23,11 @@
#include <image.h>
#include <u-boot/crc.h>
+void fit_print_header(const void *fit, struct image_tool_params *params)
+{
+ fit_print_contents(fit);
+}
+
int fit_verify_header(unsigned char *ptr, int image_size,
struct image_tool_params *params)
{
diff --git a/tools/fit_common.h b/tools/fit_common.h
index 920a16acfdb2..2da4b9422d44 100644
--- a/tools/fit_common.h
+++ b/tools/fit_common.h
@@ -10,6 +10,8 @@
#include "mkimage.h"
#include <image.h>
+void fit_print_header(const void *fit, struct image_tool_params *params);
+
/**
* Verify the format of FIT header pointed to by ptr
*
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 8763a36d01e7..9fe69ea0d9f8 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -944,7 +944,7 @@ U_BOOT_IMAGE_TYPE(
(void *)&header,
fit_check_params,
fit_verify_header,
- fit_print_contents,
+ fit_print_header,
NULL,
fit_extract_contents,
fit_check_image_types,
diff --git a/tools/gpimage.c b/tools/gpimage.c
index 27de4cfaed77..d2bc79d46b9e 100644
--- a/tools/gpimage.c
+++ b/tools/gpimage.c
@@ -41,7 +41,7 @@ static int gpimage_verify_header(unsigned char *ptr, int image_size,
return gph_verify_header(gph, 1);
}
-static void gpimage_print_header(const void *ptr)
+static void gpimage_print_header(const void *ptr, struct image_tool_params *params)
{
const struct gp_header *gph = (struct gp_header *)ptr;
diff --git a/tools/imagetool.c b/tools/imagetool.c
index 87eee4ad04ed..b293211cf882 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -66,7 +66,7 @@ int imagetool_verify_print_header(
*/
if ((*curr)->print_header) {
if (!params->quiet)
- (*curr)->print_header(ptr);
+ (*curr)->print_header(ptr, params);
} else {
fprintf(stderr,
"%s: print_header undefined for %s\n",
@@ -103,7 +103,7 @@ static int imagetool_verify_print_header_by_type(
*/
if (tparams->print_header) {
if (!params->quiet)
- tparams->print_header(ptr);
+ tparams->print_header(ptr, params);
} else {
fprintf(stderr,
"%s: print_header undefined for %s\n",
diff --git a/tools/imagetool.h b/tools/imagetool.h
index fdceea46c090..a766aa2ae91f 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -132,7 +132,7 @@ struct image_type_params {
*/
int (*verify_header) (unsigned char *, int, struct image_tool_params *);
/* Prints image information abstracting from image header */
- void (*print_header) (const void *);
+ void (*print_header) (const void *, struct image_tool_params *);
/*
* The header or image contents need to be set as per image type to
* be generated using this callback function.
diff --git a/tools/imx8image.c b/tools/imx8image.c
index c25ea84e25c5..76d0cd62dcc8 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -30,7 +30,7 @@ static void imx8image_set_header(void *ptr, struct stat *sbuf, int ifd,
{
}
-static void imx8image_print_header(const void *ptr)
+static void imx8image_print_header(const void *ptr, struct image_tool_params *params)
{
}
diff --git a/tools/imx8mimage.c b/tools/imx8mimage.c
index 3ca79d865aa1..21075c23799a 100644
--- a/tools/imx8mimage.c
+++ b/tools/imx8mimage.c
@@ -60,7 +60,7 @@ static void imx8mimage_set_header(void *ptr, struct stat *sbuf, int ifd,
{
}
-static void imx8mimage_print_header(const void *ptr)
+static void imx8mimage_print_header(const void *ptr, struct image_tool_params *params)
{
}
diff --git a/tools/imximage.c b/tools/imximage.c
index 354ee34c14a4..b3da1f244cd9 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -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)
+static void imximage_print_header(const void *ptr, struct image_tool_params *params)
{
struct imx_header *imx_hdr = (struct imx_header *) ptr;
uint32_t version = detect_imximage_version(imx_hdr);
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 177084adf825..8e573d9eea37 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1972,7 +1972,7 @@ static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd,
free(image);
}
-static void kwbimage_print_header(const void *ptr)
+static void kwbimage_print_header(const void *ptr, struct image_tool_params *params)
{
struct main_hdr_v0 *mhdr = (struct main_hdr_v0 *)ptr;
struct bin_hdr_v0 *bhdr;
diff --git a/tools/lpc32xximage.c b/tools/lpc32xximage.c
index 37931f91840c..715a55a5b5b3 100644
--- a/tools/lpc32xximage.c
+++ b/tools/lpc32xximage.c
@@ -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)
+static void lpc32xximage_print_header(const void *ptr, struct image_tool_params *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 a92d9d5ca57c..6dfe3e1d42d9 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -790,7 +790,7 @@ int main(int argc, char **argv)
/* Print the image information by processing image header */
if (tparams->print_header)
- tparams->print_header (ptr);
+ tparams->print_header (ptr, ¶ms);
else {
fprintf (stderr, "%s: Can't print header for %s\n",
params.cmdname, tparams->name);
diff --git a/tools/mtk_image.c b/tools/mtk_image.c
index 5ef9334163de..30f54c8e8d86 100644
--- a/tools/mtk_image.c
+++ b/tools/mtk_image.c
@@ -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)
+static void mtk_image_print_header(const void *ptr, struct image_tool_params *params)
{
struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
union lk_hdr *lk = (union lk_hdr *)ptr;
diff --git a/tools/mxsimage.c b/tools/mxsimage.c
index fbe46c47faee..ead61d0cd631 100644
--- a/tools/mxsimage.c
+++ b/tools/mxsimage.c
@@ -2239,7 +2239,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)
+static void mxsimage_print_header(const void *hdr, struct image_tool_params *params)
{
if (imagefile)
mxsimage_verify_print_header(imagefile, 0);
diff --git a/tools/omapimage.c b/tools/omapimage.c
index c59cdcc79b3d..b79c1c3b648b 100644
--- a/tools/omapimage.c
+++ b/tools/omapimage.c
@@ -85,7 +85,7 @@ static void omapimage_print_section(struct ch_settings *chs)
chs->flags);
}
-static void omapimage_print_header(const void *ptr)
+static void omapimage_print_header(const void *ptr, struct image_tool_params *params)
{
const struct ch_toc *toc = (struct ch_toc *)ptr;
const struct gp_header *gph =
diff --git a/tools/pblimage.c b/tools/pblimage.c
index bd639c276f9c..6c4d360e4699 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c
@@ -254,7 +254,7 @@ static int pblimage_verify_header(unsigned char *ptr, int image_size,
return 0;
}
-static void pblimage_print_header(const void *ptr)
+static void pblimage_print_header(const void *ptr, struct image_tool_params *params)
{
printf("Image Type: Freescale PBL Boot Image\n");
}
diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 96efc1192cb1..12c27b34eaa3 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -481,7 +481,7 @@ int rkcommon_verify_header(unsigned char *buf, int size,
return -ENOENT;
}
-void rkcommon_print_header(const void *buf)
+void rkcommon_print_header(const void *buf, struct image_tool_params *params)
{
struct header0_info header0;
struct header0_info_v2 header0_v2;
diff --git a/tools/rkcommon.h b/tools/rkcommon.h
index 49b6df318501..5d2770a80f1c 100644
--- a/tools/rkcommon.h
+++ b/tools/rkcommon.h
@@ -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);
+void rkcommon_print_header(const void *buf, struct image_tool_params *params);
/**
* rkcommon_need_rc4_spl() - check if rc4 encoded spl is required
diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
index eba812fec969..953dfeed4d5c 100644
--- a/tools/socfpgaimage.c
+++ b/tools/socfpgaimage.c
@@ -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)
+static void socfpgaimage_print_header(const void *ptr, struct image_tool_params *params)
{
const void *header = ptr + HEADER_OFFSET;
struct socfpga_header_v0 *header_v0;
diff --git a/tools/stm32image.c b/tools/stm32image.c
index 18357c051822..5c6991f35de8 100644
--- a/tools/stm32image.c
+++ b/tools/stm32image.c
@@ -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)
+static void stm32image_print_header(const void *ptr, struct image_tool_params *params)
{
struct stm32_header *stm32hdr = (struct stm32_header *)ptr;
diff --git a/tools/sunxi_egon.c b/tools/sunxi_egon.c
index d45b6f5e4352..a514427809a7 100644
--- a/tools/sunxi_egon.c
+++ b/tools/sunxi_egon.c
@@ -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)
+static void egon_print_header(const void *buf, struct image_tool_params *params)
{
const struct boot_file_head *header = buf;
diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c
index 7a8d74bb8e49..292649fe90f1 100644
--- a/tools/sunxi_toc0.c
+++ b/tools/sunxi_toc0.c
@@ -757,7 +757,7 @@ static const char *toc0_item_name(uint32_t name)
return "(unknown)";
}
-static void toc0_print_header(const void *buf)
+static void toc0_print_header(const void *buf, struct image_tool_params *params)
{
const struct toc0_main_info *main_info = buf;
const struct toc0_item_info *item_info = (void *)(main_info + 1);
diff --git a/tools/ublimage.c b/tools/ublimage.c
index 1d2e897f6b35..8f9b58c7983c 100644
--- a/tools/ublimage.c
+++ b/tools/ublimage.c
@@ -202,7 +202,7 @@ static int ublimage_verify_header(unsigned char *ptr, int image_size,
return 0;
}
-static void ublimage_print_header(const void *ptr)
+static void ublimage_print_header(const void *ptr, struct image_tool_params *params)
{
struct ubl_header *ubl_hdr = (struct ubl_header *) ptr;
diff --git a/tools/vybridimage.c b/tools/vybridimage.c
index 94a6684c19b7..c38886fa9039 100644
--- a/tools/vybridimage.c
+++ b/tools/vybridimage.c
@@ -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)
+static void vybridimage_print_header(const void *ptr, struct image_tool_params *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 d3f418b0612b..359c93d1acd4 100644
--- a/tools/zynqimage.c
+++ b/tools/zynqimage.c
@@ -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)
+static void zynqimage_print_header(const void *ptr, struct image_tool_params *params)
{
struct zynq_header *zynqhdr = (struct zynq_header *)ptr;
int i;
diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c
index 19b2f02ff150..5113ba895f0d 100644
--- a/tools/zynqmpimage.c
+++ b/tools/zynqmpimage.c
@@ -209,7 +209,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)
+void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params)
{
struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr;
int i;
diff --git a/tools/zynqmpimage.h b/tools/zynqmpimage.h
index a1db819aa36c..9d526a17cdd2 100644
--- a/tools/zynqmpimage.h
+++ b/tools/zynqmpimage.h
@@ -133,6 +133,6 @@ struct zynqmp_header {
};
void zynqmpimage_default_header(struct zynqmp_header *ptr);
-void zynqmpimage_print_header(const void *ptr);
+void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params);
#endif /* _ZYNQMPIMAGE_H_ */
--
2.20.1
next prev parent reply other threads:[~2023-03-29 19:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 19:25 [PATCH u-boot-mvebu 0/7] arm: mvebu: Boot support for 4K Native disks Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 1/7] arm: mvebu: spl: Do not hardcode SATA block size to 512 Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 2/7] cmd: mvebu/bubt: a38x: " Pali Rohár
2023-04-11 12:33 ` Stefan Roese
2023-04-11 18:35 ` Pali Rohár
2023-04-11 18:35 ` [PATCH v2 u-boot-mvebu] " Pali Rohár
2023-03-29 19:25 ` Pali Rohár [this message]
2023-03-30 9:17 ` [PATCH u-boot-mvebu 3/7] tools: imagetool: Extend print_header() by params argument Simon Glass
2023-03-29 19:25 ` [PATCH u-boot-mvebu 4/7] tools: kwbimage: Simplify align code Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 5/7] tools: kwbimage: Add support for SATA images with non-512 byte block size Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 6/7] tools: kwboot: Add support for parsing SATA images with non-512 " Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 7/7] arm: mvebu: spl: Allow to build SATA kwbimage for 4K Native disks Pali Rohár
2023-03-30 10:31 ` Martin Rowe
2023-03-30 20:26 ` [PATCH u-boot-mvebu 0/7] arm: mvebu: Boot support " Tony Dinh
2023-04-14 6:06 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230329192558.12417-4-pali@kernel.org \
--to=pali@kernel.org \
--cc=baruch@tkos.co.il \
--cc=judge.packham@gmail.com \
--cc=martin.p.rowe@gmail.com \
--cc=mibodhi@gmail.com \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox