Skip to contentSkip to conversation

tools: zynqmpimage: Support partitions

PATCH Superseded Alexander Graf 1 participant 4 messages Apr 12, 2018 Arm/Zynq architecture

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover tools: zynqmpimage: Support partitions

A good chunk of the booting chain of ZynqMP based systems is open source (depending on your definition of it), except for the image generation flow.

This patch set aims to change that, with read and write support for boot.bin partitions which allows us to create boot.bin files using only open source tools.

Alexander Graf (3):
tools: zynqmpimage: Add partition read support
tools: zynqmpimage: Move defines to header
tools: zynqmpimage: Add bif support

 common/image.c      |   1 +
 include/image.h     |   1 +
 tools/Makefile      |   1 +
 tools/imagetool.h   |   1 +
 tools/mkimage.c     |   3 +
 tools/zynqmpbif.c   | 839 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/zynqmpimage.c | 141 ++++++---
 tools/zynqmpimage.h | 135 +++++++++
 8 files changed, 1080 insertions(+), 42 deletions(-)
 create mode 100644 tools/zynqmpbif.c
 create mode 100644 tools/zynqmpimage.h
Signature · 1 line
2.12.3
#1 lore raw

PATCH v2 1/3 tools: zynqmpimage: Add partition read support

The zynqmp image format has support for inline partitions which are used by FSBL to describe payloads that are loaded by FSBL itself.

While we can't create images that contain partitions (yet), we should still at least be able to examine them and show the user what's inside when we analyze an image created by bootgen.

---

v1 -> v2:

- prettify defines
- fix offset and size outputs
- add u-boot as payload target
- align CPU names with bif
- add shift constants
- add U-Boot as potential partition owner
- mention documentation source
- add HEADER_CPU_SELECT_A53_64BIT define

---
 tools/zynqmpimage.c | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 172 insertions(+), 2 deletions(-)
tools/zynqmpimage.c +172 -2
index a61fb17c40..8117913da3 100644
@@ -7,6 +7,7 @@
  * The following Boot Header format/structures and values are defined in the
  * following documents:
  *   * ug1085 ZynqMP TRM doc v1.4 (Chapter 11, Table 11-4)
+ *   * ug1137 ZynqMP Software Developer Guide v6.0 (Chapter 16)
  *
  * Expected Header Size = 0x9C0
  * Forced as 'little' endian, 32-bit words
@@ -63,6 +64,7 @@
 #define HEADER_REGINIT_NULL (cpu_to_le32(0xffffffff))
 #define HEADER_WIDTHDETECTION (cpu_to_le32(0xaa995566))
 #define HEADER_IMAGEIDENTIFIER (cpu_to_le32(0x584c4e58))
