Three Reasons to Switch from Yocto to PetaLinux

Introduction

At DesignLinx Hardware Solutions, we use PetaLinux to build custom Linux images to support our clients’ tailored products. I must admit, I was skeptical when I first heard about PetaLinux. My professional background is in embedded Linux, having worked on numerous projects that included pure Yocto/Bitbake/OE and integrating Linux on various SoC platforms. Yocto is a practical way to build customized embedded Linux distributions. With its ability to build anything from source files and its highly extensible interfaces, Yocto allows users to create tailored Linux distributions for their products.

The problem is that Yocto is quite difficult to use. Due to its steep learning curve, developing with Yocto can be a daunting and even painful process. Moreover, building a complete image can take several hours depending on the number of packages, especially if you don’t have a quick way to set up the device. However, when I finally started trying PetaLinux for the first time, I was amazed:

Because PetaLinux has many advantages that can rival Yocto, but the learning process is straightforward and the build time is shorter.

Three Reasons to Switch to PetaLinux

PetaLinux is a custom tool built directly on top of the Yocto project, designed for integration with Xilinx platforms. Therefore, in a sense, PetaLinux still belongs to Yocto. However, Xilinx takes it a step further by providing an additional set of tools that simplify the development process, making it extremely convenient for newcomers. There are already numerous guides online regarding this, and I will not delve into specific details here. Instead, I would like to take this opportunity to share with you three key advantages that using this Xilinx tool has brought me.

01

Three Reasons to Switch from Yocto to PetaLinux

Easy to Get Started

As mentioned earlier, building images with PetaLinux is very convenient. You can complete the image build and boot it within an hour just by installing the PetaLinux tool. In the background, it still uses Yocto, so we have great flexibility in custom development. For example, during the project creation process, PetaLinux actually creates a Yocto layer for you using Bitbake “recipes”. While PetaLinux provides a mechanism for creating simple “recipes”, advanced users can also manually customize “recipes” to achieve non-standard features.

02

Three Reasons to Switch from Yocto to PetaLinux

Faster Build Times

When I built my first PetaLinux image, I was surprised to find that it didn’t take hours, but only a few minutes. Build times may vary depending on machine performance and internet connection speed, which I will compare. Our company has a very high-end build server that we use for FPGA synthesis, simulation, and software setup. The pure Yocto build of the “Poky” image “core-image-minimal” took about 30 minutes (including downloads), while the PetaLinux image for the ZCU104 board only took 10 minutes. Although this comparison may not be intuitively accurate, as core-image-minimal is also a fairly compact image, it clearly took longer.

I couldn’t help but wonder: “How did they do it? They must have used SSTATE caching and downloads.” It is evident that this is indeed the approach they took. If you’re not familiar with SSTATE caching, here’s an introduction: SSTATE caching is a cache of Yocto-built “recipes” that can be reused in future builds to help speed up build times. Moreover, if external source “recipes” have also been cached, they won’t need to be downloaded again during the build. This is exactly what Xilinx does, as they provide both of these functionalities in the PetaLinux tool installation package, allowing users to reuse common components and only rebuild truly different components, significantly speeding up the build process.

Three Reasons to Switch from Yocto to PetaLinux

Some cached downloads in the PetaLinux installation package

Three Reasons to Switch from Yocto to PetaLinux

SSTATE cache directory in the PetaLinux installation package

Three Reasons to Switch from Yocto to PetaLinux

Yocto layer for aarch64 in the PetaLinux installation package

03

Three Reasons to Switch from Yocto to PetaLinux

Self-sufficiency and Easy Git Integration

Xilinx has pre-added Git integration features. Using a .gitignore file, new project setup can automatically ignore anything that shouldn’t be under version control (such as build artifacts). Additionally, since most external Yocto layers required for PetaLinux installation are contained within the PetaLinux installation package, these projects are self-sufficient, allowing your entire project’s applications, drivers, device tree customizations, etc., to be retained within a single project/library.

Conclusion

In summary, there are many reasons to use PetaLinux, and I won’t list them all here. Therefore, I must say that even as a seasoned Yocto user, I encourage you to delve deeper into the PetaLinux tool. Because PetaLinux will ultimately save you a lot of time, allowing you to spend more time writing software instead of learning how to use Yocto.

Author: Ken Sloat, Embedded Software Engineer at DesignLinx Hardware Solutions

Three Reasons to Switch from Yocto to PetaLinux
Three Reasons to Switch from Yocto to PetaLinux
Three Reasons to Switch from Yocto to PetaLinux
Three Reasons to Switch from Yocto to PetaLinux
Follow Us

Three Reasons to Switch from Yocto to PetaLinux

Three Reasons to Switch from Yocto to PetaLinux

Scan the code for more details

Three Reasons to Switch from Yocto to PetaLinux

Leave a Comment