cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Partner: Three Key Benefits of PetaLinux

xtech-blogs
Xilinx Employee
Xilinx Employee
2 0 1,695

Editor’s Note: This content is contributed by Ken Sloat, Embedded Software Engineer at DesignLinx Hardware Solutions, Inc.

 

Introduction

At DesignLinx Hardware Solutions, we use PetaLinux to create custom Linux images in support of our customer’s custom Xilinx based products. When I first heard about PetaLinux, I will admit it; I was skeptical. I come from an embedded Linux background and have done numerous projects involving pure Yocto/Bitbake/OE and integrating Linux within different SoC platforms. Yocto is a great way to create a custom embedded Linux distribution. From building everything from source to its super extensible interface, Yocto allows users to create a custom Linux distribution for their products.

The problem is that Yocto is hard. There is quite a steep learning curve that can make adopting it tough if not painful. Additionally, without a speedy build machine, full images can often take many hours to build (depending on the number of packages). When I finally tried to use PetaLinux, I was pleasantly surprised. It seemed to have many of the advantages of Yocto without the learning curve and build time.

 

PetaLinux Advantages

For a moment, let’s step back and review what PetaLinux really is. PetaLinux is a set of custom tools built directly on top of the Yocto project to integrate with Xilinx’s platforms. So, in a sense, PetaLinux is still Yocto, but Xilinx has gone the extra mile and made it super easy to get started by providing an additional set of tools to simplify the process. I won’t go into the internals, as there are plenty of other guides that do so, but I wanted to take a moment to highlight some of the immediate advantages that stood out to me in using this Xilinx tool.

 

Easy to Get Started

As I mentioned before, with PetaLinux, it is super easy to get started building an image. Simply install the PetaLinux tools, and in potentially less than an hour, you can be building and booting an image. Remember, under the hood. It is still using Yocto, so we still have a lot of flexibility in doing something custom. For example, as part of the project creation process, PetaLinux actually makes you a Yocto layer with Bitbake “recipes.” While they provide the mechanisms to create simple recipes, for the more advanced user, there is nothing to stop you from manually customizing this yourself to do something out of the box.

 

Accelerated Build Time

When I built my first PetaLinux image, I was surprised to find out it did not take hours but rather minutes. I’ll make a comparison as build time can vary based on machine power and internet connection. Our company has a pretty hefty build server that we are able to use for both FPGA synthesis, simulation, etc., as well as software builds. A pure Yocto build of the “poky” image “core-image-minimal” took about 30 minutes (with downloads), while a PetaLinux image for a ZCU104 board took only 10 minutes. While these are not apples to apples comparisons, core-image-minimal is also quite a compact image yet it took significantly longer.

“So how do they do this?” I wondered - “They must be using a cached SSTATE and downloads.” Sure enough, that’s exactly what they do. If you don’t know, SSTATE cache is a cache of Yocto built recipes that can be utilized in future builds to help speed them up. Additionally, if downloads are cached for recipes for external sources, this negates the need to re-download at build time. Xilinx has done exactly that by providing both of these in their PetaLinux tools installation. This allows users to significantly accelerate builds by reusing common components and only rebuilding what is actually different.

Some of the cached downloads in the PetaLinux installationSome of the cached downloads in the PetaLinux installation

 

SSTATE cache directory in the PetaLinux installationSSTATE cache directory in the PetaLinux installation

Yocto layers for aarch64 in the PetaLinux installationYocto layers for aarch64 in the PetaLinux installation

 

 

Self-Contained and Easy Git Integration

Xilinx has added Git integration aforethought. A new project is automatically setup with a .gitignore file to ignore anything that shouldn’t be version controlled (build artifacts, etc). Additionally, since most of the external Yocto layers it relies on are contained in the PetaLinux installation itself, the projects are very self-contained, and your entire project application, drivers, device-trees customization, etc., can all live within a single project/repository.

 

Conclusion

In closing, there are a lot of reasons you should use PetaLinux, and this post can’t cover them all. I will say this though, even for the seasoned Yocto user, I encourage you to take a more in-depth look into the tool. PetaLinux could save you a lot of time in the end and allow you to spend more time writing software rather than figuring out how Yocto works.