Running Ubuntu 20.04 on Zynq SoC
One of the earlier posts demonstrated the process of building Petalinux for the Zynq SoC on the Zybo board. The process itself is quite simple when all you have to do is run Linux. It gets tricky when you need to modify the core settings and tweak the operating system to make it do what you want it to do. I found the whole thing quite difficult to grasp at the beginning. With time and consistency, I can now build Petalinux and at least understand what some of the settings mean. Coming to this point required me to climb a steep learning slope. I would say that there’s still a long way to the top. Embedded Linux is HARD!!! Running a few commands here and there on a pre-assembled linux system is far from what we are doing here. Embedded linux for Zynq SoC which is an FPGA and an applications processor is an entirely different game.
Coming back to our main topic here; Running Ubuntu 20.04 on Zynq. Now, this requires you to have a pre-built Petalinux setup at hand. If you are entirely new to this, go back to this tutorial and have a basic setup ready.
Basic Petalinux setup
The basic setup consists of you having a running Petalinux system. Your SD card should have two partitions, FAT32 and an ext4 partition. The first partition should always be FAT32 known as the boot partition. It should contain the usual files necessary to program the FPGA and boot the processor. On the other hand, the second partition consists of the root file system. Now, this root file system becomes our interest for today.
While configuring the Petalinux, the default setting bundles the root file system into one of the BOOT files that reside in the FAT32 partition. The root file system decompresses and goes on to reside on the RAM. In case you make any changes to the system, they would get wiped off at the next reboot or power cycle. For example, a new user would only be valid until the next reboot or power cycle. If you wish to make this new user stay forever, the solution lies in petalinux configuration.
Select the following option
The options show that we can have our root file system on any media. For example, SD card, eMMC, SATA and even USB flash drive. For now, I prefer to use my existing SD card’s ext4 partition.
Get the Ubuntu 20.04 Rootfs for Zynq
Ubuntu Root file system is freely available from multiple sources. For today, I am getting my Ubuntu rootfs from the repository linked below:
Download the whole package and extract it to some temporary folder.
tar -xf ubuntu-20.04.3-minimal-armhf-2021-12-20.tar.xz
sudo tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /path/to/sd-card/rootfs
These commands extract and copy the contents of the package to your SD card’s ext4 partition.
You can find the boot log attached below.
Getting the network to work
Right out of the box, the ethernet wasn’t connecting to the network on its own. Rather, it required some configuration to get it to work. In case you find yourself in a situation where you remain disconnected carry out the following steps.
sudo vi /etc/netplan/networkmanager.yaml
Enter the following lines into the file without modifying the indentation.
Save the file by typing “!wq”
Run the following commands after saving the file.
sudo netplan generate
sudo netplan apply
Now, this configures the ubuntu network settings automatically. Finally, you should be able to connect to the network/internet.
Ubuntu brings with itself some very essential packages. For example, the “apt-get” package allows us to download and install packages quickly. This very package can make your whole Linux experience smooth and time saving. On the other hand, there are many other essential utilities that come with Ubuntu. The process of installing Ubuntu 20.04 on Zynq board was quite simple when you know your way around basic Petalinux setup.
You can also refer to this official deprecated page from Xilinx.
In my experience, Ubuntu ran very fine on Zybo consuming less than 50MB RAM out of 1GB available to it. The processor usage stayed below 2% in idle time. In short, the whole thing worked quite efficiently while using a small amount of resources.
Read my other Zynq posts: