Obsolete

1. Document History

Date
Version
Author
Description of Revisions
Sept 15 2016
1
Upender Cherukupally
Initial version of step by step guide to build the Ubuntu Desktop for Zynq UltraScale+ MPSoC




2. Summary

Zynq® UltraScale+™ MPSoC delivers unprecedented levels of heterogeneous multi-processing and combines seven user programmable processors including Quad-core ARM® Cortex™-A53 Application Processing Unit (APU), Dual-core 32-bit ARM® Cortex™-R5 Real Time Processing Unit (RPU), and ARM® Mali™-400 MP2 Graphics Processing Unit (GPU). It is Industry’s First All Programmable Multi-Processor SoC delivering 5x system level performance-per-watt and any-to-any connectivity.

This document covers the step by step procedure to configure, build Linux kernel, device tree, using the SDK for creating FSBL, PMU, R5 applications and create SD card bootable image from source

ZUPlusUbuntu1.jpg
Ubuntu Desktop and GPU applications on Zynq UltraScale+ MPSoC

The following Zynq® UltraScale+™ MPSoC PS components are used in this design
  • Quad-core ARM® Cortex™-A53 Application Processing Unit,
  • Graphics Processing Unit
  • DDR controller
  • UART
  • SD/eMMC interface
  • Gigabit Ethernet
  • USB 3.0
  • DisplayPort

Software Stack used for this design
  • SMP Linux on APU subsystem
  • Ubuntu Desktop root file system
  • MALI, OpenGL ES2.0, OSG, FFMPEG Video and audio codecs and Qt libraries

3. Requirements:

  • Xilinx ZCU102 evaluation kit with power supply.
  • Class 10 SD card (16 GB or more).
  • Ethernet Cable, if needed to connect to Internet and install packages using apt-get utility or want to try the Web server demo
  • Micro USB to Standard USB cable
  • 4K Monitor or Full HD Monitor and DisplayPort Cable.
  • USB 3.0 connector or USB 2.0 micro cable to standard USB female adapter, USB Hub to connect USB mouse and USB keyboard or connect USB keyboard with mouse integrated etc.

Files Provided
Ubuntu_Source_Release.zip
Archived file
contain the following files/folders:
  1. All the dependent files for building Ubuntu Desktop
  2. Ubuntu Desktop rootfs in cpio format
ZCU102_Ubuntu_2.zip
Archived file
contain the following files/folders:
  1. Pre-build SD card image for Ubuntu Desktop on ZCU102




4. Procedure to build from sources:


This section covers the following topics
  • Preparing the Linux Kernel using the Petalinux 2016.2
    • BSP Creation
    • Kernel Configuration
    • Device Tree Configuration
    • Building the kernel and device tree blob
  • Preparing the FSBL
  • Preparing the PMU FW
  • Preparing the R5 application
  • Preparing the BOOT.bin file
  • Preparing the SD boot image with the above built components
    • Bootgen
    • Extracting the Ubuntu Desktop Rootfs
  • Preparing the SD card with pre-built Images
  • ZCU102 Board setup
  • Steps to execute the Demo

4.1. Preparing the Linux Kernel using the Petalinux 2016.2

This section describes how to build the Linux images for zcu102 target platform using latest release Petalinux SDK of version 2016.2.

4.1.1. Download the Petalinux petalinux-v2016.2-final-installer.run and ZCU102 BSP from the below path

http://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html
ZUUImage2.jpg
Petalinux SDK Installer and BSP

4.1.1.1.Install the Petalinux by running the above downloaded installer
. / petalinux-v2016.2-final-installer.run
Note: please refer the Petalinux user guide at below link for petalinux installation http://www.xilinx.com/support/documentation/sw_manuals/petalinux2014_4/ug1144-petalinux-tools-reference-guide.pdf

4.1.1.2.After installation is done set the Petalinux environment by running below command in bash shell
source <Petalinux_installation_path>/settings.sh
Note: use source <Petalinux_installation_path>/settings.csh command for c shell.
Cross Check the PETALINUX environment variable is set to the above installation path
echo $PETALINUX

4.1.1.3.Create the Petalinux project with the below command
petalinux-create -t project –s <path to the downloaded zcu102 bsp>/Xilinx-ZCU102-v2016.2-final.bsp
Change the directory to created Petalinux project.

4.1.1.4.Apply the BSP settings as per the hardware definition
Replace the system.hdf located at Xilinx-ZCU102-2016.1/subsystems/linux/hw-description/
with the system.hdf file provided in release files and run the following command:
petalinux-config --oldconfig

4.1.2.Kernel Configuration

Change directory to petalinux project <petalinux install path>/Xilinx-ZCU102-2016.2 and enter the following command to configure the kernel:
petalinux-config –c kernel
Following are the some of the mandatory configurations needed for the successful booting of Ubuntu Desktop.

4.1.2.1.Rootfs path change to SD partition for Ubuntu ramdisk
Disable initramfs in kernel configuration GUI at ‘General setup -> Initial RAM filesystem and RAM disk (initramfs/initrd) support’

4.1.2.2.Following settings are to enable USB mouse, USB keyboard and USB camera
Enable in kernel configuration GUI at

4.1.2.2.1.‘Device Drivers->Input device support->Event Interface’,
4.1.2.2.2.‘Device Drivers->Input device support->Keyboards’ and
4.1.2.2.3.‘Device Drivers->Input device support->mouse’
4.1.2.2.4.‘Device Drivers->multimedia Support->Media USB Adapters->USB Video Class (UVC) and Enable USB Audio Class (UAC)
4.1.2.2.5.‘Device Drivers->multimedia Support->Camera/video grabbers support’
4.1.2.2.6.‘Device Drivers->multimedia Support->V4L platform devices
4.1.2.2.7.‘Device Drivers->USB support and enable all required classes
4.1.2.2.8.‘Device Drivers->HID support->Generic HID driver
4.1.2.2.9.‘Device Drivers->HID support->USB HID support->USB HID transport layer
4.1.2.3.Disabling the PMBUS PMIC so that power demo can use them without any issues
4.1.2.3.1.‘Device Drivers->Hardware Monitoring System->PMBus support->Maxim MAX20751’
4.1.2.4.Enable the PHY settings
4.1.2.4.1.‘Device Drivers->PHY Subsystem’
4.1.2.4.2.‘Device Drivers->PHY Subsystem->Xilinx ZynqMP PHY driver’
4.1.2.5.Disable the PCI settings
4.1.2.5.1.‘Bus Support->PCI support’ This needs to be disabled for this version
4.1.2.6.Enable the sound related settings:
4.1.2.6.1.‘Device Drivers->Sound card support’
4.1.2.6.2.‘Device Drivers->Sound card support->Advanced Linux Sound Architecture’ enabling ALSA support
4.1.2.7.Save and Exit the kernel configuration, there is .config file also provided for reference to cross check the configuration options
4.1.2.8.Use the following command to configure the petalinux package settings
4.1.2.8.1.Type ‘petalinux-config’ at project directory
4.1.2.8.2.Enable the SD card for rootfs: select ‘Image Packaging Configuration->Root filesystem type->SD card’

4.1.3.Device Tree Configuration

The device tree source files are at project location Xilinx-ZCU102-2016.2/subsystems/linux/configs/device-tree

4.1.3.1.Edit system-conf.dtsi and add cma=256M at the end of bootargs line, and make sure root=/dev/mmcblk0p2 is set in boot args to mount the root fs in SD 2nd partition. Save the file system-conf.dtsi

4.1.3.2.Edit pcw.dtsi and add the following lines at the end of the file:
&xilinx_drm {
status = "okay";
xlnx,vid-clk-pl;
};
&xlnx_dp_sub {
status = "okay";
};
And add the following line to &xlnx_dp section:
phy-names = "dp-phy0", "dp-phy1";
phys = <&lan1 5 0 3 27000000>, <&lan0 5 1 3 27000000>;

and after update it will be as follows:
&xlnx_dp {
phy-names = "dp-phy0", "dp-phy1";
phys = <&lan1 5 0 3 27000000>, <&lan0 5 1 3 27000000>;
status ="okay";
}

4.1.3.3.Edit and change the section of zynqmp-clk.dtsi as follows
&xilinx_drm {
clocks = <&drm_clock>;
};
with

&xilinx_drm {
clocks = <&si570_2>;
};

