Hi all !Hope everyone is well.
This is the second post regarding my experience with the Xilinx Kria KV260 Vision AI Starter KIT
For more information and the first POST, read it here
Today was the day to learn how to install the software and prepare the KV260 for the next steps.
I'm going to try both images available for the KV260 - PetaLinux and Ubuntu.
Because I always loved to be on the bleeding edge, I've decided to download and use the latest versions. If they are available and are not beta version, let's use them.
All the documentation and tutorials that I've seen and read are all for previous versions. Because of that, strap on and let's go for a ride. This is going to be wild...
According to the Wiki, for the latest Linux images - Ubuntu 22.04 LTS or PetaLinux, a firmware upgrade is needed. Let's first download the boot update
At this point, I don't know how to upgrade the firmware . I've been reading and there are some utilities that do this, but still don't know if I can use the PetaLinux latest version and upgrade the firmware from there, or if I need to download a previous version, upgrade the boot firmware and then use the latest PetaLinux .
I'll download the latest version of PetaLinux and see if it boots. If it boots, I will use the xmultil bootfw_update utility to update the boot firmware.
I had to dig a bit because when downloading the PetaLinux image, this was a format I never had seen before. But it turns out, it's just like a img and can be used with dd or any other software to write images to a SDCARD
I've downloaded the 2022.1 version - petalinux-sdimage_xilinx-k26-starterkit
The PetaLinux file is big,6.0GB and it's now being written to the SD CARD - a 32GB one.
After so, many, minutes, all was done
Let's put it in and power on the device
First boot and PetaLinux
At first, nothing appear on the screen. No HDMI image. Decided to try the DisplayPort. Still no image. What was going on ? I confess that the instructions for booting the PetaLinux are not clear or I didn't find any documentation on how to do it. This was my first time with it.
Decided to read about the Ubuntu installation - it's bit more complete.
After reading the documentation, I've connected the USB port to the computer and something appeared on the logs.
So many ttyUSB...
Configuring my minicom with the recomended settings: 115200,8,n,1,N
At first, I've tried all the serial ports and nothing. No prompt, nothing. Turning it off and on again, with ttyUSB2, ttyUSB3 and ttyUSB0, nothing. just a line on the screen.
Decided to try ttyUSB1 and finally something was appearing on the terminal. A Linux booting.
But, it didn't work. A lot of errors and no prompt. I'm assuming that this is because I haven't yet upgraded the firmware to allow me to use the latest version.
So, I decided to download the previous version - Kria Starter Kit 2021.1 and see if it would boot so I could upgrade the firmware and be able to boot the lastest version available.
Inserted the SD Card in the KV260 and let's try it again
This time it worked and I have a full Linux ready.
To upgrade the firmware, I just followed the instructions.
Having now a network connection and a user and password, it's easy.
Copy the downloaded firmware (insert link) to the KV260
scp BOOT_xilinx-k26-starterkit-v2022.1-09152304_update3.BIN petalinux<at>192.168.2.228:
Inside the terminal:
sudo xmutil bootfw_update -i BOOT_xilinx-k26-starterkit-v2022.1-09152304_update3.BIN
After the reboot, validate the boot
sudo xmultil bootfw_update -v
And that's that.
After a successful reboot, having a terminal and the boot firmware upgraded, let's try the latest PetaLinux version.
Again, put the image on the SD Card. Again, wait an endless time for the copy...
Let's put the SD Card in the KV260 and turn it on.
This time, the terminal just went until a login screen appeared - but not here (on the debug terminal - ttyUSB1)
I had to connect a USB keyboard to be able to login. This time I had image from the HDMI display. Hurray.
After the full upgrade and a reboot, let's try some of the APPS already available for the KV260.
The Kria Applications - or AA.
After a lot of reading on why I can't find the SmartCamera APP (or any other APP for that matter), finally I found some post on the Xilinx forums saying that the APPs are going to be released in a future time..
As of 2022 there's no packages available to download with xmutil .. Nothing shows when doing xmultil getpkgs. All the documentation I've seen was for previous versions.
After reading and reading, I'm guessing I need to - install Ubuntu or create a PetaLinux image with the APP already there.
After some more reading about creating a PetaLinux image, I've decided to give a go to Ubuntu. After perusing through the documentation, I'm guessing that Xilinx (AMD) is really betting on Ubuntu and on the relationship with Canonical.
After downloading the Ubuntu image, let's decompress it and put it in the SD Card. Tea time
It's already in the SD CARD, lets try and boot it.
After a boot, I have a full Ubuntu desktop on the HDMI monitor and a remote ssh to it.
Don't tell anybody, but it's a tad slow. But, nothing that I wasn't expecting.
Let's try to run some examples.
According to the documentation, an upgrade is recommended and after that, install the Xilinx Development & Demonstration Environment.
sudo snap install xlnx-config --classic --channel=2.x
Now let's wait until all is done
Next, we need to run xlnx-config.sysinit to install some PPAs
Yes we do. Answer yes to all the questions .
After a while we get all the repositories installed - the ones with the applications for us to test.
And another upgrade is done.
After a reboot, let's search for the AAs
sudo apt search kv260
And, finally some results
Let's install the SmartCam app
sudo apt install xlnx-firmware-kv260-smartcam
And after a while, we have it installed.
Let's try and run it
First, we need to disable the desktop environment
sudo xmutil desktop_disable
Next, see the apps listed with xmutil
sudo xmutil listapps
And it's there
Now, we need to unload the current app loaded and load the smartcam app
sudo xmutil unloadapp
remove from slot 0 returns: 0 (Ok)
sudo xmutil loadapp kv260-smartcam
Now that the APP is loaded.
After a few minutes trying to find the application binary, nothing.
Since this was a full Linux with Ubuntu apps, installed a small utility - mlocate - that creates a database with all the files and the location, making it really easy and fast to search for something. The downside is that from time to time you need to update the database. But I've decided to give it a go.
After creating the database, decided to search for the app or files and/or directories with the name
Nothing relevant. What was going on ? Was the documentation wrong ?
After a lot more reading and reading and reading, it turns out that as of Ubuntu 22.04 for the KV260, applications are deployed as Docker containers.
I'm starting to think that the bleeding edge is not wort it !
Let's install docker, shall we ?
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Run the hello-world
sudo docker run hello-world
Now that we have docker, let's add our user to the group
sudo usermod -a -G docker ubuntu
Let's continue with the Smartcam. Pull the latest version
docker pull xilinx/smartcam:2022.1
After a moment, the image is downloaded and extracted.
Let's launch the docker image
docker run \
-h "xlnx-docker" \
-v /tmp:/tmp \
-v /dev:/dev \
-v /sys:/sys \
-v /etc/vart.conf:/etc/vart.conf \
-v /lib/firmware/xilinx:/lib/firmware/xilinx \
-v /run:/run \
-it xilinx/smartcam:2022.1 bash
and you get this:
So far, so good, I'm guessing
Let's run the application in the command line. You can also run a jupyter notebook. View the documention.
I'm going to use the IAS camera and output to the HDMI monitor
smartcam --mipi -W 1920 -H 1080 --target=dp
And now with the USB camera (Raspberry PI camera v2)
smartcam --usb 1 -W 1920 -H 1080 --target=dp
Clearly there's a difference between the two cameras.
Well, for Ubuntu it's all done. For now.
PetaLinux - second Go
I like Ubuntu, but is way to heavy for this.
I knew that I could use PetaLinux - Ubuntu is great, but I've always been a CLI person. After a lot of reading and almost desperation, I found a page on the Xilinx github.io that explains how to build PetaLinux with the Application Packages - because all the videos I've seen and pages that read, mostly on Hackster.io mention building the PetaLinux and using bsp files.
NOTE: The documentation is for the 2021.1 version. Still, let's give it a shot.
The getting started videos from the Xilinx website are all in the 2021 version and the apps are all there... But for this PetaLinux version - 2022.1 - they are not.
So, let's get started
First, we need to install the PetaLinux tools, latest version from here. This an installer and will do everything.
We also need to download the Kria K26 Starter Kit Board Support Package - the BSP file for the KV260
Let's install everything needed (I'm using Arch Linux). The installer complains about xterm and netstat .
sudo pacman -S xterm net-tools
and now we can start
./petalinux-v2022.2-10141622-installer.run -d <your directory of choice for the instalation>
After a while, it says its done.
This is the contents of the directory
Now, activate the environment by running settings.sh (you may have to give it execution permissions first)
I don't have a tftp server, but let's continue.
Now, we need to create a project using the bsp file we downloaded before (copy it to installation directory of PetaLinux)
petalinux-create -t project -s xilinx-kv260-starterkit-v2022.2-10141622.bsp
and in a moment:
INFO: Create project:
INFO: * xilinx-kv260-starterkit-2022.2
INFO: Has been successfully installed to /home/feiticeir0/petaLinux/
INFO: New project successfully created in /home/feiticeir0/petaLinux/
Let's go into the project directory
Before we build the image, we want to add the AAs just for testing
Let's add some strings and variables
echo 'BOARD_VARIANT = "kv"' >> project-spec/meta-user/conf/petalinuxbsp.conf
Now, let's add the application groups that we want into the rootfs config file so that the menuconfig gets populated with these entries.
echo 'CONFIG_packagegroup-kv260-smartcam' >> project-spec/meta-user/conf/user-rootfsconfig
echo 'CONFIG_packagegroup-kv260-aibox-reid' >> project-spec/meta-user/conf/user-rootfsconfig
echo 'CONFIG_packagegroup-kv260-defect-detect' >> project-spec/meta-user/conf/user-rootfsconfig
echo 'CONFIG_packagegroup-kv260-nlp-smartvision' >> project-spec/meta-user/conf/user-rootfsconfig
Let's run the petalinux rootfs config
petalinux-config -c rootfs
If you get an error about libtinfo.so.5, just go into /usr/lib and create a symlink from libtinfo.so.6 to libtinfo.so.5 and it will work .
Now, go into user packages and select all the AAs
Exit and save the configuration
Let's create the image
The following commands build the image and package it.
Building the Petalinux image get's all my CPUs almost at 100%
But my temperature is well ! Water cooling for the win !
But it didn't work...
Lets see the log...
And the errors are:
Well, this where I'm at right now.
If there's any update, I'll post it here.
But, there's not stopping now.
I still have to learn how to develop applications and deploy them here. What are my options about the software. Next posts.
I have some weird behavior with the KV260. Every time I connect and, for example, disable the desktop to try the SmartCam APP, it changes the IP address. Like you see in the picture, I've already went through all those IP addresses.
And sometimes Ubuntu doesn't boot. I have to turn it off and on again to have some picture... Weird stuff that I'm going to try to solve.
Oh, this has been a roller coaster.
Until the next post.