tools: zynqmpimage: Add bif support

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.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
lime2-spi
Alexander Graf 7 years ago committed by Michal Simek
parent b123aff26f
commit 6915dcf359
  1. 1
      common/image.c
  2. 1
      include/image.h
  3. 1
      tools/Makefile
  4. 1
      tools/imagetool.h
  5. 7
      tools/mkimage.c
  6. 1008
      tools/zynqmpbif.c
  7. 4
      tools/zynqmpimage.c
  8. 7
      tools/zynqmpimage.h

@ -158,6 +158,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" },

@ -268,6 +268,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 */

@ -111,6 +111,7 @@ dumpimage-mkimage-objs := aisimage.o \
ublimage.o \
zynqimage.o \
zynqmpimage.o \
zynqmpbif.o \
$(LIBFDT_OBJS) \
gpimage.o \
gpimage-common.o \

@ -231,6 +231,7 @@ time_t imagetool_get_source_date(
void pbl_load_uboot(int fd, struct image_tool_params *mparams);
int zynqmpbif_copy_image(int fd, struct image_tool_params *mparams);
#define ___cat(a, b) a ## b
#define __cat(a, b) ___cat(a, b)

@ -515,6 +515,13 @@ 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 */
int ret;
ret = zynqmpbif_copy_image(ifd, &params);
if (ret)
return ret;
} else {
copy_file(ifd, params.datafile, pad_len);
}

File diff suppressed because it is too large Load Diff

@ -86,7 +86,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;
@ -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));
}
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;

@ -19,7 +19,11 @@
#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_MASK (0x3 << 10)
#define HEADER_CPU_SELECT_R5_SINGLE (0x0 << 10)
#define HEADER_CPU_SELECT_A53_32BIT (0x1 << 10)
#define HEADER_CPU_SELECT_A53_64BIT (0x2 << 10)
#define HEADER_CPU_SELECT_R5_DUAL (0x3 << 10)
enum {
ENCRYPTION_EFUSE = 0xa5c3c5a3,
@ -129,4 +133,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_ */

Loading…
Cancel
Save