+#define HEADER_CPU_SELECT_A53_64BIT	(0x2 << 10)
 
 enum {
 	ENCRYPTION_EFUSE = 0xa5c3c5a3,
@@ -80,6 +82,78 @@ struct zynqmp_reginit {
 #define HEADER_INTERRUPT_VECTORS	8
 #define HEADER_REGINITS			256
 
+struct image_header_table {
+	uint32_t version;		  /* 0x00 */
+	uint32_t nr_parts;		  /* 0x04 */
+	uint32_t partition_header_offset; /* 0x08, divided by 4 */
+	uint32_t image_header_offset;	  /* 0x0c, divided by 4 */
+	uint32_t auth_certificate_offset; /* 0x10 */
+	uint32_t boot_device;		  /* 0x14 */
+	uint32_t __reserved1[9];	  /* 0x18 - 0x38 */
+	uint32_t checksum;		  /* 0x3c */
+};
+
+#define PART_ATTR_VEC_LOCATION		0x800000
+#define PART_ATTR_BS_BLOCK_SIZE_MASK	0x700000
+#define     PART_ATTR_BS_BLOCK_SIZE_DEFAULT	0x000000
+#define     PART_ATTR_BS_BLOCK_SIZE_8MB		0x400000
+#define PART_ATTR_BIG_ENDIAN		0x040000
+#define PART_ATTR_PART_OWNER_MASK	0x030000
+#define     PART_ATTR_PART_OWNER_FSBL		0x000000
+#define     PART_ATTR_PART_OWNER_UBOOT		0x010000
+#define PART_ATTR_RSA_SIG		0x008000
+#define PART_ATTR_CHECKSUM_MASK		0x007000
+#define    PART_ATTR_CHECKSUM_NONE		0x000000
+#define    PART_ATTR_CHECKSUM_MD5		0x001000
+#define    PART_ATTR_CHECKSUM_SHA2		0x002000
+#define    PART_ATTR_CHECKSUM_SHA3		0x003000
+#define PART_ATTR_DEST_CPU_SHIFT	8
+#define PART_ATTR_DEST_CPU_MASK		0x000f00
+#define    PART_ATTR_DEST_CPU_NONE		0x000000
+#define    PART_ATTR_DEST_CPU_A53_0		0x000100
+#define    PART_ATTR_DEST_CPU_A53_1		0x000200
+#define    PART_ATTR_DEST_CPU_A53_2		0x000300
+#define    PART_ATTR_DEST_CPU_A53_3		0x000400
+#define    PART_ATTR_DEST_CPU_R5_0		0x000500
+#define    PART_ATTR_DEST_CPU_R5_1		0x000600
+#define    PART_ATTR_DEST_CPU_R5_L		0x000700
+#define    PART_ATTR_DEST_CPU_PMU		0x000800
+#define PART_ATTR_ENCRYPTED		0x000080
+#define PART_ATTR_DEST_DEVICE_SHIFT	4
+#define PART_ATTR_DEST_DEVICE_MASK	0x000070
+#define    PART_ATTR_DEST_DEVICE_NONE		0x000000
+#define    PART_ATTR_DEST_DEVICE_PS		0x000010
+#define    PART_ATTR_DEST_DEVICE_PL		0x000020
+#define    PART_ATTR_DEST_DEVICE_PMU		0x000030
+#define    PART_ATTR_DEST_DEVICE_XIP		0x000040
+#define PART_ATTR_A53_EXEC_AARCH32	0x000008
+#define PART_ATTR_TARGET_EL_SHIFT	1
+#define PART_ATTR_TARGET_EL_MASK	0x000006
+#define PART_ATTR_TZ_SECURE		0x000001
+
+static const char *dest_cpus[0x10] = {
+	"none", "a5x-0", "a5x-1", "a5x-2", "a5x-3", "r5-0", "r5-1",
+	"r5-lockstep", "pmu", "unknown", "unknown", "unknown", "unknown",
+	"unknown", "unknown", "unknown"
+};
+
+struct partition_header {
+	uint32_t len_enc;		  /* 0x00, divided by 4 */
+	uint32_t len_unenc;		  /* 0x04, divided by 4 */
+	uint32_t len;			  /* 0x08, divided by 4 */
+	uint32_t next_partition_offset;   /* 0x0c */
+	uint64_t entry_point;		  /* 0x10 */
+	uint64_t load_address;		  /* 0x18 */
+	uint32_t offset;		  /* 0x20, divided by 4 */
+	uint32_t attributes;		  /* 0x24 */
+	uint32_t __reserved1;		  /* 0x28 */
+	uint32_t checksum_offset;	  /* 0x2c, divided by 4 */
+	uint32_t __reserved2;		  /* 0x30 */
+	uint32_t auth_certificate_offset; /* 0x34 */
+	uint32_t __reserved3;		  /* 0x38 */
+	uint32_t checksum;		  /* 0x3c */
+};
+
 struct zynqmp_header {
 	uint32_t interrupt_vectors[HEADER_INTERRUPT_VECTORS]; /* 0x0 */
 	uint32_t width_detection; /* 0x20 */
@@ -93,7 +167,9 @@ struct zynqmp_header {
 	uint32_t image_stored_size; /* 0x40 */
 	uint32_t image_attributes; /* 0x44 */
 	uint32_t checksum; /* 0x48 */
-	uint32_t __reserved1[27]; /* 0x4c */
+	uint32_t __reserved1[19]; /* 0x4c */
+	uint32_t image_header_table_offset; /* 0x98 */
+	uint32_t __reserved2[7]; /* 0x9c */
 	struct zynqmp_reginit register_init[HEADER_REGINITS]; /* 0xb8 */
 	uint32_t __reserved4[66]; /* 0x9c0 */
 };
@@ -132,7 +208,7 @@ static void zynqmpimage_default_header(struct zynqmp_header *ptr)
 		return;
 
 	ptr->width_detection = HEADER_WIDTHDETECTION;
-	ptr->image_attributes = 0x800;
+	ptr->image_attributes = HEADER_CPU_SELECT_A53_64BIT;
 	ptr->image_identifier = HEADER_IMAGEIDENTIFIER;
 	ptr->encryption = cpu_to_le32(ENCRYPTION_NONE);
 
@@ -173,6 +249,81 @@ static int zynqmpimage_verify_header(unsigned char *ptr, int image_size,
 	return 0;
 }
 
+static void print_partition(const void *ptr, const struct partition_header *ph)
+{
+	uint32_t attr = le32_to_cpu(ph->attributes);
+	unsigned long len = le32_to_cpu(ph->len) * 4;
+	const char *part_owner;
+	const char *dest_devs[0x8] = {
+		"none", "PS", "PL", "PMU", "unknown", "unknown", "unknown",
+		"unknown"
+	};
+
+	switch (attr & PART_ATTR_PART_OWNER_MASK) {
+	case PART_ATTR_PART_OWNER_FSBL:
+		part_owner = "FSBL";
+		break;
+	case PART_ATTR_PART_OWNER_UBOOT:
+		part_owner = "U-Boot";
+		break;
+	default:
+		part_owner = "Unknown";
+		break;
+	}
+
+	printf("%s payload on CPU %s (%s):\n",
+		part_owner,
+		dest_cpus[(attr & PART_ATTR_DEST_CPU_MASK) >> 8],
+		dest_devs[(attr & PART_ATTR_DEST_DEVICE_MASK) >> 4]);
+
+	printf("    Offset     : 0x%08x\n", le32_to_cpu(ph->offset) * 4);
+	printf("    Size       : %lu (0x%lx) bytes\n", len, len);
+	printf("    Load       : 0x%08llx",
+		(unsigned long long)le64_to_cpu(ph->load_address));
+	if (ph->load_address != ph->entry_point)
+		printf(" (entry=0x%08llx)\n",
+		(unsigned long long)le64_to_cpu(ph->entry_point));
+	else
+		printf("\n");
+	printf("    Attributes : ");
+
+	if (attr & PART_ATTR_VEC_LOCATION)
+		printf("vec ");
+
+	if (attr & PART_ATTR_ENCRYPTED)
+		printf("encrypted ");
+
+	switch (attr & PART_ATTR_CHECKSUM_MASK) {
+	case PART_ATTR_CHECKSUM_MD5:
+		printf("md5 ");
+		break;
+	case PART_ATTR_CHECKSUM_SHA2:
+		printf("sha2 ");
+		break;
+	case PART_ATTR_CHECKSUM_SHA3:
+		printf("sha3 ");
+		break;
+	}
+
+	if (attr & PART_ATTR_BIG_ENDIAN)
+		printf("BigEndian ");
+
+	if (attr & PART_ATTR_RSA_SIG)
+		printf("RSA ");
+
+	if (attr & PART_ATTR_A53_EXEC_AARCH32)
+		printf("AArch32 ");
+
+	if (attr & PART_ATTR_TARGET_EL_MASK)
+		printf("EL%d ", (attr & PART_ATTR_TARGET_EL_MASK) >> 1);
+
+	if (attr & PART_ATTR_TZ_SECURE)
+		printf("secure ");
+	printf("\n");
+
+	printf("    Checksum   : 0x%08x\n", le32_to_cpu(ph->checksum));
+}
+
 static void zynqmpimage_print_header(const void *ptr)
 {
 	struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr;
@@ -213,6 +364,25 @@ static void zynqmpimage_print_header(const void *ptr)
 		       le32_to_cpu(zynqhdr->register_init[i].data));
 	}
 
+	if (zynqhdr->image_header_table_offset) {
+		struct image_header_table *iht = (void*)ptr +
+			zynqhdr->image_header_table_offset;
+		struct partition_header *ph;
+		uint32_t ph_offset;
+		int i;
+
+		ph_offset = le32_to_cpu(iht->partition_header_offset) * 4;
+		ph = (void*)ptr + ph_offset;
+		for (i = 0; i < le32_to_cpu(iht->nr_parts); i++) {
+			uint32_t next = le32_to_cpu(ph->next_partition_offset) * 4;
+
+			/* Partition 0 is the base image itself */
+			if (i)
+				print_partition(ptr, ph);
+			ph = (void*)ptr + next;
+		}
+	}
+
 	free(dynamic_header);
 }
 
Signature · 1 line
2.12.3
#2 lore raw

PATCH v2 2/3 tools: zynqmpimage: Move defines to header

In reply to Alexander Graf

We will add support for ZynqMP bif input files later, so let's move all structure definitions into a header file that can be used by that one as well.

---
 tools/zynqmpimage.c | 115 +--------------------------------------------
 tools/zynqmpimage.h | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+), 114 deletions(-)
 create mode 100644 tools/zynqmpimage.h
tools/zynqmpimage.c +1 -114
index 8117913da3..8f4766f077 100644
@@ -58,122 +58,9 @@
 
 #include "imagetool.h"
 #include "mkimage.h"
+#include "zynqmpimage.h"
 #include <image.h>
 
-#define HEADER_INTERRUPT_DEFAULT (cpu_to_le32(0xeafffffe))
-#define HEADER_REGINIT_NULL (cpu_to_le32(0xffffffff))
-#define HEADER_WIDTHDETECTION (cpu_to_le32(0xaa995566))
-#define HEADER_IMAGEIDENTIFIER (cpu_to_le32(0x584c4e58))
-#define HEADER_CPU_SELECT_A53_64BIT	(0x2 << 10)
-
-enum {
-	ENCRYPTION_EFUSE = 0xa5c3c5a3,
-	ENCRYPTION_OEFUSE = 0xa5c3c5a7,
-	ENCRYPTION_BBRAM = 0x3a5c3c5a,
-	ENCRYPTION_OBBRAM = 0xa35c7ca5,
-	ENCRYPTION_NONE = 0x0,
-};
-
-struct zynqmp_reginit {
-	uint32_t address;
-	uint32_t data;
-};
-
-#define HEADER_INTERRUPT_VECTORS	8
-#define HEADER_REGINITS			256
-
-struct image_header_table {
-	uint32_t version;		  /* 0x00 */
-	uint32_t nr_parts;		  /* 0x04 */
-	uint32_t partition_header_offset; /* 0x08, divided by 4 */
-	uint32_t image_header_offset;	  /* 0x0c, divided by 4 */
-	uint32_t auth_certificate_offset; /* 0x10 */
-	uint32_t boot_device;		  /* 0x14 */
-	uint32_t __reserved1[9];	  /* 0x18 - 0x38 */
-	uint32_t checksum;		  /* 0x3c */
-};
-
-#define PART_ATTR_VEC_LOCATION		0x800000
-#define PART_ATTR_BS_BLOCK_SIZE_MASK	0x700000
-#define     PART_ATTR_BS_BLOCK_SIZE_DEFAULT	0x000000
-#define     PART_ATTR_BS_BLOCK_SIZE_8MB		0x400000
-#define PART_ATTR_BIG_ENDIAN		0x040000
-#define PART_ATTR_PART_OWNER_MASK	0x030000
-#define     PART_ATTR_PART_OWNER_FSBL		0x000000
-#define     PART_ATTR_PART_OWNER_UBOOT		0x010000
-#define PART_ATTR_RSA_SIG		0x008000
-#define PART_ATTR_CHECKSUM_MASK		0x007000
-#define    PART_ATTR_CHECKSUM_NONE		0x000000
-#define    PART_ATTR_CHECKSUM_MD5		0x001000
-#define    PART_ATTR_CHECKSUM_SHA2		0x002000
-#define    PART_ATTR_CHECKSUM_SHA3		0x003000
-#define PART_ATTR_DEST_CPU_SHIFT	8
-#define PART_ATTR_DEST_CPU_MASK		0x000f00
-#define    PART_ATTR_DEST_CPU_NONE		0x000000
-#define    PART_ATTR_DEST_CPU_A53_0		0x000100
-#define    PART_ATTR_DEST_CPU_A53_1		0x000200
-#define    PART_ATTR_DEST_CPU_A53_2		0x000300
-#define    PART_ATTR_DEST_CPU_A53_3		0x000400
-#define    PART_ATTR_DEST_CPU_R5_0		0x000500
-#define    PART_ATTR_DEST_CPU_R5_1		0x000600
-#define    PART_ATTR_DEST_CPU_R5_L		0x000700
-#define    PART_ATTR_DEST_CPU_PMU		0x000800
-#define PART_ATTR_ENCRYPTED		0x000080
-#define PART_ATTR_DEST_DEVICE_SHIFT	4
-#define PART_ATTR_DEST_DEVICE_MASK	0x000070
-#define    PART_ATTR_DEST_DEVICE_NONE		0x000000
-#define    PART_ATTR_DEST_DEVICE_PS		0x000010
-#define    PART_ATTR_DEST_DEVICE_PL		0x000020
-#define    PART_ATTR_DEST_DEVICE_PMU		0x000030
-#define    PART_ATTR_DEST_DEVICE_XIP		0x000040
-#define PART_ATTR_A53_EXEC_AARCH32	0x000008
-#define PART_ATTR_TARGET_EL_SHIFT	1
-#define PART_ATTR_TARGET_EL_MASK	0x000006
-#define PART_ATTR_TZ_SECURE		0x000001
-
-static const char *dest_cpus[0x10] = {
-	"none", "a5x-0", "a5x-1", "a5x-2", "a5x-3", "r5-0", "r5-1",
-	"r5-lockstep", "pmu", "unknown", "unknown", "unknown", "unknown",
-	"unknown", "unknown", "unknown"
-};
-
-struct partition_header {
-	uint32_t len_enc;		  /* 0x00, divided by 4 */
-	uint32_t len_unenc;		  /* 0x04, divided by 4 */
-	uint32_t len;			  /* 0x08, divided by 4 */
-	uint32_t next_partition_offset;   /* 0x0c */
-	uint64_t entry_point;		  /* 0x10 */
-	uint64_t load_address;		  /* 0x18 */
-	uint32_t offset;		  /* 0x20, divided by 4 */
-	uint32_t attributes;		  /* 0x24 */
-	uint32_t __reserved1;		  /* 0x28 */
-	uint32_t checksum_offset;	  /* 0x2c, divided by 4 */
-	uint32_t __reserved2;		  /* 0x30 */
-	uint32_t auth_certificate_offset; /* 0x34 */
-	uint32_t __reserved3;		  /* 0x38 */
-	uint32_t checksum;		  /* 0x3c */
-};
-
-struct zynqmp_header {
-	uint32_t interrupt_vectors[HEADER_INTERRUPT_VECTORS]; /* 0x0 */
-	uint32_t width_detection; /* 0x20 */
-	uint32_t image_identifier; /* 0x24 */
-	uint32_t encryption; /* 0x28 */
-	uint32_t image_load; /* 0x2c */
-	uint32_t image_offset; /* 0x30 */
-	uint32_t pfw_image_length; /* 0x34 */
-	uint32_t total_pfw_image_length; /* 0x38 */
-	uint32_t image_size; /* 0x3c */
-	uint32_t image_stored_size; /* 0x40 */
-	uint32_t image_attributes; /* 0x44 */
-	uint32_t checksum; /* 0x48 */
-	uint32_t __reserved1[19]; /* 0x4c */
-	uint32_t image_header_table_offset; /* 0x98 */
-	uint32_t __reserved2[7]; /* 0x9c */
-	struct zynqmp_reginit register_init[HEADER_REGINITS]; /* 0xb8 */
-	uint32_t __reserved4[66]; /* 0x9c0 */
-};
-
 static struct zynqmp_header zynqmpimage_header;
 static void *dynamic_header;
 static FILE *fpmu;
