In this project I'll be going over how to install an Ubuntu distribution on the Zynq UltraScale+ MPSoC of the TE0802 FPGA development board. This Ubuntu installation will just cover the basic system without the desktop image, as that will be covered in another project given it is a much more in-depth task that needs its own focus.
Starting with the PetaLinux project (v2019.2) from my previous post covering how to run Linux on the TE0802, we will be using the boot binary and the kernel image generated from it and simply swapping out the generated root filesystem for the desired Ubuntu version downloaded from an external source.
Since the PetaLinux project from my previous project is already built with all of the targeted hardware on the TE0802 and the root filesystem type is configured to live on an external media such as an SD card, it would be possible to simply take the kernel image and boot binary files from the /<PetaLinux project directory>/images/linux/ directory without any extra work. However, if you'd like to enable any extra kernel drivers or modify the device tree or U-BOOT environment, just be sure to rebuild the PetaLinux project and package a new boot binary:
~$ petalinux-package --boot --fsbl ./images/linux/zynqmp_fsbl.elf --fpga ./images/linux/system.bit --u-boot --force
Keep in mind that the root file system generated by the PetaLinux project is going to be replaced with the Ubuntu version downloaded from an external source, so any changes made to the root filesystem configuration in the PetaLinux project won't be present in the Ubuntu image running on the TE0802.Prep SD Card
If you haven't already, prepare a MircoSD card (at least an 8GB, class 10) by partitioning it with a FAT32 partition 500MB in size with 4MB of free space preceding it. Then make the rest of the SD card an EXT4 partition:
Download the image of the desired Ubuntu (or Debian) version to install. In my case, I chose to go with the latest version of Ubuntu 20.04.2. You can download it from a browser here or from the command line of your host PC:
~$ wget -c https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-20.04.2-minimal-armhf-2021-08-17.tar.xz
Now I should note that since I am using PetaLinux v2019.2, the Linux kernel version that is being implemented is 4.19, which is a bit on the older side (the current version is 5.14). However, since none of the hardware on the TE0802 is newer than what kernel version 4.19 can support and kernel version 4.19 is going to be supported through 2024, it should work ok with Ubuntu 20.04.2 (20.04.2 does ship with kernel version 5.8 typically). However, if anything weird comes about with trying to interface with any hardware, one of my first troubleshooting steps would probably be to re-image the SD card with Ubuntu 18.04.2 since it shipped with kernel version 4.18.
In last couple of projects based on the TE0802 that go over setting up the hardware design and running a basic embedded Linux image, I described how I like to set up my project file structure. Mainly, I create a Vivado project first then place everything else within the top level Vivado project folder. Since I have a folder within this top level directory for the base PetaLinux project, I created a separate folder for the Ubuntu image then moved the downloaded compressed files to it from the Downloads folder:
~$ cd ./te0802_prj
~$ mkdir -p ubuntu_20-04-2
~$ mv ../Downloads/ubuntu-20.04.2-minimal-armhf-2021-08-17.tar.xz ./ubuntu_20-04-2/
~$ mv ../Downloads/ubuntu-20.04.2-minimal-armhf-2021-08-17.tar.xz.sha256sum ./ubuntu_20-04-2/
Run the checksum to verify the integrity of the Ubuntu download:
~$ sha256sum ./ubuntu_20-04-2/ubuntu-20.04.2-minimal-armhf-2021-08-17.tar.xz
Then extract the tarball for the embedded Ubuntu image:
Load SD Card
~$ tar xf ubuntu-20.04.2-minimal-armhf-2021-08-17.tar.xz
Create a mounting point for each of the partitions on the SD card (if you haven't done so in the past) and mount them respectively:
~$ mkdir /media/BOOT
~$ mkdir /media/rootfs
~$ sudo mount /dev/sdc1 /media/BOOT
~$ sudo mount /dev/sdc2 /media/rootfs
Copy over BOOT.BIN (the boot binary), image.ub (kernel image), and system.dtb (device tree) to the FAT32 partition from the PetaLinux project for the TE0802:
~$ sudo cp /<petalinux project dir>/images/linux/BOOT.BIN /media/BOOT/
~$ sudo cp /<petalinux project dir>/images/linux/image.ub /media/BOOT/
~$ sudo cp /<petalinux project dir>/images/linux/system.dtb /media/BOOT/
Then extract the Ubuntu tarball onto the EXT4 partition of the SD card:
~$ sudo tar xfvp ./ubuntu_20-04-2/ubuntu-20.04.2-minimal-armhf-2021-08-17/armhf-rootfs-ubuntu-focal.tar -C /media/rootfs/
Run the sync command to ensure all files for the Ubuntu root filesystem have completed being extracted/transferred onto the SD card partition, then set the proper permissions of the root filesystem file structure:
~$ sudo chown root:root /media/rootfs/
~$ sudo chmod 755 /media/rootfs/
Run the sync command to again ensure all file transfers to the SD card are complete then unmount both partitions:
Set TE0802 Boot Mode
~$ sudo umount /media/BOOT/
~$ sudo umount /media/rootfs/
The TE0802 has its boot mode set using a DIP switch (S1 on the board located next to the VGA port). In this case, the TE0802 will be booted from the SD card prepped in the previous step so S1-1 and S1-2 shall both be set to the ON position.
Insert the SD card into the slot on the bottom side of the TE0802, connect a MicroUSB to the JTAG/UART port (J8) and an Ethernet cable to the Gigabit Ethernet port for a network connection (either directly from a router or through Internet sharing from a PC), then plug in the 5V/4A wall plug power supply.
Open a serial terminal application with a baud rate of 115200 (the standard ZynqMP UART speed) to view the Ubuntu boot process:
The default username and password is given in the serial output right before the login prompt with are:
- Username: ubuntu
- Password: temppwd
A good first step to initially verify the system is to run a quick update:
ubuntu@arm:~$ sudo apt-get update
And that's it! Keep in mind that this process is applicable with most external Linux distributions you'd like to install on the TE0802 (and any Zynq or ZynpMP based board), so long as the distribution targets the ARM architecture.