Re: [U-Boot] [PATCH v4 4/4] tools: zynqmpimage: Add bif support
Hi, > Hi Alex > > On Wed, Jun 13, 2018 at 11:07 AM, Alexander Graf wrote: >> Hi Peter, >> >> I'm not sure how much documentation you want. Basically mkimage becomes >> a replacement for bootgen in any official Xilinx documentation. So any >> Xilinx wiki like >> >> http://www.wiki.xilinx.com/Prepare+boot+image >> >> or even the official .bif documentation: >> >> >> https://www.xilinx.com/support/documentation/user_guides/ug1137-zynq-ultrascale-mpsoc-swdev.pdf >> >> apply. The only difference is that the command line arguments are >> different. But mkimage takes a .bif file as input and generates a >> boot.bin file as output. > > Thanks, good resources, a readme like doc/README.chromium outlining > the process for people wanting to get started would likely be a good > thing in general with links to those sorts of other resources would be > useful for zynqmp like most of the other device categories. I was kind > of surprised actually that zynqmp didn't have some sort of related > docs to deal with it already. Xilinx has wiki.xilinx.com pages to cover xilinx differences. Definitely feel free to compose one and I am happy to review it. Thanks, Michal ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4 4/4] tools: zynqmpimage: Add bif support
Hi Alex On Wed, Jun 13, 2018 at 11:07 AM, Alexander Graf wrote: > Hi Peter, > > I'm not sure how much documentation you want. Basically mkimage becomes > a replacement for bootgen in any official Xilinx documentation. So any > Xilinx wiki like > > http://www.wiki.xilinx.com/Prepare+boot+image > > or even the official .bif documentation: > > > https://www.xilinx.com/support/documentation/user_guides/ug1137-zynq-ultrascale-mpsoc-swdev.pdf > > apply. The only difference is that the command line arguments are > different. But mkimage takes a .bif file as input and generates a > boot.bin file as output. Thanks, good resources, a readme like doc/README.chromium outlining the process for people wanting to get started would likely be a good thing in general with links to those sorts of other resources would be useful for zynqmp like most of the other device categories. I was kind of surprised actually that zynqmp didn't have some sort of related docs to deal with it already. Thanks > On 13.06.18 08:49, Peter Robinson wrote: >> Michael or Alex, >> >> Could someone add a ZynqMP README documenting the process required to >> use U-Boot for the ZynqMP with the open tools? I looked in >> board/xilinx/zynqmp and doc/ and a few other places but couldn't see >> any docs for either that or the closed tools. >> >> Peter >> >> On Fri, Apr 13, 2018 at 1:18 PM, Alexander Graf wrote: >>> 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 >>> >>> --- >>> >>> v2 -> v3: >>> >>> - zero initialize header >>> - reduce default debug verbosity >>> >>> v3 -> v4: >>> >>> - add error handling >>> - add fsbl_config support >>> - add aarch32 support >>> - allow a5x to be written as a53 >>> - add offset support >>> - add support for partition_owner >>> - ensure pmufw comes before bootloader >>> - simplify fsbl_config >>> - add non-a53 boot support >>> - checkpatch fixes >>> --- >>> common/image.c |1 + >>> include/image.h |1 + >>> tools/Makefile |1 + >>> tools/imagetool.h |1 + >>> tools/mkimage.c |7 + >>> tools/zynqmpbif.c | 1008 >>> +++ >>> tools/zynqmpimage.c |4 +- >>> tools/zynqmpimage.h |7 + >>> 8 files changed, 1028 insertions(+), 2 deletions(-) >>> create mode 100644 tools/zynqmpbif.c >>> >>> diff --git a/common/image.c b/common/image.c >>> index e1c50eb25d..f30dfa229b 100644 >>> --- a/common/image.c >>> +++ b/common/image.c >>> @@ -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" }, >>> diff --git a/include/image.h b/include/image.h >>> index a579c5f509..c5af912aeb 100644 >>> --- a/include/image.h >>> +++ b/include/image.h >>> @@ -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 */ >>> diff --git a/tools/Makefile b/tools/Makefile >>> index 8143c25666..204685ec9e 100644 >>> --- a/tools/Makefile >>> +++ b/tools/Makefile >>> @@ -113,6 +113,7 @@ dumpimage-mkimage-objs := aisimage.o \ >>> ublimage.o \ >>> zynqimage.o \ >>> zynqmpimage.o \ >>> + zynqmpbif.o \ >>> $(LIBFDT_OBJS) \ >>> gpimage.o \ >>> gpimage-common.o \ >>> diff --git a/tools/imagetool.h b/tools/imagetool.h >>> index e67de9b5ad..
Re: [U-Boot] [PATCH v4 4/4] tools: zynqmpimage: Add bif support
Hi Peter, I'm not sure how much documentation you want. Basically mkimage becomes a replacement for bootgen in any official Xilinx documentation. So any Xilinx wiki like http://www.wiki.xilinx.com/Prepare+boot+image or even the official .bif documentation: https://www.xilinx.com/support/documentation/user_guides/ug1137-zynq-ultrascale-mpsoc-swdev.pdf apply. The only difference is that the command line arguments are different. But mkimage takes a .bif file as input and generates a boot.bin file as output. Alex On 13.06.18 08:49, Peter Robinson wrote: > Michael or Alex, > > Could someone add a ZynqMP README documenting the process required to > use U-Boot for the ZynqMP with the open tools? I looked in > board/xilinx/zynqmp and doc/ and a few other places but couldn't see > any docs for either that or the closed tools. > > Peter > > On Fri, Apr 13, 2018 at 1:18 PM, Alexander Graf wrote: >> 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 >> >> --- >> >> v2 -> v3: >> >> - zero initialize header >> - reduce default debug verbosity >> >> v3 -> v4: >> >> - add error handling >> - add fsbl_config support >> - add aarch32 support >> - allow a5x to be written as a53 >> - add offset support >> - add support for partition_owner >> - ensure pmufw comes before bootloader >> - simplify fsbl_config >> - add non-a53 boot support >> - checkpatch fixes >> --- >> common/image.c |1 + >> include/image.h |1 + >> tools/Makefile |1 + >> tools/imagetool.h |1 + >> tools/mkimage.c |7 + >> tools/zynqmpbif.c | 1008 >> +++ >> tools/zynqmpimage.c |4 +- >> tools/zynqmpimage.h |7 + >> 8 files changed, 1028 insertions(+), 2 deletions(-) >> create mode 100644 tools/zynqmpbif.c >> >> diff --git a/common/image.c b/common/image.c >> index e1c50eb25d..f30dfa229b 100644 >> --- a/common/image.c >> +++ b/common/image.c >> @@ -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" }, >> diff --git a/include/image.h b/include/image.h >> index a579c5f509..c5af912aeb 100644 >> --- a/include/image.h >> +++ b/include/image.h >> @@ -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 */ >> diff --git a/tools/Makefile b/tools/Makefile >> index 8143c25666..204685ec9e 100644 >> --- a/tools/Makefile >> +++ b/tools/Makefile >> @@ -113,6 +113,7 @@ dumpimage-mkimage-objs := aisimage.o \ >> ublimage.o \ >> zynqimage.o \ >> zynqmpimage.o \ >> + zynqmpbif.o \ >> $(LIBFDT_OBJS) \ >> gpimage.o \ >> gpimage-common.o \ >> diff --git a/tools/imagetool.h b/tools/imagetool.h >> index e67de9b5ad..6a7e7386f7 100644 >> --- a/tools/imagetool.h >> +++ b/tools/imagetool.h >> @@ -232,6 +232,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) >> diff --git a/tools/mkimage.c b/tools/mkimage.c >> index 4e561820e7..fe861f5405 100644 >> --- a/tools/mkimage.c >> +++ b/tools/mkimage.c >> @@ -514,6 +514,13 @@ int main(int argc, char **argv) >> } else if
Re: [U-Boot] [PATCH v4 4/4] tools: zynqmpimage: Add bif support
Michael or Alex, Could someone add a ZynqMP README documenting the process required to use U-Boot for the ZynqMP with the open tools? I looked in board/xilinx/zynqmp and doc/ and a few other places but couldn't see any docs for either that or the closed tools. Peter On Fri, Apr 13, 2018 at 1:18 PM, Alexander Graf wrote: > 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 > > --- > > v2 -> v3: > > - zero initialize header > - reduce default debug verbosity > > v3 -> v4: > > - add error handling > - add fsbl_config support > - add aarch32 support > - allow a5x to be written as a53 > - add offset support > - add support for partition_owner > - ensure pmufw comes before bootloader > - simplify fsbl_config > - add non-a53 boot support > - checkpatch fixes > --- > common/image.c |1 + > include/image.h |1 + > tools/Makefile |1 + > tools/imagetool.h |1 + > tools/mkimage.c |7 + > tools/zynqmpbif.c | 1008 > +++ > tools/zynqmpimage.c |4 +- > tools/zynqmpimage.h |7 + > 8 files changed, 1028 insertions(+), 2 deletions(-) > create mode 100644 tools/zynqmpbif.c > > diff --git a/common/image.c b/common/image.c > index e1c50eb25d..f30dfa229b 100644 > --- a/common/image.c > +++ b/common/image.c > @@ -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" }, > diff --git a/include/image.h b/include/image.h > index a579c5f509..c5af912aeb 100644 > --- a/include/image.h > +++ b/include/image.h > @@ -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 */ > diff --git a/tools/Makefile b/tools/Makefile > index 8143c25666..204685ec9e 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -113,6 +113,7 @@ dumpimage-mkimage-objs := aisimage.o \ > ublimage.o \ > zynqimage.o \ > zynqmpimage.o \ > + zynqmpbif.o \ > $(LIBFDT_OBJS) \ > gpimage.o \ > gpimage-common.o \ > diff --git a/tools/imagetool.h b/tools/imagetool.h > index e67de9b5ad..6a7e7386f7 100644 > --- a/tools/imagetool.h > +++ b/tools/imagetool.h > @@ -232,6 +232,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) > diff --git a/tools/mkimage.c b/tools/mkimage.c > index 4e561820e7..fe861f5405 100644 > --- a/tools/mkimage.c > +++ b/tools/mkimage.c > @@ -514,6 +514,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, ¶ms); > + } else if (params.type == IH_TYPE_ZYNQMPBIF) { > + /* Image file is meta, walk through actual targets */ > + int ret; > + > + ret = zynqmpbif_copy_image(ifd, ¶ms); > + if (ret) > + return ret; > } else { > copy_file(ifd, params.datafile, pad_len); > } > diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c > new file mode 1006
[U-Boot] [PATCH v4 4/4] 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 --- v2 -> v3: - zero initialize header - reduce default debug verbosity v3 -> v4: - add error handling - add fsbl_config support - add aarch32 support - allow a5x to be written as a53 - add offset support - add support for partition_owner - ensure pmufw comes before bootloader - simplify fsbl_config - add non-a53 boot support - checkpatch fixes --- common/image.c |1 + include/image.h |1 + tools/Makefile |1 + tools/imagetool.h |1 + tools/mkimage.c |7 + tools/zynqmpbif.c | 1008 +++ tools/zynqmpimage.c |4 +- tools/zynqmpimage.h |7 + 8 files changed, 1028 insertions(+), 2 deletions(-) create mode 100644 tools/zynqmpbif.c diff --git a/common/image.c b/common/image.c index e1c50eb25d..f30dfa229b 100644 --- a/common/image.c +++ b/common/image.c @@ -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" }, diff --git a/include/image.h b/include/image.h index a579c5f509..c5af912aeb 100644 --- a/include/image.h +++ b/include/image.h @@ -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 */ diff --git a/tools/Makefile b/tools/Makefile index 8143c25666..204685ec9e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -113,6 +113,7 @@ dumpimage-mkimage-objs := aisimage.o \ ublimage.o \ zynqimage.o \ zynqmpimage.o \ + zynqmpbif.o \ $(LIBFDT_OBJS) \ gpimage.o \ gpimage-common.o \ diff --git a/tools/imagetool.h b/tools/imagetool.h index e67de9b5ad..6a7e7386f7 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h @@ -232,6 +232,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) diff --git a/tools/mkimage.c b/tools/mkimage.c index 4e561820e7..fe861f5405 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -514,6 +514,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, ¶ms); + } else if (params.type == IH_TYPE_ZYNQMPBIF) { + /* Image file is meta, walk through actual targets */ + int ret; + + ret = zynqmpbif_copy_image(ifd, ¶ms); + if (ret) + return ret; } else { copy_file(ifd, params.datafile, pad_len); } diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c new file mode 100644 index 00..6c8f66055d --- /dev/null +++ b/tools/zynqmpbif.c @@ -0,0 +1,1008 @@ +/* + * Copyright (C) 2018 Alexander Graf + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include "imagetool.h" +#include "mkimage.h" +#include "zynqmpimage.h" +#include +#include + +struct bif_entry { + const char *filename; + uint64_t flags; + uint64_t dest_cpu; + uint64_t exp_lvl; + uint64_t dest_dev; + uint64_t load; + uint64_t entry; + size_t offset; +}; + +enum bif_flag { + BIF_FLAG_AESKEYF