In this article I am going to keep track of how to make a Linux distribution with PetaLinux to run in the Zedboard.
I will run Vivado and PetaLinux in Ubuntu 16.04 LTS. This should also work in other distributions but dependencies may defer between them.
First I download the necessary programs from Xilinx. I will use Vivado 2017.4 and PetaLinux 2017.4. I downloaded them from this LINK.
While they download I also installed the following packages which PetaLinux depend on:
This can be installed from the command line by running the apt-get install command follow by all the packages as named in the list above.
Once Vivado and PetaLinux are downloaded Install them in the desire directory and then we will continue by first opening Vivado and creating the basic hardware description to be able to run our Linux operating system on the ZedBoard.
The only component that is needed is the SYNQ7 Processing system. Create a new project in Vivado and make sure you tell the software we are going to use the ZedBoard. Then introduce the ZYNQ7 processing system on the block design and then connect the FCLK_CLK0 to the M_AXI_GP0_ACLK and finally auto configure by pressing the highlighted text on the top of the diagram designing area. Then press F6 to validate the design and crate the wrapper by right clicking on the design source on the source control area. Then generate the bitstream and to finalize export the hardware (File->Export->Export Hardware). When asked, make sure to select to export with bitstream. At this point the Vivado software can be closed as we are finished with it.
From now-on, everything will be done from the terminal. Open a terminal window (Ctrl+Alt+t). To make sure that we can call the petalinux commands from anywhere we need to run the following command:
- source (path to petalinux)/settings.sh
Now you need to create a petalinux project to do this go to the directory where you would like to create the petalinux project (this will create a directory) and run the following command:
- petalinux-create –type project –template zynq –name (project name)
Make sure to change (project name) with the name you want to give the project. This will create a directory with this name. I will refer to this directory as the petalinux root directory.
Next we will configure the petalinux to be build. We need to enter the petalinux root directory and run the following command:
- petalinux-config –get-hw-description=(path to sdk)
The (path to sdk) needs to be the path to the directory where we exported the hardware from Vivado. Normally this is the same as the project name ended with a “.sdk”.
This will open a semi graphical interface on the terminal where we can configure the linux distribution we what to run. For this project all we need to do is go into Subsystem AUTO Hardware Settings, then Advance bootable images storage Settings and once there we need to set boot image settings, kernel image settings and dtb image settings to Primary sd.
Then we go into Image Packaging Configuration and set root filesystem type to sd card.
After that we exit the semi-graphical interface saving changes and the configuration should be done.
At this point the build of the linux booting system can be done by running the command:
Then the booting files can be made with:
- petalinux-package –boot –format BIN –force –fsbl images/linux/zynq_fsbl.elf –fpga images/linux/(bit file) –uboot
The bit file has to be changed with the .bit file in the folder ./images/linux/.
At this point the content in the /images/linux/ folder can be copied to the boot partition of the sd card.
Now we have to download the rootfs files for Ubuntu, this can be downloaded from:
It can also be done with the folowing command:
- wget -c https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-16.04.2-minimal-armhf-2017-06-18.tar.xz
Then extract the content with:
- tar xf ubuntu-16.04.2-minimal-armhf-2017-06-18.tar.xz
And copy the content to the SD card rootfs mounted point:
- sudo tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /media/rootfs/
- sudo chown root:root /media/rootfs/
- sudo chmod 755 /media/rootfs/
The path to the rootfs mounted point may be deferent in your system.
At this point you can unmount the SD card and use it to boot the Ubuntu system on the zedboard. Connect the usb serial port of the zedboard to your pc and use a software such as Putty to connect to the zedboard from your PC. Use a bauderate of 115200.
Enjoy petalinux in Xilinx zynq devices.