This article is all about building and generating the u-boot (SPL) image, linux kernel, device tree and root file system for the Avnet Zedboard 7010. Also, I will touch on how to create the fpga bit stream to program the Programming logic(PL). I have no experience in fpga but I would like to touch the fpga bit stream topic for the sake of completeness. Basically, a fully functional system where we can do tweaks later on. This is all about setting up the foundation to load the operating environment on the Avnet microZed using sd card/mmc. The model name is Z7MB-7z0x0-ASY.
Motivation to do this?
I don’t want to use Petalinux which abstracts a lot of details from the user. Instead, I would like to use Yocto build system. Here, in this blog, I am using warrior release of yocto.
Setup - I am using Ubuntu 18.04 on Windows 10 host machine. I had a little bit of trouble finding what version of virtual box works with Ubuntu 18.04. I found that the version Virtual box 6.1.2 running guest OS - Ubuntu 18.04 works well on Windows 10 host machine. Here is the link - virtualboxForum Make sure you install the guest additions too for 6.1.2. Before you run the Guest Addition program, ensure you have installed the build-essential linux-headers-generic. Also, you might have to install build-essential gcc make perl dkms. I have given 50Gb to create Ubuntu virtual machine that should be sufficient to build the entire operating environment for microZed board.
Pre-requisite
Install the essentials in order to use Yocto.
Ubuntu and Debian The essential and graphical support packages you need for a supported Ubuntu or Debian distribution are shown in the following command:
Create your workspace.
The branch I am going to use here is Warrior. Checkout Poky - Warrior.
Layers we are using
Inside the poky folder, checkout these layers.
Initialize the build
This source command will create a build directory and will cd into build directory. The build directory will have the template for local.conf and bblayers.conf. Here is the command.
Let’s edit bblayers.conf to add layers to the recipe.
Now, edit local.conf to tell what machine architecture we are building for.
Now, you are good to go. Let’s build the Secondary Program Loader (SPL) u-boot image. The SPL image replaces the need for first stage boot loader i.e. fsbl.
Build U-Boot This will create boot.bin, u-boot.img.
Build minimal working uImage, dtb and rootfile system
This is how it looks on the terminal.
Generating fpga bit stream for microZed.
In order to build fpga bit stream, we will use Vivado. I have installed Vivado on my Windows 10 machine.
By default, Vivado doesn’t have board files for microzed zynq 7010 from AVNET. So, we need to download the board files of microzed zynq7. Here is the link to download the board files. If the link doesn’t exist then you can also do a google search for microzed-zynq7 board files.
Some people use Xilinx Vitis IDE to generate FPGA program. The most popular language for FPGA is VHDL. Vitis
zynq-microzed-7010x-board-definition
Copy the board definition files at the location -
or if you are not a regular Windows OS user, then you can use this link for reference Vivado_Board_File_Installation
Now, you should be able to select the board for Zynq-7010x. I have followed this tutorial to generate the bitstream
Here is my fpga project.
Once you run it, Vivado generates the bit file in runs\impl_1 folder in the project directory.
Prepare hardware system
I use gpart application to do the partitiion. You need to enable USB in the virtual box. You might need to restart the virtual box after enabling the usb device.
Now copy, boot.bin, devicetree.dtb, u-boot.img uEnv.txt and uImage in the FAT partitiion. Also, if you have created the fpga bit stream then you could copy the fpga bit stream here.
boot.bin is the SPL image and it will look for u-boot.img. u-boot.img will look for devicetree.dtb to set parameters for the kernel. For e.g, what clock rate, i2c devices the board needs is all defined in the devicetree. uImage i.e Kernel will refer to the device tree in order to configure and probe the required drivers. When the kernel starts, it reads this file (called dtb for Device Tree Binary) to know the devices on the board, and initialize useful drivers. Basically, SPL image uses PS7 i.e. processor system ps7_init.c and ps7_init.h from the xilinix board. In case you are not using microzed zynq, then you might need to generate ps7_init.c and ps7_init.h using xilinix tool. Next, you need to copy these files to uboot-xilinx. The PS7_init.c does a lot of things like - resetting the SLCR - System level control registers and rom boot loader. It starts by resetting the processor.
Copy Root File System
Mount EXT4 to some
Poking with u-boot environment.
By default, my system had the following sdboot value.
ramdisk_image=uramdisk.image.gz
Here you can see, it is trying to boot the ramdisk image i.e. rather than mounting the root file system, it’s going to load the root file system on the RAM.
By the way, when you build, you must be wondering where is uramdisk.image.gz. Basically uramdisk.image.gz is nothing but
So, if you don’t want to mount ext4 partitiion, you can use ramdisk_image. Otherwise, you can change the sdboot to
Loading the fpga bit stream
I have given a name to the fpga bit stream as custom_ip.bit here.
Setting the u-boot environment
Please note that I am using fpga loadb in order to load the bitstream. There is no translation required in order to load the fpga bitstream generated from Vivado.
EXT4 Root File System
Telling uboot to mount the rootfile system from where?
This is to identify from where kernel should mount the root file system.
In my case, I did the following in my u-boot.
Now, this tells me that my ext4-root file system is at mmcblk0p1 mmcblk 0 is the first sd card and p1 is the second block.
Now, set the u-boot environment variable bootargs, which eventually is passed to the kernel. Kernel uses this environment variable to set the console, root file system and other parameters.
There are many commands supported by the u-boot. Here is the help.
You can view the current environment variables using the following command.
U-Boot runs code placed in (processor’s) RAM, although it can also read data from other media. The boot process normally takes place in two steps:
In order to read an image from an MMC card formatted in FAT, the command is:
bootm This command starts a kernel image running.
In our case, we are not using ramdisk so ‘-‘ in the middle.
Here is the entire system.
Here is the root file system mounted.
FSBL based
Instead of SPL image, you can use FSBL too. In order to generate FSBL, you need to use Xilinx SDK. Also, I will suggest that it is a better idea to enable FSBL_DEBUG_INFO in order to see whether FSBL is working or not. Here is how you enable the FSBL_DEBUG_INFO in order to troubleshoot the FSBL based image. I haven’t tried building up the entire system using FSBL. However, I was able to load the FSBL image successfully. Personally, I recommend to use SPL rather than FSBL.
Here is the link to download the tutorial for FSBL based AVNET ZYNQ-7010.
I strongly suggest to use SPL image rather than FSBL since if you get stuck with something then you have no support but to use peta-linux only.
Here is the link to download the ZedboardImage.
Here are the jumper settings to change the boot mode to JTAG, QSPI or SD Card.
Also, you can read the entire guide on setting.
This brings an end to this article. Here is the entire embedded system running.