bootgen is a development tool provided by Xilinx that integrates binary files to generate a device boot image. It is mainly used for the following purposes.
For more information on bootgen, see [Bootgen User Guide] ug1283.
Now, this bootgen is a program originally included in Xilinx Vivado and Xilinx SDK, and it only works in an environment where Xilinx Vivado or Xilinx SDK is installed to run. Also, from 2019.2, it became inconvenient because the Xilinx SDK was integrated into Vitis and only bootgen was installed separately.
Fortunately, bootgen is available on github by Xilinx.
If you build this, bootgen will work in your favorite environment. Fortunately, it works on arm64 architecture as well as x86 architecture, so it is introduced in ["Debian GNU / Linux (v2019.1 version) boot image for UltraZed / Ultra96 / Ultra96-V2"] ZynqMP-FPGA-Linux In a Linux environment, bootgen can be executed on the target as it is, which is convenient. This article provides an example of building and running on Debian GNU / Linux or Ubuntu.
You need a compiler and OpenSSL v1.1.1 to build.
To self-compile, you need to install the OpenSSL development environment in the build environment. For Debian GNU / Linux and Ubuntu, use apt install to install the libssl-dev package. When cross-compiling, it is necessary to install the OpenSSL development environment for the target architecture in the build environment, which is unexpectedly troublesome. This article does not cover how to cross-compile.
Download (clone) the following github repository.
shell# git clone https://github.com/Xilinx/bootgen
Cloning into 'bootgen'...
remote: Enumerating objects: 146, done.
remote: Counting objects: 100% (146/146), done.
remote: Compressing objects: 100% (95/95), done.
remote: Total 146 (delta 58), reused 138 (delta 50), pack-reused 0
Receiving objects: 100% (146/146), 386.16 KiB | 466.00 KiB/s, done.
Resolving deltas: 100% (58/58), done.
You can usually build bootgen by executing the make command.
shell# cd bootgen
shell#
shell# make
:
(Omission)
:
echo Building executable file: bootgen...
Building executable file: bootgen...
g++ -std=c++0x -O -Wall -Wno-reorder -Wno-deprecated-declarations -o bootgen \
bif.tab.o bif.yy.o reginit.tab.o reginit.yy.o cmdoptions.tab.o cmdoptions.yy.o \
authentication.o authentication-zynq.o authentication-zynqmp.o authkeys.o binar\
y.o binfile.o bitutils.o options.o bifoptions.o bootheader.o bootheader-zynq.o \
bootheader-zynqmp.o bootimage.o bootimage-zynq.o bootimage-zynqmp.o checksum.o \
elftools.o encryption.o encryptutils.o encryptionkeys.o encryption-zynq.o encry\
ption-zynqmp.o hash.o imageheadertable.o imageheadertable-zynq.o imageheadertab\
le-zynqmp.o Keccak-compact.o logger.o readimage.o readimage-zynq.o readimage-zy\
nqmp.o verifyimage.o main.o mcsfile.o outputfile.o parsing.o partition.o partit\
ionheadertable.o partitionheadertable-zynq.o partitionheadertable-zynqmp.o regi\
nit.o -lssl -lcrypto
shell#
shell# file bootgen
bootgen: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamica\
lly linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildI\
D[sha1]=9ea6dc2ff0979a37bd4e6
Copy the built bootgen to a location in your execution path. Here it is copied to / usr / local / bin.
shell# cp bootgen /usr/local/bin
shell# which bootgen
/usr/local/bin/bootgen
You need a compiler and OpenSSL v1.1.1 to build. You also need various tools to build the Debian Package.
shell$ sudo apt install debhelper quilt dh-exec libssl-dev
:
(Omission)
:
Place a repository for making bootgen a Debian Package at the following URL: This repository is the one I forked https://github.com/Xilinx/bootgen and added various files for building the Debian Package. Notice that the branch is 2019.2-develop, not master.
shell$ git clone -b 2019.2-develop https://github.com/ikwzm/bootgen.git
Cloning into 'bootgen'...
remote: Enumerating objects: 160, done.
remote: Counting objects: 100% (160/160), done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 160 (delta 63), reused 150 (delta 53), pack-reused 0
Receiving objects: 100% (160/160), 389.17 KiB | 397.00 KiB/s, done.
Resolving deltas: 100% (63/63), done.
Build the Debian Package with debian / rules binary.
shell$ cd bootgen
shell$ sudo debian/rules binary
:
(Omission)
:
dpkg-deb: building package 'bootgen' in '../bootgen_2019.2-1_arm64.deb'.
dpkg-deb: building package 'bootgen-dbgsym' in '../bootgen-dbgsym_2019.2-1_arm64.deb'.
If bootgen_2019.2-1_arm64.deb is created in the directory one level above, the build is successful.
shell$ dpkg --info ../bootgen_2019.2-1_arm64.deb
new Debian package, version 2.0.
size 202168 bytes: control archive=596 bytes.
338 bytes, 10 lines control
192 bytes, 3 lines md5sums
Package: bootgen
Version: 2019.2-1
Architecture: arm64
Maintainer: ikwzm <[email protected]>
Installed-Size: 758
Depends: libc6 (>= 2.17), libgcc1 (>= 1:3.0), libssl1.1 (>= 1.1.1), libstdc++6 (>= 5.2)
Section: utils
Priority: optional
Homepage: <https://github.com/Xilinx/bootgen>
Description: Bootgen for Xilinx Zynq and ZU+SoCs
Install Debian Packege using dpkg.
shell$ sudo dpkg --install ../bootgen_2019.2-1_arm64.deb
Selecting previously unselected package bootgen.
(Reading database ... 85254 files and directories currently installed.)
Preparing to unpack ../bootgen_2019.2-1_arm64.deb ...
Unpacking bootgen (2019.2-1) ...
Setting up bootgen (2019.2-1) ...
shell$ which bootgen
/usr/bin/bootgen
shell$ bootgen
****** Xilinx Bootgen v2019.2
**** Build date : Jan 16 2020-08:00:00
** Copyright 1986-2019 Xilinx, Inc. All Rights Reserved.
------------------------------------------------------------------------------+
COMMAND LINE OPTIONS |
-------------------------------+----------------------------------------------+
-arch [options] | Xilinx Architecture |
| options: [zynq, zynqmp, fpga] |
-------------------------------+----------------------------------------------+
-image <filename> | Input Boot Image File (.bif) |
-------------------------------+----------------------------------------------+
-o <filename> | Output filename in MCS/BIN format |
-------------------------------+----------------------------------------------+
-w [options] | Overwrite mode |
| options: [on, off] |
-------------------------------+----------------------------------------------+
-encrypt [options] | AES Key storage in chip (Zynq only) |
| options: [bbram, efuse] |
-------------------------------+----------------------------------------------+
-p <string> | Part name |
-------------------------------+----------------------------------------------+
-efuseppkbits <filename> | Generate PPK hash for e-fuse |
-------------------------------+----------------------------------------------+
-generate_hashes | Generate SHA hashes (PKCS#1v1.5) |
-------------------------------+----------------------------------------------+
-spksignature <filename> | Generate SPK signature file |
-------------------------------+----------------------------------------------+
-fill <hex-byte> | Fill byte for padding |
-------------------------------+----------------------------------------------+
-split [options] | Split partitions to diff files |
| options: [bin, mcs] |
-------------------------------+----------------------------------------------+
-padimageheader [options] | Pad header tables |
| options: [0, 1] |
-------------------------------+----------------------------------------------+
-process_bitstream [options] | Outputs bitstream in bin/mcs format |
| options: [bin, mcs] |
-------------------------------+----------------------------------------------+
-generate_keys [options] | Generate authentication keys |
| options: [pem, rsa, obfuscatedkey] |
-------------------------------+----------------------------------------------+
-dual_qspi_mode [options] | Generate 2 output files for Dual QSPI |
| options: [parallel, stacked <size>] |
-------------------------------+----------------------------------------------+
-log [options] | Generate log file |
| options: [error, warning, info, debug, trace]|
-------------------------------+----------------------------------------------+
-zynqmpes1 | Generate boot image for (1.0)ES1 |
-------------------------------+----------------------------------------------|
-nonbooting | Generate an intermediate boot image |
-------------------------------+----------------------------------------------|
-encryption_dump | Generate encryption log file |
-------------------------------+----------------------------------------------+
-verify | Verify BootImage authentication |
-------------------------------+----------------------------------------------+
-h | -help | Print the help summary |
-------------------------------+----------------------------------------------+
-bif_help | Print the BIF help summary |
-------------------------------+----------------------------------------------+
Note : For more info on bootgen options, use the command |
bootgen -help <option> |
Example : bootgen -help efuseppkbits |
------------------------------------------------------------------------------+
Recommended Posts