tools/zynqmpimage.h new file +132 -0

132 lines not on this page · raw message

Signature · 1 line
2.12.3
#3 lore raw

PATCH v2 3/3 tools: zynqmpimage: Add bif support

In reply to Alexander Graf

The officially described way to generate boot.bin files for ZynqMP is to describe the contents of the target binary using a file of the "bif" format. This file then links to other files that all get packed into a bootable image.

This patch adds support to read such a .bif file and generate a respective ZynqMP boot.bin file that can include the normal image and pmu files, but also supports image partitions now. This makes it a handy replacement for the proprietary "bootgen" utility that is currently used to generate boot.bin files with FSBL.

---
 common/image.c      |   1 +
 include/image.h     |   1 +
 tools/Makefile      |   1 +
 tools/imagetool.h   |   1 +
 tools/mkimage.c     |   3 +
 tools/zynqmpbif.c   | 839 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/zynqmpimage.c |   4 +-
 tools/zynqmpimage.h |   3 +
 8 files changed, 851 insertions(+), 2 deletions(-)
 create mode 100644 tools/zynqmpbif.c
common/image.c +1 -0
index e1c50eb25d..f30dfa229b 100644
@@ -159,6 +159,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_VYBRIDIMAGE, "vybridimage",  "Vybrid Boot Image", },
 	{	IH_TYPE_ZYNQIMAGE,  "zynqimage",  "Xilinx Zynq Boot Image" },
 	{	IH_TYPE_ZYNQMPIMAGE, "zynqmpimage", "Xilinx ZynqMP Boot Image" },
