Ubuntu on Zynq

This page is deprecated and is no longer being updated. The content is being retained for reference. For more information about running Ubuntu on Zynq UltraScale+ MPSoC, please refer to Canonical Ubuntu


This page describes how Ubuntu can be run on Zynq platforms. The Ubuntu system described on this page is pretty minimalistic and does not feature any graphical user interface. There is a Ubuntu Tech tip on our wiki as well with a graphical user interface. There is also an Arch Linux root file system available.

Table of Contents

Required Files

To boot the system we need the usual set of files. Pre-built images can be downloaded here.
Additionally we need the Ubuntu root file system, which is also found in the download section.
To use this Ubuntu system, you'll need a SD card to boot your Zynq platform from.

Downloads

Boot Images

The archive zynq-ubuntu-core-12.10-core-armhf-boot.tar.xz holds Zynq boot images, currently only for zc702.

Contents

FileDescriptionmd5
zc702/boot.binboot imaged0e3bab18bc898a6d594029f659105ba
zc702/fsbl.elfFSBL binary used for the boot image07e9613068b47cdb992293c886a43a39
zc702/u-boot.elfu-boot binary used for the boot image480b2b0b32b40edc6b0d09c188368626
uImageLinux kernelc891286253097d17f9dc44aeb8d16e88
zc702/devicetree.dtbdevice tree blobebc5e6fc8884ed059ff9d2ab05ecf4a8
uramdisk.image.gzinitramfs096e11aea960731adc30d814f1451d6a
These files are tested to work, but it shouldn't be difficult to replace them. Though not tested, this whole process should be portable to other platforms by reusing the released boot images. The Dirty Details section has more details about the files.



Root File System

The Ubuntu root file system is provided through zynq-ubuntu-core-12.10-core-armhf-rootfs.tar.xz. The file system is based on Ubuntu's core file system, in particular the armhf release of Ubuntu 12.10 (Quantal Quetzal).



Copy the System to an SD Card

You need a SD card with two partitions. Partition one will be the boot partition and partition two will hold the root file system. Please follow these instructions for partitioning your SD card.

Extract the boot images to a temporary directory and copy the files appropriate for you platform to the root of the boot partition of your SD card, i.e. the files must not be in any subdirectories.
tar xvJf zynq-ubuntu-core-12.10-core-armhf-boot.tar.xz
mount /dev/sdX1 /mnt/boot
cp boot/uImage boot/uramdisk.image.gz boot/zc702/boot.bin boot/zc702/devicetree.dtb /mnt/boot
umount /dev/sdX1

Then extract the root file system to a temporary directory and copy it to the root partition of your SD card. Since the root file system has files with root permissions, you need root privileges for all these steps.
tar xvJf zynq-ubuntu-core-12.10-core-armhf-rootfs.tar.xz
mount /dev/sdX2 /mnt/root
cp rootfs/* /mnt/root/
umount /dev/sdX2

That's it. Remove the SD card from your computer and insert it in your Zynq platform. Set it up for SD boot and power it up.

Login to the System

The system should boot up (see boot log below) and greet you with a login prompt.
Valid users to login with are:
UserPassword
rootroot
xilinxxlnx
The fundamental tools should be available and others can be installed and updated with apt-get
Note that the sorce.list can be outdated and might require to add new sources in order to count on recent packages.

To use dhcp to enable networking start the dhcpd client
dhclient eth0
To set this as default, add the following line to /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
 


The Dirty Details

Root File System

The following lines have been added to /etc/securetty
# Zynq's UARTs
ttyPS0
ttyPS1

The file /etc/init/ttyPS0 has been added (based on /etc/init/tty1)
# ttyPS0 - getty
#
# This service maintains a getty on ttyPS0 from the point the system is
# started until it is shut down again.
 
start on stopped rc RUNLEVEL=[2345] and (
 not-container or
 container CONTAINER=lxc or
 container CONTAINER=lxc-libvirt)
 
stop on runlevel [!2345]
 
respawn
exec /sbin/getty -L -8 115200 ttyPS0

The kernel modules are installed in /lib/modules/`uname -r` and kernel headers are found in /usr/src/linux-headers-`unare -r`.

A few additional packages have been installed. Amongst others:
  • vim
  • aptitude
  • net-tools
  • openssh-server
  • isc-dhcp-client

Initramfs

The initramfs is created with buildroot using the attached config files for buildroot and busybox.

NOTE: The created initramfs is compressed using LZMA. If you replace the kernel, make sure the LZMA decompressor is enabled.

The exact state of the buildroot repository at creation time was pretty much commit
commit 2c4ff68e08e063152245d0a1b211df7a4360f925
Author: Soren Brinkmann <soren.brinkmann@xilinx.com>
Date: Wed Apr 10 10:34:38 2013 +0000
 
 system/securetty: Add ttyPS[0-1]
 
 Adding ttyPS0 and ttyPS1 to securetty for Zynq.
 
 Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Plus a patch floating around on the mailing list which automates adding a u-boot header to the created image
Author: Spenser Gilliland <Spenser309@gmail.com>
Date: Thu Apr 11 13:03:01 2013 -0500
 
 fs: add uimage support w/ example for cpio
 
 Adds uimage support for various root filesystems. Uimage support is needed when
 using the bootm command in uboot. This provides both a simple infrastructure
 similar to the current BR2_TARGET_ROOTFS_$(2)_GZ for adding compression. To
 define the a rootfs should have a UIMAGE wrapper simply create the
 BR2_TARGET_ROOTFS_$(2)_UIMAGE symbol.
 
 Signed-off-by: Spenser Gilliland [[mailto:spenser@gillilanding.com|spenser@gillilanding.com]]

The init script of the resulting initramfs is replaced with the following code, in order to make the switch to the Ubuntu system
#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
 
echo "do mounts"
/bin/mount -t proc proc /proc
/bin/mount -o remount,rw / # REMOUNT_ROOTFS_RW
/bin/mkdir -p /dev/pts
/bin/mkdir -p /dev/shm
 
echo "start mdev"
/sbin/mdev -s
 
echo "mount root"
/bin/mount /dev/mmcblk0p2 /mnt
/bin/mount -t devtmpfs devtmpfs /mnt/dev
 
echo "hand off to new root"
# exec /sbin/init
exec /sbin/switch_root /mnt /sbin/init

Obviously here is a lot of potential to do things prettier:
  • acutally parse the kernel command line and honor root=... arguments
  • error checking in case the root device is not available/mountable and dropping a shell
  • and probably many more

Devicetree

The devictree has been compiled from the zynq-zc702.dts as present in the xilinx-v14.5 tag, with following modifications:
  • the ip=... argument is removed
  • the root argument is changed to root=/dev/mmcblk0p2

Linux Kernel

The kernel has been created from a commit a little ahead of the xilinx-v14.5 tag with the default config file. The kernel should be easily replaceable with a custom kernel.
bash$ git describe
xilinx-v14.5-15-gabc285b

U-Boot

U-Boot has been created from the xilinx-v14.5 tag.

FSBL

The FSBL is a standard FSBL for zc702 created with 2013.1/14.5 version of XSDK.

Related Links

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy