Run bootgen on Debian GNU / Linux, Ubuntu

Introduction

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.

  1. Generate a system-on-chip (SoC) boot image (boot.bin) such as Zynq or ZynqMP Reference: ["Building Debian GNU / Linux (v2018.2 version) for Ultra96 (BOOT.BIN edition)" @Qiita] Building BOOT.BIN
  2. Convert a bitstream file (xxxx.bit) to a binary file (xxxx.bin) when configuring the FPGA Reference: ["Example of configuring FPGA with Debian GNU / Linux (v2018.2 version) for UltraZed" @Qiita] [Example of configuration]

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.

How to build and install normally

Preparation

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

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.

Build

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

Installation

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

How to install as Debian Package

Preparation

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)
  :

download

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

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

Installation

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                                        |
------------------------------------------------------------------------------+

reference

Recommended Posts

Run bootgen on Debian GNU / Linux, Ubuntu
Run Lima Driver on Debian GNU / Linux for Ultra96 / Ultra96-V2
Run Debian (Linux) & LXQt on Athlon 200GE (AMD)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Video Driver)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Gnome Desktop)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Installation)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Build)
Run Jupyter on Ubuntu on Windows
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Build) [Unfinished]
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Installation) [Unfinished]
Linux on Windows -1-: debian introduction
Run FreeBSD on Linux + qemu
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Vitis edition)
Install and run dropbox on Ubuntu 20.04
Run a Linux server on GCP
Run XGBoost on Bash on Ubuntu on Windows
Run vmware horizon client on Debian
[Note] Run Django on Amazon Linux 2
Run docker-compose on Amazon Linux2 on ARM64
Run Yocto on Ubuntu using QEMU.
Run cron on Amazon Linux (set on Linux)
Ubuntu Linux 20.04
Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (fbdev)
Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview)
Run Keycloak on Amazon Linux 2 without Docker
How to install php7.4 on Linux (Ubuntu)
On Ubuntu Linux, set Tab to q
Run Linux on ARM architecture with QEMU
Compiling the Linux kernel (Linux 5.x on Ubuntu 20.04)
Running XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview)
Install debian on linux on Arrows tab Q584 / H
Set up golang with goenv on GNU / Linux
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
Shebang on Ubuntu 20.04
linux (ubuntu) memo
How to run MeCab on Ubuntu 18.04 LTS Python
How to build Java environment on Ubuntu (Linux)
Run Kali Linux on Windows with GUI (without VirtualBox)
Run Tensorflow from Jupyter Notebook on Bash on Ubuntu on Windows
Install Apache 2.4 on Ubuntu 19.10 Eoan Ermine and run CGI
I want to use OpenJDK 11 on Ubuntu Linux 18.04 LTS / 18.10
Install Docker on Arch Linux and run it remotely
Multiply PDF by OCR on command line on Linux (Ubuntu)
Daemonizing processes on Linux
Install TensorFlow on Ubuntu
jblas on Arch Linux
Linux (WSL) on Windows
NAT router on Linux
Run Django on PythonAnywhere
Install PySide2 on Ubuntu
Run mysqlclient on Lambda
Install JModelica on Ubuntu
Develop .NET on Linux
Wake on lan on Linux
Run OpenMVG on Mac
Monitor traffic on Linux
Update vscode on linux
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Try NeosVR on Linux
Installing pyenv on ubuntu 16.04