Zynq UltraScale + MPSoC Ubuntu part 2 - Building and Running "Ubuntu Desktop" from Sources

Document History

Date
Version
Author
Description of Revisions
Sept 15 2016
1.0
Upender Cherukupally
Initial version of step by step guide to build the Ubuntu Desktop for Zynq UltraScale+ MPSoC
Jan 2 2016
2.0
Rajesh Gugulothu
Updated for 2016.3 tool version
Feb 24 2017
3.0
Rajesh Gugulothu
Updated with 2016.4 tools Release and Added design
files to support zcu102 Rev-B/Rev-D ,Rev-1.0 boards
Aug 4 2017
4.0
Janardhan G & Rajesh Gugulothu
  • Updated with 2017.1 tools release and Added design files to support zcu102 Rev-1.0 and Rev1.0, Rev-D with Production silicon boards.
Feb 8 2018
5.0
Aniket K
  • Updated with 2017.4 tools release and Added design files to support zcu102 Rev-1.0 and Rev-D with Production silicon boards.

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 Tech-Tip covers step by step instructions to build and boot Ubuntu Desktop on the Zynq® UltraScale+™ MPSoC targeting the ZCU102 board.

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
  • ARM-Mali, OpenGL ES2.0, OSG

Requirements


  • Xilinx ZCU102 evaluation kit with power supply
  • Class 10 SD card (8 GB)
  • Ethernet Cable ( for Internet connectivity, installing packages using apt-get utility, and for user to try Webserver 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/USB keyboard /USB keyboard with mouse integrated, etc.

Files Provided
Ubuntu_Desktop_Release_2017_4.zip
Archived file
contains the following files/folders:
  1. Hardware description file
  2. Vivado project tcl file
  3. Prebuilt image

Procedure to build from sources


This section covers the following topics
  • Creating the Hardware design using Vivado.
  • Exporting the hardware design to Petalinux
    • Configuring the hardware
    • Creating petalinux project
    • Configuring the kernel
    • Creating the bootable Linux images
  • Preparing the SD card with the built Images or ready to test images
  • ZCU102 Board setup
  • Steps to execute the Demo

Creating hardware design using Vivado


This section explains the procedure to create the hardware design using 2017.4 Vivado Design suite.
  • Open the Vivado Design Suite and run the project.tcl file which will generate the block design which uses Zynq UltraScale+ MPSoC IP.
  • Download and Extract the Ubuntu_Desktop_Release_2017_4.zip file to on to your Linux directory
    $ unzip Ubuntu_Desktop_Release_2017_4.zip
    Note: For user convenience prebuilt hardware description file is provided along with the design files.User can use the design_1_wrapper.hdf file found under the /Ubuntu_Desktop_Release_2017_4/ HDF_file directory and skip to the section"Preparing Linux images using Petalinux 2017.4".
  • Launch the Vivado Design Suite 2017.4 (On Linux)
  • The Vivado Design Suite opens to the Welcome window. From the Welcome window you can create a new project, open an existing project, or enter Tcl commands directly into the Vivado Design Suite as well as access documentation and examples
Vivado_welcome.PNG
Vivado welcome screen


  • In the TCL console of the Vivado Welcome screen, change the directory to /Ubuntu_Desktop_Release_2017_4/Hardware where the project.tcl file is present.
    $ cd /Ubuntu_Desktop_Release_2017_4/Hardware
  • Source the project.tcl file in the Vivado GUI TCL console by following the below command .
    source project.tcl


  • tcl_console.JPG
    Fig: source the project.tcl file


This TCL script will do the following
  • Automatically create a Vivado project
  • Creates a new block design and automatically populates the Zynq UltraScale+ MPSoC PS System,required components and connections.
  • Configures the Zynq UltraScale+ MPSoC PS System for the ZCU102 board
  • Generates the hardware description file in the current directory .
  • After the process is completed the, design_1_wrapper.hdf will be generated under the /Ubuntu_Desktop_Release_2017_4/Hardware directory.

Preparing Linux Images using Petalinux 2017.4

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

Creating the petalinux project

  • Create the petalinux project using the respective bsp which can be downloaded from the below path
  • Download the Petalinux petalinux-v2017.4-installer.run and ZCU102 BSP for corresponding board.

petalinux-installer.PNG
Petalinux-installer
Zcu102_bsp.PNG
zcu102 petalinux bsps


  • Install the Petalinux by running the above downloaded installer
    $ ./petalinux-v2017.4-installer.run
    Note: please refer the Petalinux user guide.
  • 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 if PETALINUX environment variable is set to the above installation path by using below command
    $ echo $PETALINUX
  • Create the Petalinux project with the below command
    $ petalinux-create -t project –s <path to the downloaded zcu102 bsp>/xilinx-zcu102-v2017.4-final.bsp
    Note: In the above command, give the BSP path & file according to the board revision.
  • Change the directory to created Petalinux project.
$ cd <petalinux-project>
  • Configure the Petalinux project with the hardware description file .User can use the prebuilt design_1_wrapper.hdf file can be found under the directory /Ubuntu_Desktop_Release_2017_4/Hdf_file or can use the design_1_wrapper.hdf file built in the above section.
    $ petalinux-config --get-hw-description=<path to hdf file directory>
    The PetaLinux configuration wizard opens.
  • Enable the SD card for rootfs: select ‘Image Packaging Configuration->Root file system type->SD card’
  • modify the bootargs as below.
    • petalinux-config
      • DTG Settings > Kernel Bootargs > [ ] generate boot args automatically
      • Set following kernel bootargs
      • earlycon clk_ignore_unused earlyprintk root=/dev/mmcblk0p2 rw rootwait cma=1024M
  • Save and Exit the wizard.
  • Wait until PetaLinux reconfigures the project
  • Clean the existing Bootloader image. This is to ensure that the bootloader is recreated in sync with new hardware design.
    $ petalinux-build -c bootloader -x distclean
  • Modify Device-tree for Dual Lane display port configuration by following the instructions in Xilinx Answer 69248 in the system-user.dtsi

Configuring the kernel
  • Change directory to <petalinux-project> and enter the following command to configure the kernel:
$ petalinux-config -c kernel
  • Following are some of the mandatory configurations needed for successful booting of Ubuntu Desktop.
    • Disable initramfs in kernel configuration GUI at ‘General setup -> Initial RAM file system and RAM disk (initramfs/initrd) support’
  • Following settings are required to enable Input device, multimedia and USB related settings
    • Device Drivers->Input device support->Event interface’
    • Device Drivers->Input device support->Keyboards’
    • Device Drivers->Input device support->Mouse interface’
    • Device Drivers->Multimedia support->Media USB Adapters->USB Video Class (UVC)
    • Device Drivers->Multimedia support->Cameras/video grabbers support’
    • Device Drivers->Multimedia support->V4L platform devices
    • Device Drivers->USB support and enable all required classes
    • Device Drivers->HID support->Generic HID driver
    • Device Drivers->HID support->USB HID support->USB HID transport layer
    • Disabling the PMBUS PMIC so that power demo can use them without any issues
    • Device Drivers->Hardware Monitoring support->PMBus support->Maxim MAX20751’
    • Enable the PHY settings
    • Device Drivers->PHY Subsystem’
    • Device Drivers->PHY Subsystem->Xilinx ZynqMP PHY driver’
    • Disable the PCI settings
    • Bus Support->PCI support’ This needs to be disabled for this version
    • Enable the sound related settings:
    • Device Drivers->Sound card support’
    • Device Drivers->Sound card support->Advanced Linux Sound Architecture’ enabling ALSA support
    • Kernel hacking > Tracers > Kernel Function Tracer
    • Save and Exit the kernel configuration.

Creating bootable linux images
  • Change directory to <petalinux-project> and enter the following command to build Linux Images. Output binaries can be found in <petalinux-project>/images/linux directory.
$ petalinux-build
  • Wait until the project builds.
  • Create BOOT.bin (with above created binaries) using below command
    $ petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --u-boot images/linux/u-boot.elf
  • Move to folder images/linux/ and copy BOOT.BIN and image.ub files to boot partition of SD card.
    Note: If changes happen to be ONLY in kernel, then use below command to rebuild ONLY kernel
    petalinux-build -c kernel
Preparing the SD card with bootable Images:
  • This section provides the steps to prepare the SD with the above built images and Ubuntu file system.
  • Follow the section "Preparing the SD card with prebuilt images" .
  • Replace the BOOT.bin and image.ub from images/linux which are created in above steps to BOOT partition of the SD card and skip to "ZCU102 Board Setup".

Preparing the SD card with pre-built Images:
  • Preparing the SD card for SD boot mode:
  • Find the "ZCU102_UbuntuDesktop_2017_4.img" in \Ubuntu_Desktop_Release_2017_4\Ready_to_test_images directory.
  • Extract the ZCU102_UbuntuDesktop_2017_4.img file to SD card using below steps.

Steps for Windows PC:
  • Install Win32DiskImager.exe Tool .This tool can be downloaded and installed from http://sourceforge.net/projects/win32diskimager/
  • Burn the SD card image (ZCU102_UbuntuDesktop_2017_4.img) into 8 GB SD card (bigger device if any issues with the size) using Win32 disk Image writer.
    Step1 : As highlighted below, browse the path to ZCU102_UbuntuDesktop_2017_4.img file
    Step2 : Select SD card partition as Device (This has to be selected with utmost care as this tool is going to format the selected drive)
    Step3 : Select the option "write",it will creates the partitions on to the SD card and burn images on it.
ZUUImage13.jpg
Disk Image selections for writing img file to SD card

  • After extracting the image on to the SD card, you will find following images in it.
    • BOOT.BIN
    • image.ub

Steps for Linux PC
  • This can be done on 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.

ZCU102 Board Setup:

  • 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.
  • Connect one end of Ethernet cable into the ZCU102 connector J73, and other end connect to the Ethernet socket of the host machine.
  • Insert SD card into the SD card slot J100.
  • Set the SW6 switches as shown. This configures the boot settings to boot from SD:
  • Connect 12V Power to the ZCU102 6-Pin Molex connector.

sw6_setup.JPG
  • Connect the monitor using DisplayPort cable to U50.
  • The following figure shows the ZCU102 board with connections.
Steps to execute the demo:
  • Switch on the ZCU102 Board at SW1 (red switch).
  • In few seconds the Ubuntu Desktop will boot up.
  • As shown in the following figure there are few icons tailor made like Webserver, Hard_glmark2, Soft_glmark2,3D car model etc to execute the Zynq UltraScale+ MPSoC specific applications.


home_screen.JPG
Fig:Ubuntu Desktop
  • Connect mouse and keyboard to ZCU102 hardware J96 USB 3 ULPI connector via USB hub. Observe mouse and keyboard to be working.
  • Double click/open "Hard_glmark2" application to launch it and observer a horse 3D models is rotating.All the models in this applications are rendered by the GPU as shown in the following figure.


glmark2.JPG
Fig:Hard glmark2
  • Launching the Web server application: Double click on the Web server icon on the desktop. A window will pop up on the Ubuntu desktop as shown in below figure showing IP address of the ZCU102 hardware.
ZUUImage19.jpg
Web client Launch Info

  • In Host PC or Laptop web browser, type the same IP address that gets displayed on your ZCU102 ubuntu desktop and not the exact one shown in the above diagram, since it changes with network. Observe that Zynq UltraScale+ MPSoC will start serving the web pages. Following image on Host/laptop shows the index page of this webserver.
ZUUImage20.jpg
Fig: Web server application

  • Launching the OSG car demo: Select the icon “3D Car Model" and double click on it. Window opens with Car image in it. Using mouse hold the car and rotate it. Observe Car rotating in the same direction as that of your mouse. To close the window use 'ALT+F4' keyboard command.
ZUuImage21.jpg
Fig: OSG 3D Car Application
Conclusion:
  • This demonstration showcases Zynq® UltraScale+™ MPSoC APU and GPU capabilities by running "SMP Linux with UI based applications" and OpenGL ES 2.0 API based 3D graphics application rendering" on rich Ubuntu Desktop system.

Appendix A:File description in Design directory

  • Ubuntu_Desktop_Release_2017_4.zip:
Ubuntu_Desktop_Release_2017_4:
  • Hardware
    • project.tcl
  • HDF_file
    • design_1_wrapper.hdf
  • Ready_to_test_images
    • ZCU102_UbuntuDesktop_2017_4.img