Wiki

This version (20 Nov 2018 15:55) was approved by mhennerich.The Previously approved version (24 May 2018 10:58) is available.Diff

Building the ZynqMP / MPSoC Linux kernel and devicetrees from source

The script method

We provide a script that does automates the build for Zynq using the Linaro toolchain.

The script takes 4 parameters:

  1. <zynq|zynqmp> - specifying zynqmp this is mandatory for ZynqMP ; default is zynq
  2. <local_kernel_dir> - default is linux-adi if left blank ; use this, if you want to use an already cloned kernel repo
  3. <devicetree_file> - which device tree should be exported/copied from the build ; default is zynqmp-zcu102-rev10-ad9361-fmcomms2-3.dtb for Zynq
  4. <path_to_other_toolchain> - in case you have your own preferred ARM64 toolchain [other than Linaro's or Xilinx's] you can use override it with this 3rd param

The script will:

  1. clone the ADI kernel tree
  2. download the Linaro GCC toolchain [if no other is specified]
  3. build the ADI kernel tree
  4. export/copy the Image file and device tree file out of the kernel build folder

Running the script in one line [with defaults]

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 zynqmp

On the development host

git clone https://github.com/analogdevicesinc/linux.git

or do a git pull in the existing repository.

Checkout the master development/master branch

dave@hal9000:~/github-linux-build/linux$ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.

Add aarch64-linux-gnu-gcc to PATH

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

Setup cross compile environment variables

dave@hal9000:~/github-linux-build/linux$ export ARCH=arm64

dave@hal9000:~/github-linux-build/linux$ export CROSS_COMPILE=aarch64-linux-gnu-

Configure the kernel

dave@hal9000:~/github-linux-build/linux$ make adi_zynqmp_defconfig 
#
# configuration written to .config
#
dave@hal9000:~/github-linux-build/linux$

Build the kernel

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$

Build the devicetree FCMOMMS2/3

Build the one that fits your FPGA carrier and FMC card

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

Copy the generated files to your 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

Building the ZynqMP boot image

The boot image BOOT.BIN is build using the bootgen tool which requires several input files.

Instructions on how to build the Hardware Description File (HDF) handover file can be found here:

All further steps are lengthy explained on the Xilinx Wiki Page

Use script to build BOOT.BIN

For ease of use we provide a bash shell script which allows building BOOT.BIN from system_top.hdf, u-boot.elf and either bl31.elf or a path to the Arm Trusted Firmware repository

Download

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

usage: build_zynqmp_boot_bin.sh system_top.hdf u-boot.elf (download | bl31.elf | <path-to-arm-trusted-firmware-source>) [output-archive]
  • Path to system_top.hdf and u-boot.elf are required parameters.
  • The 3rd argument must either be download (which will git clone the ATF repository), bl31.elf or the file system path to the Arm Trusted Firmware source code repository
  • An optionally 4th name parameter can be given to tar.gz the output directory. (name.tar.gz)
  • Build output is located in a local directory named: output_boot_bin.
  • This script requires Xilinx XSDK and bootgen in the PATH.
    • A simple way is to source vivado settings[32|64].sh:
$ source /opt/Xilinx/Vivado/201x.x/settings64.sh

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

14 Feb 2018 15:09 · mhennerich

DisplayPort - no picture?

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
resources/tools-software/linux-build/generic/zynqmp.txt · Last modified: 20 Nov 2018 15:55 by mhennerich