We provide a script that does automates the build for Zynq using the Linaro toolchain.
Note that this script differs from the one for Zynq.
The script takes up to 3 parameters, but if left blank, it uses defaults:
The script will:
wget https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/master/linux/build_zynqmp_kernel_image.sh && chmod +x build_zynqmp_kernel_image.sh && ./build_zynqmp_kernel_image.sh zynqmp
Please see here: Building with Petalinux
Create a local copy of ADI's kernel tree
git clone https://github.com/analogdevicesinc/linux.git
or do a git pull in an existing repository.
dave@hal9000:~/github-linux-build/linux$ git checkout master Already on 'master' Your branch is up-to-date with 'origin/master'.
Vivado 2016.2 SDK may be installed into a different directory
dave@hal9000:~/github-linux-build/linux$ export PATH=$PATH:/opt/Xilinx/SDK/2017.2/gnu/aarch64/lin/aarch64-linux/bin
Other toolchains/compilers for ARM may work as well, but the ones described here have been tested and found to work.
Alternatively, the Linaro toolchain/compiler can be used to compile to kernel. Linaro compilers (that work with ZYNQMP) can be downloaded from: https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/ . Always use the latest release just in case.
dave@hal9000:~/github-linux-build/linux$ export ARCH=arm64 dave@hal9000:~/github-linux-build/linux$ export CROSS_COMPILE=$(pwd)/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
Inside the repository, generate the configuration file before building the kernel tree.
dave@hal9000:~/github-linux-build/linux$ make adi_zynqmp_defconfig # # configuration written to .config # dave@hal9000:~/github-linux-build/linux$
Build the kernel via 'make'. This is the same for all Xlinx ZYNQMP MPSoC FPGAs.
dave@hal9000:~/github-linux-build/linux$ make -j5 Image UIMAGE_LOADADDR=0x8000 CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/bin2c [ -- snip --] CC init/version.o LD init/built-in.o KSYM .tmp_kallsyms1.o KSYM .tmp_kallsyms2.o LD vmlinux SORTEX vmlinux SYSMAP System.map OBJCOPY arch/arm64/boot/Image dave@hal9000:~/github-linux-build/linux$
|zynqmp-zcu102-rev10-ad9361-fmcomms2-3.dts||ZCU102 Rev. 1.0 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board|
|zynqmp-zcu102-rev10-ad9364-fmcomms4.dts||ZCU102 Rev. 1.0 and the AD-FMCOMMS4-EBZ or AD-FMCOMMS4-EBZ board|
|zynqmp-zcu102-revB-ad9361-fmcomms2-3.dts||ZCU102 Rev.B and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board|
|zynqmp-zcu102-revB-ad9364-fmcomms4.dts||ZCU102 Rev.B and the AD-FMCOMMS4-EBZ board|
The device tree zynqmp-zcu102-revA.dts can also be used for any ZCU102 FPGA that uses an SD card for boot up. Building the device tree uses 'make' by turning the .dts file to a .dtb. The command is simply 'make' plus the device tree name with a .dtb file extension.
dave@hal9000:~/github-linux-build/linux$ make xilinx/zynqmp-zcu102-rev10-ad9361-fmcomms2-3.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev10-ad9361-fmcomms2-3.dtb dave@hal9000:~/github-linux-build/linux$
The output files for building the kernel and device tree are Image and <device_tree_name>.dtb. Refer to the code below to find their respective output directories. The device tree file needs to be renamed to system.dtb. See kuiper-linux for more information in configuring the SD card.
dave@hal9000:~/github-linux-build/linux$ cp arch/arm64/boot/Image /media/michael/BOOT/ dave@hal9000:~/github-linux-build/linux$ cp arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB-ad9361-fmcomms2-3.dtb /media/michael/BOOT/system.dtb
The boot image BOOT.BIN is build using the bootgen tool which requires several input files.
Instructions on how to build the Xilinx Shell Archive (XSA) handover file can be found here:
All further steps are lengthy explained on the Xilinx Wiki Page
For ease of use we provide a bash shell script which allows building BOOT.BIN from system_top.xsa, u-boot.elf and either bl31.elf or a path to the Arm Trusted Firmware repository
The script can be downloaded from here:
NOTE: After downloading the script you need to make it executable
$ chmod +x build_zynqmp_boot_bin.sh
usage: build_zynqmp_boot_bin.sh system_top.xsa u-boot.elf (download | bl31.elf | <path-to-arm-trusted-firmware-source>) [output-archive]
u-boot.elfare required parameters.
system_top.xsa, see Building HDL. After building a project in the HDL repository, it can be found inside a <project>_<board>.sdk folder.
download(which will git clone the ATF repository),
bl31.elfor the file system
pathto the Arm Trusted Firmware source code repository
nameparameter can be given to tar.gz the output directory. (
$ source /opt/Xilinx/Vivado/202x.x/settings64.sh
export PATH=$PATH:/cygdrive/c/Xilinx/Vivado/202x.x/bin export PATH=$PATH:/cygdrive/c/Xilinx/Vitis/202x.x/bin export PATH=$PATH:/cygdrive/c/Xilinx/Vitis/202x.x/gnu/microblaze/nt/bin
NOTE: u-boot.elf and bl31.elf
For those who don't want to build u-boot or bl31 themselves.
Both u-boot.elf and bl31.elf can be extracted from the project folder on the SD Card image, bootgen_sysfiles.tgz.
u-boot.elf may have a different name, rename that .elf file to u-boot.elf before using.
The default configuration for most of the projects is to use the HDMI output, and that is what the configuration is set up for.
For DisplayPort projects, you may need to add a custom
root@analog:~# printf "Section \"Device\"\n Identifier \"myfb\"\n Driver \"fbdev\"\n Option \"fbdev\" \"/dev/fb0\"\nEndSection\n" > /etc/X11/xorg.conf root@analog:~# cat /etc/X11/xorg.conf Section "Device" Identifier "myfb" Driver "fbdev" Option "fbdev" "/dev/fb0" EndSection
After following that, the board should be rebooted.
You can find a list with tested monitors here. Resolution or image problems may appear if there is used a monitor that was not tested.