This Article covers the intrinsics of the first of the 3 newly separated workspaces. The introduction was presented in the previous article.
Here, the first workspace, the OS Workspace is covered. The current OS Workspace supports 2 different distributions, each with their own unique flow and advantages. Whereas the Ubuntu flow is simple and easy to use, does the Petalinux flow allow to support a wide range of more advanced features and deepens the understanding of the overall system. Additionally, it allows for more sophisticated solutions with hardened OS or reduced image sizes.
Ubuntu Flow: The original, simple OneThe general flow to acquire an SD card image with a running Ubuntu is still the same as in KRS. This guide therefore starts with a fully prepared SD card and focus on the necessary sysroot setup for the cross-compilation of applications and documents some further caveats for potential problems.
The general code and flow is found inside the KRS Unleashed repo.
The whole flow is automated and can be executed with this command:
./prepare_sysroot.shThis will download the current sysroot from the canonical website, extract it in a separate firmware folder and afterwards install some libraries like ROS 2 or the necessary tracing utility LTTng by applying a patch file to the customize.sh script inside the pulled extracted `bin/` folder.
To further customize the sysroot, simply apply your own changes to a backed-up version of the original customize.sh and then run and replace the old patch file with the new one
diff -u customize_old.sh customize_new.sh > customize.patchThe whole process takes around 10min on my local desktop PC and provides you with a fully working sysroot environment. Its important to note, that the installation of the packages only happened on the sysroot and need to be manually applied on the SD card as well (for example via Ethernet access or copying of the.deb file).
Petalinux is a OpenEmbedded/Yocto Linux-based OS provided by Xilinx/AMD. Petalinux itself is a lightweight wrapper including automatically configured and included layers and a bunch of scripts that simplify the interaction with the OS. Petalinux gives the developer full control of the operating system, but requires a few more artifacts not required for the Ubuntu flow.
The code can be found here:
Depending on your choice of board, the initial step 0 is to design a base platform in Vivado and export and extensible Platform as.xsa file. This file is already provided for the Kria KR260 inside the firmware repo, but can easily be generated in Vivado for different boards following online tutorials.
Afterward, the first step is to install all necessary dependencies including Petalinux and downloading the required BSP file.
Put the BSP file under `firmware_kr260_petalinux/artifacts` and rename the environment variable `BSP_FILE` in `scripts/petalinux.sh`
(for example, current tested version was `xilinx-kr260-starterkit-v2024.1-05230256.bsp`)
Then, execute the script after sourcing a bash terminal:
if everything goes well, you should end with an output like below:
here, you get an instruction where to find your final.wic image to be flashed onto an SD card. The sysroot can now also be created by executing the generated sdk.sh in the directory: `firmware_kria_petalinux/build_petalinux/images/linux/`
for example, the command:
./sdk.sh -d ../../../firmwarewill create the sysroot under `firmware_kria_petalinux/firmware`
Its important to note, that both flows create an OS including a sysroot for cross-compilation that also work outside of ROS 2.
The next article will now focus on the overall example repo structure and how we integrated the OS and Vitis Workflow into KRS Unleashed.







Comments