Sundance’s Jack Bonnell gives the detailed steps to add support for Intel RealSense Cameras on the Xilinx Kria KV260 running PetaLinux 2021.1. Jack’s original article can be found on Hackster.IO here.
Installing Petalinux 2021.1
Download the latest PetaLinux from the Xilinx download page: link
Navigate to the downloads folder and install using the executable installer file:
$ cd Downloads
Allow permissions for the installer and run the executable:
$ sudo chmod +x ./petalinux-v2021.1-final-installer.run
$ ./petalinux-v2021.1-final-installer.run -d <install destination>
Download KV260 BSP
Download the KV260 BSP from the Xilinx Downloads page: link
Environment setup
Source the settings.sh file inside of the install directory for PetaLinux:
$ source <install destination>/setting.sh
Create the PetaLinux project from the BSP
Run the following command to create the project using the BSP file we downloaded earlier:
$ petalinux-create -t project -s /home/<user>/Downloads/xilinx-k26-starterkit-v2021.1-final.bsp -n kv260_RealSense
Once created step into the folder:
$ cd kv260_RealSense
Set Board Variant
So PetaLinux knows we’re using the starter kit we need to set the variable using this command:
$ echo 'BOARD_VARIANT = "kv"' >> project-spec/meta-user/conf/petalinuxbsp.conf
Add build essentials package
First we need to bring up the rootfs config console
$ petalinux-config -c rootfs
Once the console has booted up navigate to:
Petalinux Package Groups-->packagegroup-petalinux-self-hosted
Select all 3 packages and exit the console
Fix minor known bugs before build
Navigate to petalinuxbsp.conf
Make sure the your file is identical to the one shown:
Run the following command to run the PetaLinux build process:
$ petalinux-build
Create the SD card image with this command:
$ petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"
The generated image file will be located at images/linux/petalinux-sdimage.wic.
You can now use disk to flash your micro SD card:
Make sure that you increase the size of root to run store librealsense.
Booting the KV260 Board
Connect the board to your computer using serial.
Using the login: Petalinux, the first time you will be asked to create a new password, once this is done the shell will start
use the following command to install missing librarie:
$ sudo dnf install libxinerama-dev
Installing Librealsense
In the root clone the librealsense git repository:
$ git clone https://github.com/IntelRealSense/librealsense
next install udev rules:
$ sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules && udevadm trigger
Create build folder:
$ mkdir build
$ cd build
Run Cmake from the build folder
$ cmake ..
Next run Make to start compiling librealsense:
$ make
Once compiled, install librealsense:
$ make install
Running a RealSense Camera:
Export the LD_LIBRARY_PATH to access the compiled RealSense Libraries:
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64/"
Now plug in and test your camera works using rs-enumerate-devices: