This is an old revision of the document!
We provide a script that does automates the build for Zynq using the Linaro toolchain.
The script takes up to 3 parameters, but if left blank, it uses defaults:
zynq-zc702-adv7511-ad9361-fmcomms2-3.dtb
for ZynqThe script will:
wget https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/master/linux/build_zynq_kernel_image.sh && chmod +x build_zynq_kernel_image.sh && ./build_zynq_kernel_image.sh
Please see here: Building with Petalinux
Make sure you have u-boot-tools
installed, to have the mkimage
utility available.
You can install it via your distro's package manager.
Then
git clone https://github.com/analogdevicesinc/linux.git
or do a git pull in the existing repository.
Release names and Branches |
---|
2014_R2 |
2015_R2 |
2016_R1 |
2016_R2 |
2017_R1 |
2018_R1 |
2018_R2 |
2019_R1 |
2019_R2 |
dave@hal9000:~/github-linux-build/linux$ git checkout origin/2019_R2 -b 2019_R2 Branch 2019_R2 set up to track remote branch 2019_R2 from origin. Switched to a new branch '2019_R2'
There are a few toolchains that can be used. The Xilinx toolchain is recommended, but the Linaro toolchain can also be used.
Other toolchains/compilers for ARM may work as well, but the ones described here have been tested and found to work.
Release names and Branches | Required Vivado/SDK versions |
---|---|
2014_R2 | Vivado 2014.2 |
2015_R2 | Vivado 2015.2 |
2016_R1 | Vivado 2015.4.2 |
2016_R2 | Vivado 2016.2 |
2017_R1 | Vivado 2016.4 |
2018_R1 | Vivado 2017.4 |
2018_R2 | Vivado 2018.2 |
2019_R1 | Vivado 2018.3 |
2019_R2 | Vivado 2019.1 |
Vivado 2019.1 SDK may be installed into a different directory
dave@hal9000:~/github-linux-build/linux$ source $PATH_to_Xilinx/Xilinx/SDK/$SDK_version/settings64.sh
dave@hal9000:~/github-linux-build/linux$ export ARCH=arm dave@hal9000:~/github-linux-build/linux$ export CROSS_COMPILE="arm-linux-gnueabihf-"
Alternatively, the Linaro toolchain/compiler can be used to compile to kernel. Linaro compilers (that work with Zynq) can be downloaded from: https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabi/
Example:
wget https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabi/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz tar -xvf gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz
export ARCH=arm export CROSS_COMPILE=$(pwd)/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-
dave@hal9000:~/github-linux-build/linux$ make zynq_xcomm_adv7511_defconfig # # configuration written to .config # dave@hal9000:~/github-linux-build/linux$
dave@hal9000:~/github-linux-build/linux$ make -j5 UIMAGE_LOADADDR=0x8000 uImage scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h UPD include/config/kernel.release CHK include/generated/utsrelease.h [ -- snip --] AS arch/arm/boot/compressed/bswapsdi2.o AS arch/arm/boot/compressed/piggy.gzip.o LD arch/arm/boot/compressed/vmlinux OBJCOPY arch/arm/boot/zImage Kernel: arch/arm/boot/zImage is ready UIMAGE arch/arm/boot/uImage Image Name: Linux-3.17.0-126697-g611e217-dir Created: Fri Nov 28 10:20:40 2014 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3195872 Bytes = 3120.97 kB = 3.05 MB Load Address: 00008000 Entry Point: 00008000 dave@hal9000:~/github-linux-build/linux$
zynq-adrv9361-z7035-bob | ADRV1CRR-BOB | ADRV9361 |
zynq-adrv9361-z7035-bob-cmos | ADRV1CRR-BOB | ADRV9361 |
zynq-adrv9361-z7035-packrf | ADRV-PACKRF | ADRV9361 |
zynq-adrv9361-z7035-fmc | ADRV1CRR-FMC | the on-board ADV7511 and the ADRV9361 |
zynq-adrv9361-z7035-fmc-rfcard-tdd | ADRV1CRR-FMC | the on-board ADV7511, ADRV9361 and the AD-PZSDR2400TDD-EB |
zynq-adrv9364-z7020-bob | ADRV1CRR-BOB | ADRV9364 |
zynq-adrv9364-z7020-bob-cmos | ADRV1CRR-BOB | ADRV9364 |
zynq-adrv9364-z7020-packrf | ADRV-PACKRF | ADRV9364 |
zynq-mini-itx-adv7511 | Mini-ITX | the on-board ADV7511 |
zynq-mini-itx-adv7511-ad9361-fmcomms2-3 | Mini-ITX | on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board |
zynq-mini-itx-adv7511-ad9364-fmcomms4 | Mini-ITX | the on-board ADV7511 and the AD-FMCOMMS4-EBZ board |
zynq-zc702-adv7511 | ZC702 | the on-board ADV7511 |
zynq-zc702-adv7511-ad9361-fmcomms2-3 | ZC702 | the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board |
zynq-zc702-adv7511-ad9361-fmcomms5 | ZC702 | the on-board ADV7511 and the AD-FMCOMMS5-EBZ |
zynq-zc702-adv7511-ad9364-fmcomms4 | ZC702 | the on-board ADV7511 and the AD-FMCOMMS4-EBZ board |
zynq-zc706-adv7511 | ZC706 | the on-board ADV7511 |
zynq-zc706-adv7511-ad6676-fmc | ZC706 | the on-board ADV7511 and the AD6676-FMC-EBZ board |
zynq-zc706-adv7511-ad9265-fmc-125ebz | ZC706 | the on-board ADV7511 and the AD9265-FMC-125EBZ board |
zynq-zc706-adv7511-ad9361-fmcomms2-3 | ZC706 | the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board |
zynq-zc706-adv7511-ad9361-fmcomms5 | ZC706 | the on-board ADV7511 and the AD-FMCOMMS5-EBZ board |
zynq-zc706-adv7511-ad9361-fmcomms5-ext-lo-adf5355 | ZC706 | the on-board ADV7511 and the AD-FMCOMMS5-EBZ board |
zynq-zc706-adv7511-ad9364-fmcomms4 | ZC706 | the on-board ADV7511 and the AD-FMCOMMS4-EBZ board |
zynq-zc706-adv7511-ad9434-fmc-500ebz | ZC706 | the on-board ADV7511 and the AD9434-FMC-500EBZ board |
zynq-zc706-adv7511-ad9625-fmcadc2 | ZC706 | the on-board ADV7511 and the AD-FMCADC2-EBZ board |
zynq-zc706-adv7511-ad9739a-fmc | ZC706 | the on-board ADV7511 and the EVAL-AD9739A |
zynq-zc706-adv7511-adrv9371 | ZC706 | the on-board ADV7511 and the ADRV9371 board |
zynq-zc706-adv7511-adrv9375 | ZC706 | the on-board ADV7511 and the ADRV9375 board |
zynq-zc706-adv7511-fmcadc4 | ZC706 | the on-board ADV7511 and the AD-FMCADC4-EBZ board |
zynq-zc706-adv7511-fmcdaq2 | ZC706 | the on-board ADV7511 and the AD-FMCDAQ2-EBZ board |
zynq-zc706-adv7511-fmcdaq3 | ZC706 | the on-board ADV7511 and the AD-FMCDAQ3-EBZ board |
zynq-zc706-adv7511-fmcjesdadc1 | ZC706 | the on-board ADV7511 and the AD-FMCJESDADC1-EBZ board |
zynq-zc706-imageon | ZC706 | FMC-IMAGEON |
zynq-zed-adv7511 | Zed Board | the on-board ADV7511 |
zynq-zed-adv7511-ad9361-fmcomms2-3 | Zed Board | the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board |
zynq-zed-adv7511-ad9364-fmcomms4 | Zed Board | the on-board ADV7511 and the AD-FMCOMMS4-EBZ board |
zynq-zed-adv7511-ad9467-fmc-250ebz | Zed Board | the on-board ADV7511 and the AD9467-FMC-250EBZ board |
zynq-zed-adv7511-cn0363 | Zed Board | the on-board ADV7511 and the EVAL-CN0363-PMDZ board |
zynq-zed-imageon | Zed Board | FMC-IMAGEON |
dave@hal9000:~/github-linux-build/linux$ make zynq-zc702-adv7511-ad9361.dtb DTC arch/arm/boot/dts/zynq-zc702-adv7511-ad9361.dtb dave@hal9000:~/github-linux-build/linux$
dave@hal9000:~/github-linux-build/linux$ cp arch/arm/boot/uImage /media/BOOT/uImage dave@hal9000:~/github-linux-build/linux$ cp arch/arm/boot/dts/zynq-zc702-adv7511-ad9361.dtb /media/BOOT/devicetree.dtb
1. Make sure the boot partition is mounted. On new images, this can be done by right-clicking the boot icon on the desktop and selecting the “Mount Volume” option. The partition will then be mounted at /media/analog/boot.
2. Convert the compiled devicetree related to the target back into an editable format.
dave@hal9000:/media/analog/boot/zynq-zc702-adv7511$ dtc -I dtb -O dts -o devicetree.dts devicetree.dtb
3. Modify the devicetree.dts file as required.
4. Recompile the devicetree file. Note that this will overwrite the original dtb file, copy or rename the original file if you want to keep it before running this step.
dave@hal9000:/media/analog/boot/zynq-zc702-adv7511$ dtc -I dts -O dtb -o devicetree.dtb devicetree.dts
The boot image BOOT.BIN is built 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 and u-boot.elf
The script can be downloaded from here:
NOTE: After downloading the script you need to make it executable
$ chmod +x build_boot_bin.sh
usage: build_boot_bin.sh system_top.xsa u-boot.elf [output-archive]
system_top.xsa
and u-boot.elf
are required parametersname
parameter can be given to tar.gz the output directory (name
.tar.gz)$ 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
There is also a version of script that works in Windows Powershell: build_boot_bin.ps1
NOTE: u-boot.elf
For those who don't want to build u-boot themselves.
The u-boot.elf can be extracted from the project folder on the SD Card image, bootgen_sysfiles.tgz