The aim of this How To is to provide procedure for building the complete Linux system for Zynq-7000 AP SoC using an open source tool called Buildroot. Buildroot is a tool that simplifies and automates the process of building a complete Linux system for an embedded system, using cross-compilation. Because of its configurability, it allows you to create a completely customized rootfs, which can then be used with the kernel of your preference. It can create complete embedded Linux system, containing boot loaders, kernel, devicetree and rootfs.

System Requirements

In order to achieve this, Buildroot is able to generate a cross-compilation toolchain, a root filesystem, a Linux kernel image and a boot loader for your target.

Note: Buildroot is designed to run on Linux system. Steps provided in this tech tip are executed in Ubuntu Linux system. Before going to run the steps, update the below mentioned packages.

Buildroot will build most of the host packages it needs for the compilation. However, certain standard Linux utilities are expected to be already installed on the host system. Find the overview of the mandatory and optional packages (note that package names may vary for different distributions) in Appendix-A.

Configuring and building RootFS for Zynq-7000 AP SoC

This section describes how to configure and build the custom root filesystem for Xilinx Zynq-7000 AP SoC .With the default configuration mentioned below, the tool will create a bootable SD image with the default Buildroot settings and packages. It will create its own toolchain, using the hardfloat ABI, and cross compile the v2015.3 u-boot and kernel from the Xilinx git, using the ZC702 settings and device tree.

$ wget http://buildroot.uclibc.org/downloads/buildroot-2015.02.tar.gz
  • Open a Terminal, change the directory to where you copied the Buildroot archive and type the following commands to extract the Buildroot archive.

$ tar xzvf buildroot-2015.08.tar.gz

  • Change the directory to extracted Buildroot directory.

$ cd buildroot-2015.08

  • Create the default configuration file (for ZC702 board).

$ vim configs/zc702_defconfig

  • Copy following setting flags in file “zc702_defconfig”

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_EABIHF=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_FPU_VFPV3=y
BR2_KERNEL_HEADERS_4_0=y

BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Xilinx/linux-xlnx"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="xilinx-v2015.3"
BR2_LINUX_KERNEL_DEFCONFIG="xilinx_zynq"
BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x8000"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="zynq-zc702"
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_TARGET_ROOTFS_CPIO_UIMAGE=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="zynq_zc70x"
BR2_TARGET_UBOOT_CUSTOM_GIT=y
BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/Xilinx/u-boot-xlnx"
BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="xilinx-v2015.3"
BR2_TARGET_UBOOT_FORMAT_IMG=y
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="boot.bin"

Save the file and exit

  • Apply this configuration

$ make zc702_defconfig

  • At this point, the default menuconfig can be used to change the toolchain settings, add packages, etc. Also the subcomponents can be configured here. For this note, the images are generated with default configuration settings.

$ make menuconfig
$ make busybox-menuconfig
$ make linux-menuconfig


  • Build the toolchain and images with the selected setting by doing make.

$ make

Note -
If you encounter an error related to DTC, verify if the host machine has DTC and that the PATH is set to right directory. If DTC is missing, refer appendix-A.

It will take some time to download and check required packages. Ensure that network proxy settings are done properly and all the packages required for Buildroot are installed on the host machine.

At this point, the generated rootfs output/images/rootfs.cpio.uboot can be used for your board. When using this rootfs with prebuilt images from the Xilinx wiki, this file should be renamed as uramdisk.image.gz and put on the SD card next to the BOOT.BIN, uImage and devicetree.dtb from the prebuilt images.
Note: Prebuilt images can be found at http://www.wiki.xilinx.com/Zynq+2015.3+Release

$ cp output/images/rootfs.cpio.uboot <SD>/uramdisk.image.gz

Creating bootable images for Zynq ZC702 board using U-boot SPL

The default Buildroot configuration for the ZC702 created above can also build the Linux kernel, u-boot and u-boot SPL. In order to create a bootable image for the ZC702 board, follow these additional steps:

  • Add the ps7_init files to the u-boot sources to allow a correct u-boot SPL version to be build.

