April 18, 2024

EBAZ4205 Bitcoin miner board - Petalinux

When my EBAZ boots, I see this:
PetaLinux 2016.4 zedboard-zynq7 /dev/ttyPS0
zedboard-zynq7 login:
So, what the heck is Petalinux? And can it be useful for me? Interestingly, Petalinux comes from Xilinx (AMD). It used to be licensed, but now appears to be freely available. You download the "tools", then the Zynq 7000 SoC board support package. Version is 2023.2. The Zynq BSP has two flavors: ZC702 and ZC706, I will get the former. I also bet that I have some form of Petalinux already as part of Vivado.

Indeed I do have some form of Petalinux I got from github on my system at:

/u1/Projects/FPGA/Ebaz/Petalinux
https://github.com/Xilinx/u-boot-xlnx.git
https://github.com/Xilinx/linux-xlnx.git
https://github.com/Xilinx/bootgen.git
I may have it also in Vivado (or Vitis) as well.

Download it

I get a prompt with the AMD logo asking me to login. My Xilinx login from 2021 works just fine. Chrome gets upset and blocks the download, but I can override it. I repeat the download for the ZC702 BSP.
I end up with:
-rw-r--r-- 1 tom tom 3227773323 Apr 18 19:37  petalinux-v2023.2-10121855-installer.run
-rw-r--r-- 1 tom tom  183791741 Apr 18 19:39  xilinx-zc702-v2023.2-10140544.bsp

Install it

chmod a+x *.run
tom@trona:~/Downloads$ ./petalinux-v2023.2-10121855-installer.run
I complains I don't have ncurses (but I do), but what I need is the "devel" package:
dnf install ncurses-devel
Now it warns that it doesn't find a tftp server and tells me to look at UG1144. And now I have two license agreements to agree to. Now it tells me that it plans to install in the current working directory, which is not what I want (i.e. /home/tom/Downloads). I bail out.

Try again

I looked at UG1144 which is a 176 page PDF file. Chapter 2 is "setting up your environment" and talks about the install process. I decide I want to install it to /opt/petalinux. On my system, /opt is a symlink to /u1/opt. I want to install as user "tom", so I will first need to do this:
chown tom:tom /u1/opt

I can specify the petalinux install directory via:
./petalinux-v2023.2-10121855-installer.run -d /opt/petalinux
You can also specify the platform you want to work with via:
./petalinux-v2023.2-10121855-installer.run -d /opt/petalinux -p arm
Platform choices are: arm, aarch64, microblaze_lite, and microblaze_full. If you don't specify a platform, it install all of them. I can't imagine working with anything but "arm" and the Zynq XC7Z010 on the Ebaz, so I will go ahead and specify arm. I use this command:
./petalinux-v2023.2-10121855-installer.run -d /opt/petalinux -p arm
It seemed to work with one odd warning. The last thing is to set up the environment via:
cd /opt/petalinux
source settings.sh

Create a project with the BSP

I also downloaded xilinx-zc702-v2023.2-10140544.bsp -- the path to this is:
/u1/Petalinux/xilinx-zc702-v2023.2-10140544.bsp
So, to create a first project, I should do this:
cd /opt/petalinux
petalinux-create -t project -s /u1/Petalinux/xilinx-zc702-v2023.2-10140544.bsp
This creates the subdirctory "xilinx-zc702-2023.2". Note that I do this in /opt/petalinux, which is somewhat questionable (i.e. to put a project directory inside the install directory). A more normal choice would be to put it under /home/tom, but we will do this just to keep it all in one place. And besides, /home/tom is a giant clutter.

Now what?

At this point, carefull study of UG1144 is in order. I will note at this time that chapter 8 (Customizing the Root File System) has a section called "Creating and Adding Custom Applications" that looks like what I want to build C code to run under Petalinux.
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org