]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: imagetool: Extend print_header() by params argument
authorPali Rohár <pali@kernel.org>
Wed, 29 Mar 2023 19:25:54 +0000 (21:25 +0200)
committerStefan Roese <sr@denx.de>
Thu, 13 Apr 2023 09:34:47 +0000 (11:34 +0200)
This allows image type print_header() callback to access struct
image_tool_params *params.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
30 files changed:
tools/aisimage.c
tools/atmelimage.c
tools/default_image.c
tools/fit_common.c
tools/fit_common.h
tools/fit_image.c
tools/gpimage.c
tools/imagetool.c
tools/imagetool.h
tools/imx8image.c
tools/imx8mimage.c
tools/imximage.c
tools/kwbimage.c
tools/lpc32xximage.c
tools/mkimage.c
tools/mtk_image.c
tools/mxsimage.c
tools/omapimage.c
tools/pblimage.c
tools/rkcommon.c
tools/rkcommon.h
tools/socfpgaimage.c
tools/stm32image.c
tools/sunxi_egon.c
tools/sunxi_toc0.c
tools/ublimage.c
tools/vybridimage.c
tools/zynqimage.c
tools/zynqmpimage.c
tools/zynqmpimage.h

index b8b3ee32070f6ac0327a40a7d412b91ab00f9f12..c5b33b559b0291fb4cd1644ce4f81f8f86eacf45 100644 (file)
@@ -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;
index 7b3b243d58b7c13923e9e69065d4d74f944873eb..6a2d9d8feab2e01734991603458640852346cc3e 100644 (file)
@@ -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;
index dc429ce9e462920f8e6c1d6f1758ebf88500a98b..0e49ab3301567ec0045deb71721c42254825798f 100644 (file)
@@ -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,
index 01649760ac00c65653eb58bbc6e253f0994de822..2d417d47198888597bf27db5f2be4b79ff366e5e 100644 (file)
 #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)
 {
index 920a16acfdb2e4230a2ed7b7f723cbbf3fc206ea..2da4b9422d44c7ce3811c32f3a8acad21b9a1462 100644 (file)
@@ -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
  *
index 8763a36d01e7edfc2edfc9b3eb513227669e826c..9fe69ea0d9f8e682be6980b7a8dacf03d07f8238 100644 (file)
@@ -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,
index 27de4cfaed77e2db0f852688c3e52fffe960e780..d2bc79d46b9e0cd33fa7f6ec57002da6c9d94ecf 100644 (file)
@@ -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;
 
index 87eee4ad04edf396b308412d939f973316f22579..b293211cf88298432a13c66b4d11b4c8baf1f71f 100644 (file)
@@ -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",
index fdceea46c0909371eb311f319d72b6542579f1c3..a766aa2ae91f72129f55061fd9c7449c163e2cbc 100644 (file)
@@ -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.
index c25ea84e25c5cf289f9d2081dd3f6eaf82e6de16..76d0cd62dcc8ee4f27044ea0e7f64a0b7348b4eb 100644 (file)
@@ -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)
 {
 }
 
index 3ca79d865aa1a179b4dfc776062ef7f82eefe1c0..21075c23799a6ac94a6a68bb6c13334b2110b287 100644 (file)
@@ -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)
 {
 }
 
index 354ee34c14a488e42e5aa753b83032e16a7262d6..b3da1f244cd99f8534d98eef1307588534c24b0c 100644 (file)
@@ -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);
index 177084adf825a4a363bdaa37a1ff9a3ce1565ec5..8e573d9eea37482ddb3c424cebad24ed9d2d7646 100644 (file)
@@ -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;
index 37931f91840cea11a98c9b3a4670f3e9ab30b9b4..715a55a5b5b3cb322a7d338ebcb47f4e0662515b 100644 (file)
@@ -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;
index a92d9d5ca57cbc6e55420895efe192f448d35d0d..6dfe3e1d42d902cba9a39995c53289183a67076b 100644 (file)
@@ -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, &params);
        else {
                fprintf (stderr, "%s: Can't print header for %s\n",
                        params.cmdname, tparams->name);
index 5ef9334163deecd4ab9b43de3c2914d88f697a42..30f54c8e8d863d7ff1ad4458aa668d0a0bace136 100644 (file)
@@ -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;
index fbe46c47faeeec8730502432e4d593ab90434559..ead61d0cd6313c6c81e941fe3381124720d7a268 100644 (file)
@@ -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);
index c59cdcc79b3d0f4934817fca231bc4e6c6fc7c87..b79c1c3b648bdebaf33bfcf8bad2d36a1be72a26 100644 (file)
@@ -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 =
index bd639c276f9c41d36daf769580d6c0f39d9d3865..6c4d360e46992bc1d6fc0a29dc2291a6b7ddfd21 100644 (file)
@@ -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");
 }
index 96efc1192cb177abe0c567165811ad8b9880369b..12c27b34eaa34371593b6bc26bf8415011899e56 100644 (file)
@@ -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;
index 49b6df31850152420ad3c75898a7ab69bb32f666..5d2770a80f1c1d04367dd98f45a300f2a4c7adce 100644 (file)
@@ -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
index eba812fec969dfaa17c7568a0bffdb4ba7716772..953dfeed4d5cbd7d5e511e440f5f8fe8e2c9f86a 100644 (file)
@@ -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;
index 18357c051822508a652ce7bb1191390f5b71f40e..5c6991f35de8120f49210c2fda02fee41c4fc65f 100644 (file)
@@ -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;
 
index d45b6f5e4352ea972759138fe8f4142b4a088660..a514427809a787be6460d365f9894639425f761a 100644 (file)
@@ -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;
 
index 7a8d74bb8e4941d538f692ba40b3dbf2083307f7..292649fe90f1487929ffd74cafddf78332cdb70c 100644 (file)
@@ -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);
index 1d2e897f6b35f72aadb72946230563fe78e78ce0..8f9b58c7983c5db75ce401059ea6d722f96a34b5 100644 (file)
@@ -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;
 
index 94a6684c19b73c249ed3ba2818cbb838e30db451..c38886fa9039b990af4a494dd0ad75a73c061b85 100644 (file)
@@ -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;
index d3f418b0612b311b0537dddce8769c6e07b046a4..359c93d1acd438da1b025a59e3bdbb306b29f359 100644 (file)
@@ -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;
index 19b2f02ff150bf751316edff33004590a9e1d2fa..5113ba895f0dde372d0208308b730254129be56c 100644 (file)
@@ -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;
index a1db819aa36c2bfa9d0d9ce1f86b6b148e62fa99..9d526a17cdd2e07df90edf6a8c13a7a0b572095c 100644 (file)
@@ -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_ */