This is an old revision of the document!
Building the Firmware Image
Prerequisites
-
Xilinx Vivado Design Suite
Xilinx Vivado SDK
There are a few other tools that are necessary in order to build your own Firmware Image.
This specifies any shell prompt running on your Linux development host
michael@HAL9000:~/devel$ sudo apt-get install git build-essential fakeroot libncurses5-dev libssl-dev ccache dfu-util
Building
Starting the build process is just a matter of typing make
within the firmware repository.
The Makefile requires a few environmental variables being set, and of course the ARM GCC toolchain in the PATH.
Some paths maybe adjusted to match your Xilinx Vivado and SDK install folders.
This specifies any shell prompt running on your Linux development host
michael@HAL9000:~/devel$ cd plutosdr-fw or m2k-fw
michael@HAL9000:~/devel/plutosdr-fw$ export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
michael@HAL9000:~/devel/plutosdr-fw$ export PATH=$PATH:/opt/Xilinx/SDK/2016.2/gnu/arm/lin/bin
michael@HAL9000:~/devel/plutosdr-fw$ export VIVADO_SETTINGS=/opt/Xilinx/Vivado/2016.2/settings64.sh
michael@HAL9000:~/devel/plutosdr-fw$ make
The initial build takes some time to complete, and also requires an INTERNET connection, since buildroot downloads the source packages from the WEB.
Build Artifacts
This specifies any shell prompt running on your Linux development host
michael@HAL9000:~/devel/plutosdr-fw$ ls -AGhl build
total 52M
-rw-rw-r-- 1 michael 69 Apr 19 17:45 boot.bif
-rw-rw-r-- 1 michael 446K Apr 19 17:45 boot.bin
-rw-rw-r-- 1 michael 446K Apr 19 17:45 boot.dfu
-rw-rw-r-- 1 michael 575K Apr 19 17:45 boot.frm
-rw-rw-r-- 1 michael 8,3M Apr 19 17:45 pluto.dfu
-rw-rw-r-- 1 michael 8,3M Apr 19 17:45 pluto.frm
-rw-rw-r-- 1 michael 33 Apr 19 17:45 pluto.frm.md5
-rw-rw-r-- 1 michael 8,3M Apr 19 17:45 pluto.itb
-rw-rw-r-- 1 michael 16M Apr 19 17:45 plutosdr-fw-v0.20.zip
-rw-rw-r-- 1 michael 471K Apr 19 17:45 plutosdr-jtag-bootstrap-v0.20.zip
-rw-r--r-- 1 michael 4,2M Apr 19 17:39 rootfs.cpio.gz
drwxrwxr-x 6 michael 4,0K Apr 19 17:45 sdk
-rw-rw-r-- 1 michael 940K Apr 19 17:45 system_top.bit
-rw-rw-r-- 1 michael 362K Apr 19 17:45 system_top.hdf
-rwxrwxr-x 1 michael 409K Apr 19 17:45 u-boot.elf
-rw-rw---- 1 michael 128K Apr 19 17:45 uboot-env.bin
-rw-rw---- 1 michael 129K Apr 19 17:45 uboot-env.dfu
-rw-rw-r-- 1 michael 4,6K Apr 19 17:45 uboot-env.txt
-rwxrwxr-x 1 michael 3,2M Apr 19 17:33 zImage
-rw-rw-r-- 1 michael 16K Apr 19 17:39 zynq-pluto-sdr.dtb
-rw-rw-r-- 1 michael 16K Apr 19 17:39 zynq-pluto-sdr-revb.dtb
Main targets
File | Comment |
pluto.frm | Main PlutoSDR firmware file used with the USB Mass Storage Device |
pluto.dfu | Main PlutoSDR firmware file used in DFU mode |
boot.frm | First and Second Stage Bootloader (u-boot + fsbl + uEnv) used with the USB Mass Storage Device |
boot.dfu | First and Second Stage Bootloader (u-boot + fsbl) used in DFU mode |
uboot-env.dfu | u-boot default environment used in DFU mode |
plutosdr-fw-vX.XX.zip | ZIP archive containg all of the files above |
plutosdr-jtag-bootstrap-vX.XX.zip | ZIP archive containg u-boot and Vivao TCL used for JATG bootstrapping |
File | Comment |
boot.bif | Boot Image Format file used to generate the Boot Image |
boot.bin | Final Boot Image |
pluto.frm.md5 | md5sum of the pluto.frm file |
pluto.itb | u-boot Flattened Image Tree |
rootfs.cpio.gz | The Root Filesystem archive |
sdk | Vivado/XSDK Build folder including the FSBL |
system_top.bit | FPGA Bitstream (from HDF) |
system_top.hdf | FPGA Hardware Description File exported by Vivado |
u-boot.elf | u-boot ELF Binary |
uboot-env.bin | u-boot default environment in binary format created form uboot-env.txt |
uboot-env.txt | u-boot default environment in human readable text format |
zImage | Compressed Linux Kernel Image |
zynq-pluto-sdr.dtb | Device Tree Blob for Rev.A |
zynq-pluto-sdr-revb.dtb | Device Tree Blob for Rev.B |
How does it work
All these steps are automatically handled by make.
They are just explained here, for those who are interested.
Build Linux kernel
make -C linux ARCH=arm zynq_pluto_defconfig
make -C linux -j 8 ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- zImage UIMAGE_LOADADDR=0x8000
cp linux/arch/arm/boot/zImage build/zImage
Build Devicetrees
make -C linux -j 8 ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- zynq-pluto-sdr.dtb
cp linux/arch/arm/boot/dts/zynq-pluto-sdr.dtb build/zynq-pluto-sdr.dtb
make -C linux -j 8 ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- zynq-pluto-sdr-revb.dtb
cp linux/arch/arm/boot/dts/zynq-pluto-sdr-revb.dtb build/zynq-pluto-sdr-revb.dtb
Build Buildroot User Space
make -C buildroot ARCH=arm zynq_pluto_defconfig
make -C buildroot TOOLCHAIN_EXTERNAL_INSTALL_DIR= ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- BUSYBOX_CONFIG_FILE=/home/michael/devel/pluto/plutosdr-fw/buildroot/board/pluto/busybox-1.25.0.config all
cp buildroot/output/images/rootfs.cpio.gz build/rootfs.cpio.gz
Build FPGA Hardware Description File
Function | File |
Pluto HDL Project | Files |
source /opt/Xilinx/Vivado/2016.2/settings64.sh
make -C hdl/projects/pluto
cp hdl/projects/pluto/pluto.sdk/system_top.hdf build/system_top.hdf
Build FPGA First Stage Bootloader (FSBL)
source /opt/Xilinx/Vivado/2016.2/settings64.sh
xsdk -batch -source scripts/create_fsbl_project.tcl
cp build/sdk/hw_0/system_top.bit build/system_top.bit
Build multi component FIT image (Flattened Image Tree)
Function | File |
PlutoSDR Image Tree Source | pluto.its |
u-boot-xlnx/tools/mkimage -f scripts/pluto.its build/pluto.itb
Build Firmware DFU image
cp build/pluto.itb build/pluto.itb.tmp
dfu-suffix -a build/pluto.itb.tmp -v 0x0456 -p 0xb673
mv build/pluto.itb.tmp build/pluto.dfu
Build Firmware FRM image
md5sum build/pluto.itb | cut -d ' ' -f 1 > build/pluto.frm.md5
cat build/pluto.itb build/pluto.frm.md5 > build/pluto.frm
Build u-boot
make -C u-boot-xlnx ARCH=arm zynq_pluto_defconfig
make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- UBOOTVERSION="PlutoSDR v0.20-PlutoSDR"
cp u-boot-xlnx/u-boot build/u-boot.elf
Build Zynq Boot Image
echo img:{[bootloader] build/sdk/fsbl/Release/fsbl.elf build/u-boot.elf } > build/boot.bif
source /opt/Xilinx/Vivado/2016.2/settings64.sh
bootgen -image build/boot.bif -w -o build/boot.bin
Build Boot DFU Image
cp build/boot.bin build/boot.bin.tmp
dfu-suffix -a build/boot.bin.tmp -v 0x0456 -p 0xb673
mv build/boot.bin.tmp build/boot.dfu
Build u-boot default environment Image
CROSS_COMPILE=arm-xilinx-linux-gnueabi- scripts/get_default_envs.sh > build/uboot-env.txt
u-boot-xlnx/tools/mkenvimage -s 0x20000 -o build/uboot-env.bin build/uboot-env.txt
Build u-boot default environment DFU Image
cp build/uboot-env.bin build/uboot-env.bin.tmp
dfu-suffix -a build/uboot-env.bin.tmp -v 0x0456 -p 0xb673
mv build/uboot-env.bin.tmp build/uboot-env.dfu
Build Boot FRM image
cat build/boot.bin build/uboot-env.bin scripts/target_mtd_info.key | tee build/boot.frm | md5sum | cut -d ' ' -f1 | tee -a build/boot.frm