This is a Step-by-Step Tutorial how to create a Hardware Accelerator Platform for AXU2CGA/B Zynq UltraScale+ FPGA development board made by Alinx, that can be used for runnung GNU Radio applications with accelerating functions under the Xilinx Vitis toolset.
Adding the gr-satellites developed by EA4GPZ and building your own OOT modules is also included in this set of Tutorials.
This is the Part-2/4: Build the PetaLinux and GNU RadioAdding Software Components to PetaLinux 2021.2: GNU Radio, gr-fpga-ai, gr-osmocom and and gr-satellites.
If you are looking for other parts of these tutorials, you can go there directly:
- Part-1 - Create the Vivado Hardware Design
- Part-2 - Software - Build the PetaLinux and GNU Radio
- Part-3 - Create a Vitis Platform and Application with DPU
- Part-4 - Build the AI model in Colab and Vitis-AI
Go to the software folder we created earlier in Part-1.
$ cd ../software
1- Run the settings.h script where the PetaLinux tools is installed.
$ source /tools/petalinux/2021.2/settings.sh
2- Create a PetaLinux project named axu2cgb_2021_2-petalinux and configure the hardware with the XSA file we created before in Part-1:
$ petalinux-create -t project --template zynqMP -n axu2cgb_2021_2-petalinux
$ cd axu2cgb_2021_2-petalinux
$ petalinux-config --get-hw-description=../../hardware/axu2cgb_2021_2-vivado/
The “misc/config System Configuration” window will appear.
System Configuration1- Go to the Image Packaging Configuration > Root filesystem type and choose EXT4 (SD/eMMC/QSPI/SATA/USB).
2- Change the Device node of SD device to /dev/mmcblk1p2.
3- Set the bootargs:
- Change DTG settings -> Kernel Bootargs -> generate boot args automatically to NO
- Update User Set Kernel Bootargs to
earlycon console=ttyPS0,115200 clk_ignore_unused root=/dev/mmcblk1p2 rw rootwait cma=512M
All other options leave as default and don't change the MACHINE_NAME. Leave it as template.
4- Save and exit. Wait for the configuration to complete.
Modifying the Device TreeWe need to add the driver configuration for SD card and USB port.
1- Edit the project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi file.
$ vi project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
2- Add the following at the end of file:
/include/ "system-conf.dtsi"
/ {
};
/* SD */
&sdhci1 {
disable-wp;
no-1-8-v;
};
/* USB */
&dwc3_0 {
status = "okay";
dr_mode = "host";
};
3- Save file and exit.
Config the KernelJust run the following command and wait for a half an hour (only the first time) for the menu to open.
$ petalinux-config -c kernel
1- Disable CPU IDLE in kernel config:
- CPU Power Management > CPU Idle > CPU idle PM support - set 'N' n the [ ] menu selection
- CPU Power Management > CPU Frequency scaling > CPU Frequency scaling - set 'N'
2- In the menu Library routines > Size in Mega Bytes set value to 1024.
3- Accept all other defaults, Save and Exit.
Adding GNU Radio to RootFSWe need to add the following software components to the build system:
- GNU Radio v3.8 - main program
- gr-osmosdr v3.8 - module needed for SDR receivers
- gr-fpga_ai v3.8 - module needed for accessing DPU on FPGA
- gr-satellites v3.8 - module for decoding signals from satellites
All software components above are located on the GitHub repositories and will be added to build system by adding additional Yocto Layer with recipes, gathered on the META-SDR GitHub repository.
1- Change directory to project-spec and clone META-SDR repository from GitHub. Change branch to DPU-FPGA, because only this branch on S59MZ GitHub repository is appropriate for our PetaLinux building.
$ cd project-spec
$ git clone https://github.com/s59mz/meta-sdr
$ cd meta-sdr
$ git checkout dpu-fpga
2- Now, we need to tell the build system the location of these new added META-SDR Yocto recipes.
- Change directory back to axu2cgb_2021_2-petalinux directory
$ cd ../..
$ pwd
# /tools/workspace/axu2cgb/software/axu2cgb_2021_2-petalinux
3- Run petaLinux-config again
$ petalinux-config
4- Go to Yocto Settings > User Layers and add a new user layer, named:
${PROOT}/project-spec/meta-sdr
5- Optionally, you can also set the MAC Address in this menu program.
- Select Subsystem AUTO Hardware Settings > Ethernet Settings and untick Randomise MAC
- Enter a new MAC Address.
6- Save and exit.
7- Verify the new added Yocto Layer by viewing the build/conf/bblayers.conf file. The file should have a line at the end that refers to the meta-sdr directory.
$ tail build/conf/bblayers.conf
# /tools/workspace/axu2cgb/software/axu2cgb_2021_1-petalinux/project-spec/meta-sdr \
Config the RootFSBefore we start the configuration program, we need to edit the user-rootfsconfig file add some names of the programs we want to be visible in the Configuration Menu. These programs will be built and added to the RootFS file system.
1- Edit the project-spec/meta-user/conf/user-rootfsconfig file.
$ vi project-spec/meta-user/conf/user-rootfsconfig
And add the following content into:
Note: Mention Each package in individual line
#These packages will get added into rootfs menu entry
CONFIG_gpio-demo
CONFIG_peekpoke
# Packages for base XRT support
CONFIG_xrt
# ackages for easy system management
CONFIG_dnf
CONFIG_e2fsprogs-resize2fs
CONFIG_parted
CONFIG_resize-part
# Packages for Vitis-AI dependencies support
CONFIG_packagegroup-petalinux-vitisai
# Optional Packages for natively building
# Vitis AI applications on target board
CONFIG_packagegroup-petalinux-self-hosted
CONFIG_cmake
CONFIG_packagegroup-petalinux-vitisai-dev
CONFIG_xrt-dev
CONFIG_opencl-clhpp-dev
CONFIG_opencl-headers-dev
CONFIG_packagegroup-petalinux-opencv
CONFIG_packagegroup-petalinux-opencv-dev
# Optional Packages for running i
# Vitis-AI demo applications with GUI
CONFIG_mesa-megadriver
CONFIG_packagegroup-petalinux-x11
CONFIG_packagegroup-petalinux-v4lutils
CONFIG_packagegroup-petalinux-matchbox
# Packages for date and time settings
CONFIG_ntp
CONFIG_ntpdate
CONFIG_ntp-utils
# Some utils
CONFIG_git
CONFIG_zip
CONFIG_unzip
# Gnuradio and its modules
CONFIG_gnuradio
CONFIG_gr-osmosdr
CONFIG_gr-satellites
CONFIG_gr-fpga-ai
Save file and exit.
2- Config the rootfs by running this command:
$ petalinux-config -c rootfs
3- Go to User Packages
- Enable all previously added user packages.
- Don’t forget to enable gnuradio, gr-osmosdr and optionally gr-satellites if you need to decoding satellites.
4- Enable OpenSSH and disable dropbear (optional):
- Go to Image Features
- Disable ssh-server-dropbear and enable ssh-server-openssh and click Exit.
- Go to Filesystem Packages-> misc->packagegroup-core-ssh-dropbear and disable packagegroup-core-ssh-dropbear
- Go to Filesystem Packages > console > network > openssh and enable openssh, openssh-sftp-server, openssh-sshd, openssh-scp
5- Enable Package Management:
- Go to Image Features and enable package-management and debug_tweaks
6- Save and Exit from the menu.
Extra Image Feature SettingsBecause we want to build our own Out of Tree Modules (OOT) on this platform, we need to put the dev-pkgs EXTRA_IMAGE_FEATURE flag somewhere in the Yocto recipe.
We put this flag into top petalinux-image-minimal.bb recipe, otherwise, feel free to put it on the more convenient place, if you want to.
Edit the petalinux-image-minimal.bb file:
vi components/yocto/layers/meta-petalinux/recipes-core/images/petalinux-image-minimal.bb
and add the following content into the file:
DESCRIPTION = "OSL image definition for Xilinx boards"
LICENSE = "MIT"
require petalinux-image-common.inc
EXTRA_IMAGE_FEATURES += " \
tools-debug \
tools-profile \
tools-sdk \
dev-pkgs \
package-management \
debug-tweaks \
"
Save file and exit.
Build the PetaLinux ImageRun the command and wait for several hours to finish:
$ petalinux-build
At the end, check if all images (rootfs, Image, u-boot, etc) are builded successfully in the image/linux directory. Check the time of the file creation.
$ ls -lrt images/linux
Run the build --sdk command and wait for about an hour.
$ petalinux-build --sdk
Next Step
Comments