4.1.3.4.Edit zynqmp.dtsi set status=”okay” for xilinx_drm, xlnx_dp, sections with xilinx_dp_snd_ and Xilinx_dpdma

4.1.4.Building the kernel and device tree blob

Run the petalinux-build command at project directory and it will build the ‘Image’ and ‘system.dtb’ at images/linux/ folder. These two files needs to be copied to BOOT partition of SD card.
If you make any changes to kernel and want to rebuild only kernel then use the following:
Petalinux-build –c kernel
If you make any changes to device tree and want to rebuild only kernel then use the following:
Petalinux-build –c device-tree


4.2.Preparing the FSBL


4.2.1.Launch the SDK and open new application project by selecting:

File->New->Application Project

ZUUImage3.jpg
SDK New Application Settings


4.2.2.Select the hardware platform to select the system.hdf provided along with document and also provide the project
Hardware Platform -> New

ZUUImage4.jpg
Selecting New Hardware specification

4.2.3.Enter the project name e.g. fsbl and select next then the template applications are listed as shown in the following figure, in this select ZynqMP FSBL

ZUUImage5.jpg
SDK selections to create FSBL on A53

4.2.4.Select finish to create the FSBL project and it will be built if auto build option is enabled

ZUUImage6.jpg
Selecting FSBL Template project

4.3.Preparing the PMU FW


4.3.1.Launch the SDK and open new application project by selecting:

File->New->Application Project
In the processor select the PMU0 as highlighted in the below diagram and select next
ZUUImage7.jpg
SDK selections for new Application on PMU

4.3.2.In the next window there will be template applications listed and here in this case there is only one template example ZynqMP PMU FW. Select this and select Finish. This will create the PMU FW
ZUUImage8.jpg
Selecting the template project for the PMU FW

4.4.Preparing the R5 application


4.4.1.Launch the SDK and open new application project by selecting:

File->New->Application Project
In the processor select the Psu_Cortexr5_0 as highlighted in the below diagram, provide the name of the project and select next
ZUUImage9.jpg
SDK new Application selections for R5 application

4.3.2.In the next window there will be template applications listed and here in this case there is only one template example ZynqMP PMU FW. Select this and select Finish. This will create the PMU FW

From the template applications select the hello orld application and it will be built automatically.

To route the R5 UART prints on to other terminal please follow the steps as shown in the following figure. R5app_bsp -> Board Support Package settings ->standalone
ZUUImage10.jpg
BSP settings for R5 application

4.5.Preparing the SD boot image with the above built components


4.5.1.Create the SD card partitions
The SD card needs to be formatted and should contain two Partitions

1.A FAT32 partition for Boot Images and
2.An ext3 or ext4 partition for Ubuntu Desktop root file system.

4.5.1.1.Launch the Ease US Partition master tool by clicking on start > All programs > EaseUS Partition Master 9.x.x
4.5.1.2.Select partition Manager Option available on the left side as shown in figure below
ZUUImage11.jpg
SD card Partition Manager

4.5.1.3.Select the partetions as showm below, the boot partition is FAT32 is file system and it can be as less as 1 GB and rootfs partition is etx3 file system which can be rest of the place in 16GB SD card and apply the changes:
ZUUImage12.jpg
SD Card partitions sizes

4.5.2.Using Bootgen
4.5.2.1.Move or replace the FSBL, PMUFW and R5App build using above steps in the directory Boot_bin_creation folder
Launch Xilinx Software Command Line tool and at the prompt change directory to Boot_bin_creation folder and run the following bootgen command:
Bootgen –arch zynqmp –image output.bif –w –o BOOT.bin
4.5.2.2.Copy the BOOT.bin created in the above step at BOOT partition of the prepared SD card

4.5.3.Extracting the Ubuntu Desktop Rootfs
Connect the SD card to a Linux PC and go/cd to the SD card rootfs directory which is mostly mounted on /media/rootfs
And execute the following command to extract the rootfs cpio image provided with this document:
cpio -idmv < path/ ZCU102_Ubuntu_2_rootfs.cpio

4.6.Preparing the SD card with pre-built Images:


Preparing the SD card for SD boot mode:
Extract the ZCU102_Ubuntu_2.zip and it will generate the ZCU102_Ubuntu_2.img. The ZCU102_Ubuntu_2.img file has to be extracted to the SD card. This can be done in windows PC or Linux PC.

1.Install Win32DiskImager.exe Tool
The tool can be downloaded and installed from http://sourceforge.net/projects/win32diskimager/

2.SD card image (ZCU102_Ubuntu_2.img) which can be written to 8 GB card (bigger device if any issues with the size) by following method
Burn this image using the Win32 disk Image writer, as highlighted below first browse the path to Ubuntu_Qt_GPU.img file and in Device (2nd step) select the SD card partition (This has to selected with utmost care as this tool is going to format the selected drive) and as a step 3 select the option to write to SD card selected in Device option.
ZUUImage13.jpg
Disk Image selections for writing img file to SD card

3.This can be done Linux PC using the DD command
dd if=name.img of=/dev/sdb
Where ‘if’ is pointing to name.img file of the Ubuntu Desktop image and ‘of’ points to the SD card to which the image has to be extracted.

5. ZCU102 Board Setup:

1. Connect the Micro USB cable into the ZCU102 Board Micro USB port J83, and the other end into an open USB port on the host PC. This cable will be used for UART over USB communication.

2. Connect one end of Ethernet cable into the ZCU102 connector J73, and other end connect to the Ethernet socket of the host machine.

3. Insert SD card into the SD card slot J100.

4. Set the SW6 switches as shown. This configures the boot settings to boot from SD:
ZUUImage14.jpg
Switch selection for SD boot mode

5. Connect 12V Power to the ZCU102 6-Pin Molex connector.

6. Connect the monitor using DisplayPort cable to U50.

7.The following figure shows the ZCU102 board with connections
ZUUImage15.jpg
ZCU102 Board setup


6. Steps to execute the demo:


1.Switch on the ZCU102 Board at SW1 (red switch).

2.In few seconds the Ubuntu Desktop will boot as shown in the following figure
ZUUImage16.jpg
Ubuntu Desktop Welcome Screen

3.As shown in the following figure there are few icons tailor made like web server, Qt cube demo, Hard glMark2, Soft glMark2 etc. to execute the Zynq UltraScale+ MPSoC specific applications.
ZUUImage17.jpg
Ubuntu Desktop Icons

4.Double click on these icons to launch specific application. Double click/open the Qt-cube application to launch it on Linux and this 3D cube rendering will be done by the GPU as shown in the following figure
ZUUImage18.jpg
Cube rendering by GPU

5.With 2016.2 tool version images eth4 interface is deafult configured for PS GMAC so please use the commnad 'ifup eth4' at the terminal to configure the ethernet interface. Launching the Web server application: Double click on the Web server icon on the desktop and following window will pop up. This window shows the IP address of the ZCU 102 and use this IP address in the web client of you PC/laptop
ZUUImage19.jpg
Web client Launch Info

6.In Host PC or Laptop web browser type the IP address from the above screen as shown in the following figure and Zynq UltraScale+ MPSoC will start serving the web pages. Following image shows the index page of this webserver.
ZUUImage20.jpg
Web server application

7.Launching the OSG car demo, select the icon “OSG Car Model” and open then the desktop will have Car displayed like below:
ZUuImage21.jpg
OSG Application

8.Using mouse hold the car and rotate then the Car will be rotating

9.To minimize this window select the keys: ‘Ctrl+Alt+D’

10.The rootfs also integrated with multimedia demo player to show the Video and Audio codecs in the software by playing the mp4 files

11.Launching the MP4 demo player, select the icon “Soft Video” and open then the desktop will have the MP4 file played as shown below and if the monitor supports audio then it will also be played:

ZUUImage22.jpg
Running MP4 Application

7.What you will observe


1. SMP Linux Boots up with Ubuntu Desktop on APU.

2. OpenGL ES 2.0 based Qt application is launched by Linux on APU and graphics rendering is done by GPU

3. OSG

4. Multimedia

8.Conclusion:


This demonstration show cases the APU capabilities by running the SMP Linux with UI based applications rich Ubuntu Desktop system and OpenGL ES 2.0 API based Qt graphics application rendering by GPU of the Zynq® UltraScale+™ MPSoC.