UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 66636

Zynq UltraScale+ MPSoC Example Design - Executing 32-bit applications on 64-bit Linux

Description

I have Linux running on Zynq UltraScale+ MPSoC and I need access to 32-bit applications. Is it possible to run multiarch Linux on this platform?

Solution

Yes, this is possible. The procedure below describes how to boot a 64-bit Ubuntu Core root file system on the ZCU102 evaluation platform.

The detailed steps below are divided into three basic phases:


  1. Use the Xilinx Vivado and PetaLinux tools to configure a hardware platform and the basic boot collateral such as ARM Trusted Firmware, U-Boot, device tree, and the Linux kernel.
  2. Download and configure the publicly available Ubuntu Core root filesystem such that it resides in a dedicated ext3 partition on an SD card.
  3. Configure the apt-get package manager to allow the installation of 32-bit applications


The resulting system can serve as a starting point for developing a more robust Ubuntu-based system tailored to the specific needs of a given system.

Before proceeding, make sure to apply the patches listed in the Linked Items section.

XILINX BUILD STEPS

The steps in this section are standard PetaLinux build steps. For more details on the commands referenced here, please see (UG1144).


Create a Vivado 2015.4 project targeting Zynq UltraScale+ MPSoC making sure that the project language is set to Verilog. The ZCU102 evaluation platform is based on the XCZU9EG-FFVB1156-2I device.

Generate a Vivado IP Integrator block diagram for this platform using the attached Tcl file.

Once the block diagram is created, generate the HDL wrapper for it and run the project through the Implementation design phase.

Following implementation, export a HDF file to a known location on disk. Often, it is easiest to export the HDF inside the same directory as the Vivado project.

Source the PetaLinux design tools and create a PetaLinux project using the zynqMP template:

$ petalinux-create -t project --template zynqMP -n <your_project_name>

After creating the PetaLinux project, initialize it using the HDF file generated by Vivado:

$ petalinux-config --get-hw-description=<path_to_HDF>

After the project is initialized, PetaLinux will automatically launch the system-level menuconfig interface. For now, it is safe to simply exit the interface and return to a terminal prompt.

Build the Linux project using the petalinux-build command. This will build a Linux image that uses an INITRAMFS root filesystem.

$ petalinux-build

Once the build is complete, the Linux image collateral will be located in <PETALINUX_PROJECT_ROOL/images/linux.

Create a standard Zynq UltraScale+ MPSoC boot image (called boot.bin) using the petalinux-package command:

$ petalinux-package --boot --format BIN --u-boot -o BOOT.BIN

Copy the boot.bin file to a different location for safe keeping.

Rename the image.ub file to initramfs.ub and copy it to a different location for safe keeping.

Return to the PetaLinux system-level menuconfig using the petalinux-config command:

$ petalinux-config

Configure the project so that the platform boots from ext3 SD card partition /dev/mmcblk0p2. 

This option is found at <Menu Top> --> Image Packaging Configuration --> Root filesystem type. Ensure that the "Device node of SD device" option reflects the /dev/mmcblk0p2 partition.


Exit the configuration menu and rebuild the PetaLinux project using the petalinux-build command:

$ petalinux-build

Once the build is complete, the Linux image collateral will be located in <PETALINUX_PROJECT_ROOL/images/linux.

Rename the image.ub file to sdcard.ub and copy it to a different location for safe keeping.

Using a standard partitioning tool such as gparted or fdisk, partition an SD card such that it has one FAT32 partition of size 128MB and one ext3 partition of size 4GB or larger.

If this is not done automatically by the operating system, mount the partitions that were just created.

Copy the boot.bin and .ub file created previously to the FAT32 partition of the SD card.


UBUNTU CORE CONFIGURATION STEPS

Download a copy of the 64-bit ARM version of Ubuntu Core 14.04 from http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/ubuntu-core-14.04.3-core-arm64.tar.gz

Copy the downloaded tarball to the ext3 partition of the SD card and extract it using the standard Linux tar command. It is important to run this command as root (or with sudo elevation) so that certain portions of the root filesystem can be created.

$ sudo tar xvfz ubuntu-core-14.04.3-core-arm64.tar.gz

Once extracted, copy the attached ttyPS0.conf and ttyPS1.conf files to the /etc/init directory. This will ensure that the logon prompt is presented after boot.

In order to boot properly, Ubuntu requires that at least one non-root user exist in the filesystem. To do this, boot with the initramfs.ub kernel image created previously.

On the FAT32 partition of the SD card, copy (or rename) the initramfs.ub image file to image.ub.

Unmount both the FAT32 partition and the ext3 partition and then eject the SD card from the host computer.

Insert the SD card into the SD card socket of the ZCU102 board and configure it to boot from the SD card.

Open a terminal window using a tool such as TeraTerm or PuTTY. The terminal output will be presented on UART Interface 0. The specific COM port will vary from computer to computer.





Power on the board and wait for the system to boot to a Linux login prompt. The default username and password combination is root / root .

After logging in, change directories to the root of the Linux filesystem:

# cd /

Create a temporary working directory that can be used for the chroot command:

# mkdir /chroot_mnt

Mount the ext3 partition to the chroot mount point:

# mount /dev/mmcblk0p2 /chroot_mnt

Use the chroot command to switch into the Ubuntu root filesystem:

# chroot /chroot_mnt

Once in the chroot environment, add a new user for the Ubuntu Core environment using the adduser command:

# adduser ubuntu
# addgroup ubuntu adm
# addgroup ubuntu sudo

In order for networking to work automatically, create a network configuration script in /etc/network/interfaces.d/

An example script named eth0 is attached this Answer Record.

Exit the chroot environment using the exit command.

Unmount the ext3 partition from the mount point:

# umount /chroot_mnt

Power off the ZCU102 board and eject the SD card from the board.

Re-insert the SD card into the host computer.

From the host computer, navigate to the FAT32 partition of the SD card.

Copy (or rename) the sdcard.ub image file to image.ub

Eject the SD card from the host computer and re-insert it into the ZCU102. Power on the board again and monitor the output in the terminal.


SETTING UP THE 32-BIT REPOSITORIES


During this boot, the Zynq UltraScale+ MPSoC device will boot into the root filesystem located on the ext3 partition of the SD card rather than an INITRAMFS.

When presented with the login prompt, use the credentials created above for the "ubuntu" user.

After logging into the system. add the 32-bit CPU target usingrhe following command:

sudo dpkg --add-architecture armhf

Update the list of packages with the following command:

sudo apt-get -y update

You should see that the armhf versions are now available. The armhf packages are 32-bit packages while arm64 packages are 64-bit.

32-bit applications can now be installed using standard apt-get methodology from the terminal prompt.

Attachments

Associated Attachments

Name File Size File Type
design_1_bd.tcl 19 KB TCL
ttyPS0.conf 355 Bytes CONF
ttyPS1.conf 355 Bytes CONF
eth0 31 Bytes NA

Linked Answer Records

Associated Answer Records

AR# 66636
Date Created 02/16/2016
Last Updated 03/14/2016
Status Active
Type General Article
Devices
  • Zynq UltraScale+ MPSoC
Tools
  • PetaLinux
  • PetaLinux - 2015.4
Boards & Kits
  • Zynq UltraScale+ MPSoC Boards and Kits
  • Zynq UltraScale+ MPSoC ZCU102 Evaluation Kit