I recently needed to have a copy off bootgen I could build to run on my Zynq platform. I found an open-source version called zynq-mkbootgen here:
It needs two libraries: pcre and elf, which I found at:
I downloaded and unpacked the libraries onto my Linux box with the Petalinux 2016.2 tools installed. In each directory, I ran:
Be aware that the host parameter for your system will vary depending on which version of Petalinux you have installed. For example, an earlier version might have been arm-xilinx-linux-gnueabi.
For libelf, despite using the configure command, you will need to manually edit:
In each of these, change the CC = gcc to read CC = arm-xilinx-linux-gnueab-gcc. In addition, in lib/Makefile, change AR = ar to AR = arm-xilinx-linux-gnueabi-ar. Note the gcc and ar prefix should match the one used in your ./configure command. Do a make in each of the library directories.
Now unpack your mkbootimage tarball and edit the Makefile there. Again, change CC=gcc to read CC=arm-xilinx-linux-gnueab-gcc. In addition, append to the CFLAGS after the –std=c11 pointers to the include directories and library directories:
-I../libelf-0.3.13/lib -L../libelf-0.3.13/lib -L../pcre-8.41/.libs
Do a make. and you should now have a functioning mkbootimage executable you can put on your Zynq platform. You can then do a:
mkbootimage boot.bif BOOT.BIN
to generate an appropriate BOOT.BIN.
All the files needed to build mkbootimage may be found at https://www.dropbox.com/s/9r66x2f4b319leo/mkbootimage.tar.gz?dl=0 which includes a working executable for Petalinux 2016.2.