Howto build Qt 5.2.1 for Xilinx Zynq.

    Update for Qt 5.3.2:

    This is a small how-to build latest Qt 5.2.1 for Zynq and use it with PetaLinux 2013.10 projects. I'm using 64 bit Ubuntu 13.10 as a host, with Xilinx Vivado 2013.4 and ZedBoard
    'Rev. D' as a target. If this howto works for you, especially if you using it on other boards please let me know, so I can push to Qt Zynq support changes.

  1. Download and extract Qt everywhere sources to your home/Download directory:

    tar -zxvf qt-everywhere-opensource-src-5.2.1.tar.gz

  2. Qt5 don't yet support Zynq device, so we need to add it. You can download and extract prepared files(linux-arm-xilinx-zynq-g++.tar.gz) to 'qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/devices/linux-arm-xilinx-zynq-g++' folder. Or you create files yourself:
    • In a 'qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/devices' create new folder named 'linux-arm-xilinx-zynq-g++'.
    • In a 'linux-arm-xilinx-zynq-g++' create 'qmake.conf' file:
    • #
      # qmake configuration for linux-g++ using arm-xilinx-g++ compiler
      CONFIG                 += incremental gdb_dwarf_index
      # modifications to g++.conf
      QMAKE_CC                = $${CROSS_COMPILE}gcc
      QMAKE_CXX               = $${CROSS_COMPILE}g++
      QMAKE_LINK              = $${QMAKE_CXX}
      QMAKE_LINK_SHLIB        = $${QMAKE_CXX}
      # modifications to linux.conf
      QMAKE_AR                = $${CROSS_COMPILE}ar cqs
      QMAKE_OBJCOPY           = $${CROSS_COMPILE}objcopy
      QMAKE_NM                = $${CROSS_COMPILE}nm -P
      QMAKE_STRIP             = $${CROSS_COMPILE}strip
      QMAKE_CFLAGS           += -I$$[QT_SYSROOT]/include -DZYNQ
      QMAKE_CXXFLAGS         += -Wno-psabi -I$$[QT_SYSROOT]/include -DZYNQ
      QMAKE_LFLAGS           += -L$$[QT_SYSROOT]/lib
      QMAKE_CFLAGS           += -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -pipe -fomit-frame-pointer
    • And also 'qplatformdefs.h' file:
    • /****************************************************************************
      ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
      ** Contact:
      ** This file is part of the qmake spec of the Qt Toolkit.
      ** Commercial License Usage
      ** Licensees holding valid commercial Qt licenses may use this file in
      ** accordance with the commercial license agreement provided with the
      ** Software or, alternatively, in accordance with the terms contained in
      ** a written agreement between you and Digia.  For licensing terms and
      ** conditions see  For further information
      ** use the contact form at
      ** GNU Lesser General Public License Usage
      ** Alternatively, this file may be used under the terms of the GNU Lesser
      ** General Public License version 2.1 as published by the Free Software
      ** Foundation and appearing in the file LICENSE.LGPL included in the
      ** packaging of this file.  Please review the following information to
      ** ensure the GNU Lesser General Public License version 2.1 requirements
      ** will be met:
      ** In addition, as a special exception, Digia gives you certain additional
      ** rights.  These rights are described in the Digia Qt LGPL Exception
      ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
      ** GNU General Public License Usage
      ** Alternatively, this file may be used under the terms of the GNU
      ** General Public License version 3.0 as published by the Free Software
      ** Foundation and appearing in the file LICENSE.GPL included in the
      ** packaging of this file.  Please review the following information to
      ** ensure the GNU General Public License version 3.0 requirements will be
      ** met:
      ** $QT_END_LICENSE$
      #include "../../linux-g++/qplatformdefs.h"
  3. QT_QPA_DEFAULT_PLATFORM variable set to Linux Framebuffer and if your hardware design supports something else you may want to change it. Or you can always control it thru QT_QPA_PLATFORM env. variable and leave default to simplest 'linuxfb'. You may also want to modify CFLAGS and CXXFLAGS here.
  4. Set CROSS_COMPILE variable and source Xilinx tools settings:

    export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
    source /opt/Xilinx/Vivado/2013.4/

  5. Now we can run Qt 'configure' utility, Below, configuration from my building script. Notice I disabled OpenGL ES support since my hardware don't have it yet, but your might, so you may want to include egl support.
  6. ./configure -prefix /opt/Qt/5.2.1 \
    	-device linux-arm-xilinx-zynq-g++ \
    	-device-option CROSS_COMPILE=arm-xilinx-linux-gnueabi- \
    	-release \
    	-no-qml-debug \
    	-reduce-relocations \
    	-qt-zlib \
    	-qt-libpng \
    	-qt-libjpeg \
    	-qt-freetype \
    	-qt-harfbuzz \
    	-qt-pcre \
    	-no-xcb \
    	-qt-xkbcommon \
    	-no-opengl \
    	-no-eglfs \
    	-no-kms \
    	-confirm-license \
    	-opensource \
    	-no-icu \
    	-no-pch \
  7. Configure will build 'qmake' first and generate 'Makefiles' for all the components. Check your output in details and verify it match your configuration. Below output in my case:
  8. Configure summary
    Building on:   linux-g++ (x86_64, CPU features: mmx sse sse2)
    Building for:  devices/linux-arm-xilinx-zynq-g++ (arm, CPU features: neon)
    Platform notes:
                - Also available for Linux: linux-kcc linux-icc linux-cxx
    qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV 
    DEFINES += QT_NO_LIBUDEV DEFINES += QT_NO_XCB sql-drivers =  sql-plugins =  sqlite qmake switches ......... 
    Build options:
      Configuration .......... accessibility audio-backend c++11 clock-gettime clock-monotonic compile_examples 
     concurrent cross_compile evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv inotify
     ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap neon nis no-pkg-config pcre 
     png posix_fallocate qpa qpa reduce_exports reduce_relocations release rpath shared small-config xkbcommon-qt zlib 
      Build parts ............ libs examples
      Mode ................... release
      Using C++11 ............ yes
      Using PCH .............. no
      Target compiler supports:
        iWMMXt/Neon .......... no/yes
    Qt modules and options:
      Qt D-Bus ............... no
      Qt Concurrent .......... yes
      Qt GUI ................. yes
      Qt Widgets ............. yes
      JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
      QML debugging .......... no
      Use system proxies ..... no
    Support enabled for:
      Accessibility .......... yes
      ALSA ................... no
      CUPS ................... no
      FontConfig ............. no
      FreeType ............... qt
      HarfBuzz ............... qt
      Iconv .................. yes
      ICU .................... no
      Image formats: 
        GIF .................. yes (plugin, using bundled copy)
        JPEG ................. yes (plugin, using bundled copy)
        PNG .................. yes (in QtGui, using bundled copy)
      Glib ................... no
      GTK theme .............. no
      Large File ............. yes
      mtdev .................. no
        getaddrinfo .......... yes
        getifaddrs ........... yes
        IPv6 ifname .......... yes
        OpenSSL .............. no
      NIS .................... yes
      OpenGL ................. no
      OpenVG ................. no
      PCRE ................... yes (bundled copy)
      pkg-config ............. no 
      PulseAudio ............. no
      QPA backends: 
        DirectFB ............. no
        EGLFS ................ no
        KMS .................. no
        LinuxFB .............. yes
        XCB .................. no
      Session management ..... yes
      SQL drivers: 
        DB2 .................. no
        InterBase ............ no
        MySQL ................ no
        OCI .................. no
        ODBC ................. no
        PostgreSQL ........... no
        SQLite 2 ............. no
        SQLite ............... yes (plugin, using bundled copy)
        TDS .................. no
      udev ................... no
      xkbcommon .............. yes (bundled copy)
      zlib ................... yes (bundled copy)
    NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
    Configure with '-qreal float' to create a build that is binary compatible with 5.1.
    Info: creating cache file /home/d9/Projects/qt5_build_test/qt-everywhere-opensource-src-5.2.1/qtbase/.qmake.cache
    Qt is now configured for building. Just run 'gmake'.
    Once everything is built, you must run 'gmake install'.
    Qt will be installed into /opt/Qt/5.2.1
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
  9. Build and install Qt. It will be installed in a directory you set as a prefix during configuration.

    cd qt-everywhere-opensource-src-5.2.1/qtbase/
    gmake & gmake install

  10. Now, lets add Qt libraries and couple of Qt example binaries to PetaLinux project. Go to your PetaLinux project directory and create Qt component using 'libs' template.

    petalinux-create -t libs -n qt-5.2.1 --enable

  11. We don't need template created files, so delete them.

    cd components/libs/qt-5.2.1/
    rm libqt*

  12. Copy prebuilt Qt library files to 'lib' subdirectory, qt fonts and plugin directories also to 'lib' and a couple of Qt examples to 'bin' subdirectory:

    cp -Pr /opt/Qt/5.2.1/lib .
    cp -Pr /opt/Qt/5.2.1/plugins/ ./lib/
    mkdir bin
    cp /opt/Qt/5.2.1/examples/widgets/painting/pathstroke/pathstroke bin/pathstroke
    cp /opt/Qt/5.2.1/examples/widgets/mainwindows/mainwindow/mainwindow bin/mainwindow

  13. We also have to set a few enviromental variables on a target rootfs, so lets create 'profile.qt-5.2.1' file. Last one is for 'tslib', so if you don't use it you may delete it. Also, depending on your setup - you may need to change this or add other variables here.
  14. export QT_PLUGIN_PATH=/usr/lib/plugins
    export QT_QPA_FONTDIR=/usr/lib/fonts
    export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/plugins/platforms
    export QT_QPA_PLATFORM=linuxfb
    export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
  15. Now we have to modify our PetaLinux component Makefile. We got nothing to build, but need to install our Qt5 library files to target rootfs.
  16. ifndef PETALINUX
    $(error "Error: PETALINUX environment variable not set. Try to source the file")
    all: build install
    .PHONY: build
    	#Install libraries and fonts to the rootfs.
    	mkdir -p $(TARGETDIR)/usr/lib
    	rsync -rav ./bin/* $(TARGETDIR)/usr/bin/
    	rsync -rav ./lib/* $(TARGETDIR)/usr/lib/
    	#Install the script to ensure the font directory is properly specified.
    	mkdir -p $(TARGETDIR)/etc/profile.d
    	cp profile.qt-5.2.1 $(TARGETDIR)/etc/profile.d/profile.qt-5.2.1
  17. Last configuration step is to include 'libstdc++6' to target rootfs, since Qt is a C++ library and depends on it.

    petalinux-config -c rootfs

    Then go to 'Filesystem Packages' -> 'Base' -> 'External-xilinx-toolchain' -> Enable 'libstdc++6'.

  18. Thats it. Rebuild PetaLinux project, transfer image.ub file to SD card. Qt5 library will add about 20M to image size, so it may not fit into reserved space and you may need to adjust appropriate u-boot variable (loadaddr, netstart...). After boot you we can run 'pathstroke' and 'mainwindow' Qt example apps.
  19. zynq9_001

Use SDCard to boot ZedBoard using PetaLinux 13.10

Up until now, I was using JTAG to boot my ZedBoard using PetaLinux builds. But at some point we will neet to switch to QSPI or SDCard. This post will be about using SD Card. And PetaLinux 13.10 made this process very easy. For default U-boot 2013.07 all we need to do is to change boot device in PetaLinux configurations.

I will use Avnet-Digilent-ZedBoard-2013.3 project I used before. See here for more details about how to install it:

  1. First, go to your project directory and run petalinux-config tool
  2. d9@ubuntu:~$ cd Projects/Avnet-Digilent-ZedBoard-2013.3/
    d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ petalinux-config

  3. In a main manu select 'System boot device' submenu.
  4. zynq4_001

  5. Inside 'System boot device' menu switch to 'SD card' option.
  6. zynq4_002

  7. Save configuration and exit.
  8. Now, lets clean and rebuild images - in our project directory:
  9. petalinux-build -x mrproper

  10. To Re-generate BOOT.BIN in our project directory run:
  11. petalinux-package --boot --fsbl pre-built/linux/images/zynq_fsbl.elf --fpga pre-built/linux/implementation/download.bit --uboot --force -o images/linux/BOOT.BIN

    INFO: Generating zynq binary package BOOT.BIN...
    INFO: Binary is ready.

  12. Copy BOOT.BIN and image.ub from our project Avnet-Digilent-ZedBoard-2013.3/images/linux directory to SD card. And we done. Umount SD card, install it into ZedBoard, set jumpers to SDCard boot mode (MIO3 to ground position, MIO4 and MIO5 to high) and power board.
  13. Run gtkterm to monitor the process.
    Btw, if you expireince 20-40 seconds delay before you can access port with error "cannot open /dev/ttyACM0: Device or resource busy" and/or sometimes U-boot process stopped without any error and will continue to boot when you type 'boot' command - you may want to uninstall Ubuntu's ModemManager which cause all this things by trying to access/control our port once it powered.
  14. sudo apt-get purge modemmanager

Installing Vivado 13.4 and PetaLinux SDK on Ubuntu 13.10 amd64(64 bit) for ZedBoard.

I will follow Xilinx UG976, UG977 and UG978 user guides v2013.10 revision.

1. Install fresh Ubuntu 13.10 (64 bit edition) in VMWare Workstation10 virtual machine with atleast 80G disk space and 4G of RAM.

2. Go to and and download next files to your 'home/Downloads' directory:

    - Vivado 13.4  All OS'es SDK Full installer.
    - PetaLinux 2013.10 Installation archive for Zynq.
    - PetaLinux 2013.10 BSP for Avnet/Digilent ZedBoard.
    - Digilent Adept 2.15.3 Runtime, X64 Linux
    - Digilent Adept 2.1.1 Utilities, X64 Linux
    - Digilent Plug-in, 64-bit Linux

3. At Xilinx tools license site: , create a new license file and include both 'PetaLinux Tool Licence' and 'Vivado WebPack License'. Xilinx will email a Xilinx.lic file to you - put it in your home/downloads directory for now.

This is what I got in my home ~/Download directory

d9@ubuntu:~/Downloads$ ls -l
total 7990712
-rw-r--r-- 1 d9 d9 63148594 Feb 4 21:03 Avnet-Digilent-ZedBoard-v2013.10-final.bsp
-rw------- 1 d9 d9 5112946 Feb 8 14:24 digilent.adept.runtime_2.15.3-x86_64.tar.gz
-rw------- 1 d9 d9 33690 Feb 8 14:24 digilent.adept.utilities_2.1.1-x86_64.tar.gz
-rw------- 1 d9 d9 10809690 Feb 8 14:25 libCseDigilent_2.5.2-x86_64.tar.gz
-rwxr-xr-x 1 d9 d9 791339806 Feb 4 21:10
-rw-r--r-- 1 d9 d9 1773 Feb 4 18:25 Xilinx.lic
-rw-r--r-- 1 d9 d9 7312015360 Jan 17 18:46 Xilinx_Vivado_SDK_2013.4_1210_1.tar

4. We will need a serial communication program - I prefer gtkterm. So, lets install and try to communicate with ZedBoard. Open console (search for 'term'), in a console:

d9@ubuntu:~$ sudo apt-get install gtkterm
d9@ubuntu:~$ gtkterm

And we got first error message: Cannot open /dev/ttyS0: Permission denied. Lets figure out why:

d9@ubuntu:~$ ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 Feb 4 19:12 /dev/ttyS0
d9@ubuntu:~$ groups
d9 adm cdrom sudo dip plugdev lpadmin sambashare

So, /dev/ttyS0 as well as all other serial port devices (including /dev/ttyACM0 which is ZedBoard USB-to-Serial port) belongs to 'root' and 'dialout' groups and our user are not in any of them. So, lets add us into dialout, apply changes, check and run gtkterm. Note: you may reboot to apply changes permanently.

d9@ubuntu:~$ sudo addgroup d9 dialout
sudo password for d9:
Adding user `d9' to group `dialout' ...
Adding user d9 to group dialout
d9@ubuntu:~$ su d9
d9@ubuntu:~$ groups
d9 adm dialout cdrom sudo dip plugdev lpadmin sambashare
d9@ubuntu:~$ gtkterm

Now, go to 'Configuration/Port', select ZedBoard serial port '/dev/ttyACM0', set'Baud Rate' to 115200 and save configuration for later use.
Lets reset ZedBoard and verify we can see its output. In my case ZedBoard booted from microSD card with examples from 'ZedBoard CTT' tutorial.

5. Now, lets install Xilinx Vivado 14.3. For Petalinix 13.10 I will use SystemEdition + SDK. Because of the silent error during Vivado installation it must be istalled after we switch Ubuntu's default shell(Dash) to Bash.

So, to switch shell run:

d9@ubuntu:~$ sudo dpkg-reconfigure dash

Select 'No' to use 'dash' as default system shell.


And verify we are using 'bash' now:

d9@ubuntu:~/Downloads$ ls -al /bin/sh
lrwxrwxrwx 1 root root 4 Feb 8 17:35 /bin/sh -> bash

Now, install Vivado into default directory 'opt/Xilinx':

d9@ubuntu:~$ cd Downloads/
d9@ubuntu:~/Downloads$ tar -xvf Xilinx_Vivado_SDK_2013.4_1210_1.tar
d9@ubuntu:~/Downloads$ sudo ./Xilinx_Vivado_SDK_2013.4_1210_1/xsetup

Install Vivado 13.4 in default folder '/opt/Xilinx', but don't forget to opt to 'Install Cable Drivers'. Everything went smoothly, except our JTAG driver.


Where is no options to select, so click Ok and we will deal with it later.
Next, installer will launch 'License managing tool' and all we need to do is to go to 'Locate Existing Licenses' and point to license file we got from Xilinx. Make sure Petalinux_NoSuport_Eval and Vivado_WebPack in a list and 'green'. Close the License Managment tool - Vivado now installed.

So, lets figure out what is going on with our JTAG. I will try to install Digilent JTAG drivers manually. First, install Adept Runtime and Adept utilities from package directories and use default/proposed locations:

d9@ubuntu:~/Downloads$ tar -xvf digilent.adept.runtime_2.15.3-x86_64.tar.gz
d9@ubuntu:~/Downloads$ cd digilent.adept.runtime_2.15.3-x86_64/
d9@ubuntu:~/Downloads/digilent.adept.runtime_2.15.3-x86_64$ sudo ./
d9@ubuntu:~/Downloads/digilent.adept.runtime_2.15.3-x86_64$ cd ..
d9@ubuntu:~/Downloads$ tar -xvf digilent.adept.utilities_2.1.1-x86_64.tar.gz
d9@ubuntu:~/Downloads$ cd digilent.adept.utilities_2.1.1-x86_64/
d9@ubuntu:~/Downloads/digilent.adept.utilities_2.1.1-x86_64$ sudo ./

Second, install 'libftdi2'. Also agree with default/proposed locations:

d9@ubuntu:~/Downloads$ cd ~/Downloads/digilent.adept.runtime_2.15.3-x86_64/ftdi.drivers_1.0.4-x86_64/
d9@ubuntu:~/Downloads/digilent.adept.runtime_2.15.3-x86_64/ftdi.drivers_1.0.4-x86_64$ sudo ./
FTDI Driver Installer
64-bit operating system detected
In which directory should libraries be installed? [/usr/local/lib64]
Checking to see if is already installed....
Existing installation of found. Checking to see if this version should be installed.
Version 1.0.4 is currently installed. Version will not be installed.
Successfully updated dynamic loader cache
Successfully installed FTDI Driver

Next install Digilent plugin for Xilinx tools. Unpack plugin archive, create 'Digilent/libCseDigilent' directory in Xilinx SDK plugin folder and copy plugin files in it:

d9@ubuntu:~/Downloads/digilent.adept.utilities_2.1.1-x86_64$ cd ~/Downloads
d9@ubuntu:~/Downloads$ tar -xvf libCseDigilent_2.5.2-x86_64.tar.gz
d9@ubuntu:~/Downloads$ sudo mkdir /opt/Xilinx/SDK/2013.4/lib/lin64/plugins/Digilent
d9@ubuntu:~/Downloads$ sudo mkdir /opt/Xilinx/SDK/2013.4/lib/lin64/plugins/Digilent/libCseDigilent
d9@ubuntu:~/Downloads$ sudo cp libCseDigilent_2.5.2-x86_64/ISE14x/plugin/* /opt/Xilinx/SDK/2013.4/lib/lin64/plugins/Digilent/libCseDigilent/

Lets check JTAG with Digilent 'djtgcfg' util. To do so, connect JTAG-USB if it not connected yet and turn 'on' ZedBoard then type 'djtfcfg enum' if you see Zed device found along with it serial number - we are in good shape:

d9@ubuntu:~$ djtgcfg enum

Found 1 device(s)

Device: Zed
Product Name:   Digilent Zed
User Name:      Zed

6. Petalinux. Before we will start the installer we need to install missing libraries. Good thing is PetaLinux installer checks and inform us about missing staff. In case of 32bit Ubuntu 2013.10 we are missing only 'gawk'. But, for 64bit we need some 64 and some 32bit packages and libraries since PetaLinux and its installer depend on them. So, lets install them in this order:

d9@ubuntu:~$ sudo apt-get install gawk
d9@ubuntu:~$ sudo apt-get install ncurses-dev:i386
d9@ubuntu:~$ sudo apt-get install libstdc++6:i386
d9@ubuntu:~$ sudo apt-get install libselinux1:i386
d9@ubuntu:~$ sudo apt-get install lib32ncurses5-dev
d9@ubuntu:~$ sudo apt-get install gcc

Change permissions for PetaLinux installer and run it:

d9@ubuntu:~/Downloads$ sudo chmod 755
d9@ubuntu:~/Downloads$ sudo ./ --log petalinux_inst.log /opt

With our license already installed (with Vivado) we can setup and check PetaLinux enviroment settings:

d9@ubuntu:~/Downloads$ source /opt/petalinux-v2013.10-final/
PetaLinux environment set to '/opt/petalinux-v2013.10-final'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide" for its impact and solution
d9@ubuntu:~/Downloads$ echo $PETALINUX

7. So, let's fix 'tftp' problem. First, check what packages we are missing and install them:

d9@ubuntu:~/Downloads$ dpkg -l xinetd tftp tftpd
dpkg-query: no packages found matching xinetd
dpkg-query: no packages found matching tftp
dpkg-query: no packages found matching tftpd
d9@ubuntu:~/Downloads$ sudo apt-get install xinetd tftpd tftp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
tftp tftpd xinetd
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded

Second, create file called 'tftp' in '/etc/xinetd.d/' and fill it with:

service tftp
        protocol = udp
        port = 69
        socket_type = dgram
        wait = yes
        user = nobody
        server = /usr/sbin/in.tftpd
        server_args = /tftpboot
        disable = no

Thirtd, create directory for tftp files '/tftpboot', change permissions and restart services:

d9@ubuntu:~/Downloads$ sudo mkdir /tftpboot
d9@ubuntu:~/Downloads$ sudo chown d9:d9 /tftpboot
d9@ubuntu:~/Downloads$ sudo /etc/init.d/xinetd restart
* Stopping internet superserver xinetd [ OK ]
* Starting internet superserver xinetd [ OK ]

While in a home/download directory create some file for testing, connect locally to tftp and 'get' the file.

d9@ubuntu:~/Downloads$ echo "test1" > /tftpboot/testfile
d9@ubuntu:~/Downloads$ more /tftpboot/testfile
d9@ubuntu:~/Downloads$ tftp
tftp> get testfile
Received 7 bytes in 0.0 seconds
tftp> quit
d9@ubuntu:~/Downloads$ more testfile
d9@ubuntu:~/Downloads$ rm testfile

tftp seems to work now.

9. Next, let's install PetaLinux ZedBoard board support package(BSP):

d9@ubuntu:~$ cd ~
d9@ubuntu:~$ mkdir Projects
d9@ubuntu:~$ cd Projects/
d9@ubuntu:~/Projects$ source /opt/petalinux-v2013.10-final/
d9@ubuntu:~/Projects$ echo $PETALINUX
d9@ubuntu:~/Projects$ petalinux-create -t project -s ../Downloads/Avnet-Digilent-ZedBoard-v2013.10-final.bsp
INFO: Create project:
INFO: Projects:
INFO: * Avnet-Digilent-ZedBoard-14.7
INFO: * Avnet-Digilent-ZedBoard-2013.3
INFO: has been successfully installed to /home/d9/Projects/
INFO: New project successfully created in /home/d9/Projects/

10. Looks like we are successfully installed BSP. Now lets test prebuilt Petalinux v2013.10 image using QEMU:

d9@ubuntu:~/Projects$ cd Avnet-Digilent-ZedBoard-2013.3/
d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ petalinux-boot --qemu --prebuilt 3


Use 'root'/'root' for username and password and then 'uname -a' to see what we got. To quit from QEMU monitor hit 'Ctlrl + A', then X.

Avnet-Digilent-ZedBoard-2013_3 login: root
login[780]: root login on `ttyPS0'

root@Avnet-Digilent-ZedBoard-2013_3:~# uname -a
Linux Avnet-Digilent-ZedBoard-2013_3 3.8.11 #2 SMP PREEMPT Thu Nov 21 18:30:11 EST 2013 armv7l GNU/Linux
root@Avnet-Digilent-ZedBoard-2013_3:~# QEMU: Terminated

11. Now lets test prebuilt image on ZedBoard using JTAG. Source Vivado SDK settings.

d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ source /opt/Xilinx/Vivado/2013.4/

Also, set MIO3, MIO4 and MIO5 jumpers on ZedBoard to 'ground position for JTAG boot. Then power ZedBoard on, run 'gtkterm' program and then:

d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ petalinux-boot --jtag --prebuilt 3
INFO: The image provided is a zImage and no addition options were provided
INFO: Append dtb - /home/d9/Projects/Avnet-Digilent-ZedBoard-2013.3/pre-built/linux/images/system.dtb and other options to boot zImage
INFO: Configuring the FPGA...
INFO: FPGA configuration completed.
INFO: Downloading FSBL
INFO: FSBL download completed.
INFO: Launching XMD for file download and boot.
INFO: This may take a few minutes, depending on the size of your image.

I found that JTAG boot works on just powered board and failed to download FSBL if I just reset the board. In order to reset PS and PL all together you have to short JP13 on ZedBoard (Short connects JTAG PROG-RST to PS Reset).


12. Now, lets rebuilt PetaLinux kernel and boot updated kernel on ZedBoard using JTAG. So, while in a ZedBoard project directory:

d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ petalinux-build
INFO: Checking component...
INFO: Generating make files and build linux
INFO: Generating make files for the subcomponents of linux
INFO: Building linux
[INFO ] pre-build linux/rootfs/fwupgrade
[INFO ] pre-build linux/rootfs/peekpoke
[INFO ] pre-build linux/rootfs/uWeb
[INFO ] build linux/kernel
[INFO ] update linux/u-boot source
[INFO ] generate linux/u-boot configuration files
[INFO ] build linux/u-boot
[INFO ] Setting up stage config
[INFO ] Setting up rootfs config
[INFO ] Updating for armv7a-vfp-neon
[INFO ] Updating package manager
[INFO ] Expanding stagefs
[INFO ] build linux/rootfs/fwupgrade
[INFO ] build linux/rootfs/peekpoke
[INFO ] build linux/rootfs/uWeb
[INFO ] build kernel in-tree modules
[INFO ] modules linux/kernel
[INFO ] post-build linux/rootfs/fwupgrade
[INFO ] post-build linux/rootfs/peekpoke
[INFO ] post-build linux/rootfs/uWeb
[INFO ] pre-install linux/rootfs/fwupgrade
[INFO ] pre-install linux/rootfs/peekpoke
[INFO ] pre-install linux/rootfs/uWeb
[INFO ] install linux/kernel
[INFO ] install linux/u-boot
[INFO ] Setting up rootfs config
[INFO ] Setting up stage config
[INFO ] Updating for armv7a-vfp-neon
[INFO ] Updating package manager
[INFO ] Expanding rootfs
[INFO ] install sys_init
[INFO ] install linux/rootfs/fwupgrade
[INFO ] install linux/rootfs/peekpoke
[INFO ] install linux/rootfs/uWeb
[INFO ] install kernel in-tree modules
[INFO ] modules_install linux/kernel
[INFO ] post-install linux/rootfs/fwupgrade
[INFO ] post-install linux/rootfs/peekpoke
[INFO ] post-install linux/rootfs/uWeb
[INFO ] package rootfs.cpio to /home/d9/Projects/Avnet-Digilent-ZedBoard-2013.3/images/linux
[INFO ] Update and install vmlinux image
[INFO ] vmlinux linux/kernel
[INFO ] install linux/kernel
[INFO ] package zImage
[INFO ] zImage linux/kernel
[INFO ] install linux/kernel
[INFO ] package FIT image

Reset(with JP13 shorted) or 'power on' ZedBoard and then:

d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ petalinux-boot --jtag --prebuilt 2
INFO: Configuring the FPGA...
INFO: FPGA configuration completed.
INFO: Downloading FSBL
INFO: FSBL download completed.
INFO: Launching XMD for file download and boot.
INFO: This may take a few minutes, depending on the size of your image.

d9@ubuntu:~/Projects/Avnet-Digilent-ZedBoard-2013.3$ petalinux-boot --jtag --kernel
INFO: The image provided is a zImage and no addition options were provided
INFO: Append dtb - /home/d9/Projects/Avnet-Digilent-ZedBoard-2013.3/images/linux/system.dtb and other options to boot zImage
INFO: Cannot detect the ARCH from the image.
INFO: We will get the ARCH from the system config.
INFO: Launching XMD for file download and boot.
INFO: This may take a few minutes, depending on the size of your image.

Login as 'root'/'root' again and check build date - it should be current. Congratulations! Now we got working PetaLinux SDK on latest Ubuntu 13.10.