+	{	IH_TYPE_ZYNQMPBIF,  "zynqmpbif",  "Xilinx ZynqMP Boot Image (bif)" },
 	{	IH_TYPE_FPGA,       "fpga",       "FPGA Image" },
 	{       IH_TYPE_TEE,        "tee",        "Trusted Execution Environment Image",},
 	{	IH_TYPE_FIRMWARE_IVT, "firmware_ivt", "Firmware with HABv4 IVT" },
include/image.h +1 -0
index a579c5f509..c5af912aeb 100644
@@ -269,6 +269,7 @@ enum {
 	IH_TYPE_RKSPI,			/* Rockchip SPI image		*/
 	IH_TYPE_ZYNQIMAGE,		/* Xilinx Zynq Boot Image */
 	IH_TYPE_ZYNQMPIMAGE,		/* Xilinx ZynqMP Boot Image */
+	IH_TYPE_ZYNQMPBIF,		/* Xilinx ZynqMP Boot Image (bif) */
 	IH_TYPE_FPGA,			/* FPGA Image */
 	IH_TYPE_VYBRIDIMAGE,	/* VYBRID .vyb Image */
 	IH_TYPE_TEE,            /* Trusted Execution Environment OS Image */
tools/Makefile +1 -0
index 8143c25666..204685ec9e 100644
@@ -113,6 +113,7 @@ dumpimage-mkimage-objs := aisimage.o \
 			ublimage.o \
 			zynqimage.o \
 			zynqmpimage.o \
+			zynqmpbif.o \
 			$(LIBFDT_OBJS) \
 			gpimage.o \
 			gpimage-common.o \
tools/imagetool.h +1 -0
index e67de9b5ad..d78a9458f4 100644
@@ -232,6 +232,7 @@ time_t imagetool_get_source_date(
 
 
 void pbl_load_uboot(int fd, struct image_tool_params *mparams);
+void zynqmpbif_copy_image(int fd, struct image_tool_params *mparams);
 
 #define ___cat(a, b) a ## b
 #define __cat(a, b) ___cat(a, b)
tools/mkimage.c +3 -0
index 4e561820e7..72183f5f2b 100644
@@ -514,6 +514,9 @@ int main(int argc, char **argv)
 		} else if (params.type == IH_TYPE_PBLIMAGE) {
 			/* PBL has special Image format, implements its' own */
 			pbl_load_uboot(ifd, &params);
+		} else if (params.type == IH_TYPE_ZYNQMPBIF) {
+			/* Image file is meta, walk through actual targets */
+			zynqmpbif_copy_image(ifd, &params);
 		} else {
 			copy_file(ifd, params.datafile, pad_len);
 		}
tools/zynqmpbif.c new file +839 -0

839 lines not on this page · raw message

tools/zynqmpimage.c +2 -2
index 8f4766f077..145391de3e 100644
@@ -87,7 +87,7 @@ static uint32_t zynqmpimage_checksum(struct zynqmp_header *ptr)
 	return cpu_to_le32(checksum);
 }
 
-static void zynqmpimage_default_header(struct zynqmp_header *ptr)
+void zynqmpimage_default_header(struct zynqmp_header *ptr)
 {
 	int i;
 
@@ -211,7 +211,7 @@ static void print_partition(const void *ptr, const struct partition_header *ph)
 	printf("    Checksum   : 0x%08x\n", le32_to_cpu(ph->checksum));
 }
 
-static void zynqmpimage_print_header(const void *ptr)
+void zynqmpimage_print_header(const void *ptr)
 {
 	struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr;
 	int i;
tools/zynqmpimage.h +3 -0
index f3b5c195ad..b421e4f94c 100644
@@ -129,4 +129,7 @@ struct zynqmp_header {
 	uint32_t __reserved4[66]; /* 0x9c0 */
 };
 
+void zynqmpimage_default_header(struct zynqmp_header *ptr);
+void zynqmpimage_print_header(const void *ptr);
+
 #endif /* _ZYNQMPIMAGE_H_ */
Signature · 1 line
2.12.3