$ cp output/build/uboot-xilinx-v2015.3/board/xilinx/zynq/ZC702_hw_platform/ps7_init_gpl.{c,h} output/build/uboot-xilinx-v2015.3/board/xilinx/zynq/

  • Rebuild the u-boot images. This will also create a correct boot.bin including the u-boot SPL.

$ make uboot-rebuild all

  • Rename the output images to match what is expected by the default u-boot configuration. For example, this will copy all images to a sub-folder sd which can be put on an SD card to boot from.

$ mkdir -p output/images/sd
$ cp output/images/boot.bin output/images/sd
$ cp output/images/uImage output/images/sd
$ cp output/images/u-boot.img output/images/sd/u-boot.img
$ cp output/images/zynq-zc702.dtb output/images/sd/devicetree.dtb
$ cp output/images/rootfs.cpio.uboot output/images/sd/uramdisk.image.gz

At this point, the contents of the output/images/sd folder can be copied on an SD card, and used to boot the ZC702 board. After booting the zc702 board with these images, buildroot prompt will be appear. For quick testing, use the ZC702_sd_card_images provided as a part of design files along with this tech tip.

Output Files


Copy following images in SD-card


ZC706 Default Configuration

The default configuration for the ZC706 board is created using this:

$ cat > configs/zc706_defconfig << EOF
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_EABIHF=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_FPU_VFPV3=y
BR2_KERNEL_HEADERS_4_0=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Xilinx/linux-xlnx"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="xilinx-v2015.3"
BR2_LINUX_KERNEL_DEFCONFIG="xilinx_zynq"
BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x8000"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="zynq-zc706"
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_TARGET_ROOTFS_CPIO_UIMAGE=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="zynq_zc70x"
BR2_TARGET_UBOOT_CUSTOM_GIT=y
BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/Xilinx/u-boot-xlnx"
BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="xilinx-v2015.3"
BR2_TARGET_UBOOT_FORMAT_IMG=y
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="boot.bin"
EOF

When targeting the ZC706, this configuration can be applied, and the rest of the flow is similar.
For creating bootable images for zc706 board, use the ps7_init files path of zc706 board, and build images.

Appendix A - System Requirements

Mandatory Packages


Build tools:

  • DTC
$ git clone https://git.kernel.org/pub/scm/utils/dtc/dtc.git
$ cd dtc/
$ make
$ export PATH=<path-containing-dtc>/dtc:$PATH
  • which
  • sed
  • make (version 3.81 or any later)
  • binutils
  • build-essential (only for Debian based systems)
  • gcc (version 2.95 or any later)
  • g++ (version 2.95 or any later)
  • bash
  • patch
  • gzip
  • bzip2
  • perl (version 5.8.7 or any later)
  • tar
  • cpio
  • python (version 2.6 or 2.7)
  • unzip
  • rsync

Source fetching tools:

  • wget

Optional packages


  • Configuration interface dependencies


For these libraries, you need to install both runtime and development data, which in many distributions are packaged separately. The development packages typically have a -dev or -devel suffix.

  • ncurses5 to use the menuconfig interface

In the official tree, most of the package sources are retrieved using wget from ftp, http or https locations. A few packages are only available through a version control system. Moreover, Buildroot is capable of downloading sources via other tools, like rsync or scp. If you enable packages using any of these methods, you will need to install the corresponding tool on the host system:

  • bazaar
  • cvs
  • git
  • mercurial
  • rsync
  • scp
  • subversion
  • Java-related packages, if the Java Class path needs to be built for the target system:
    • The javac compiler
    • The jar tool
  • Documentation generation tools:
    • asciidoc, version 8.6.3 or higher
    • w3m
    • python with the argparse module (automatically present in 2.7+ and 3.2+)
    • dblatex (required for the pdf manual only)
  • Graph generation tools:
    • graphviz to use graph-depends and <pkg>-graph-depends
    • python-matplotlib to use graph-build

Note: For more information on Buildroot tool visit http://buildroot.uclibc.org/