Yocto Project Development Tools: A Guide

Yocto Project Development Tools: A Guide

Click the blue words to follow us

Bui~’s new chapter will bring everyone some useful development tools, to save effort for the cows and horses, plow more fields, and pull more carts to improve efficiency and get off work early.

The Yocto project is used to integrate resources to compile embedded Linux systems, such as Qualcomm’s Linux (like QCS6490, QCS610, etc.) or Synaptics’ Astra platform (like SL1680, SL1640, etc.), which are compiled using Yocto. There are many related learning materials online, and I won’t elaborate further here. This project uses bitbake as the compilation tool, requiring knowledge of related syntax. Currently, neither Yocto nor bitbake provides graphical interface software or development platform software, so all operations must be performed via the command line. Therefore, reading Yocto project code, finding definitions of related content, and remembering some commands can be quite time-consuming and labor-intensive.

VSCode has a Yocto plugin that can effectively solve the above problems.

First, you need to install this plugin in VSCode (my project is on another computer, so it needs to be installed on the remote computer as well):

Yocto Project Development Tools: A Guide

After installing the plugin, you need to set the Yocto directory and bitbake-related configurations, which mainly include the following parameters (taking Synaptics’ Astra SDK as an example, where ${workspaceFolder} refers to the path of the currently opened folder in VSCode):

  • Bitbake: Command Wrapper

When using the bitbake command, you need to use some pre-command instructions, which can be placed here, such as commands to enter the docker environment.

Example: docker run –rm -it -v ${workspaceFolder}/sdk:${workspaceFolder}/sdk ghcr.io/synaptics-astra/crops:1.0.0 –workdir=${workspaceFolder}/sdk /bin/bash -c

  • Bitbake: Path To Bitbake Folder

Here, you need to fill in the tool path of bitbake in the Yocto project.

Example: ${workspaceFolder}/sdk/poky/bitbake

  • Bitbake: Path To Env Script

When compiling a Yocto project, it is generally necessary to set environment variables. Here, you fill in the script path, which will automatically run the script to set up the environment variables when starting the project.

Example: meta-synaptics/setup/setup-environment build-sl1640

There are other settings that can be configured according to everyone’s needs.

After completing the settings, VSCode will immediately parse the Yocto project, and the terminal below will display logs scanning the recipes. After parsing, the status bar below will show the number of recipes found.

Yocto Project Development Tools: A Guide

In the VSCode sidebar, click the Yocto icon to see two empty work areas. If you want to view or modify the relevant content of a certain recipe, you can add this recipe to the first area, and it will find the bb file and bbappend file of this recipe.

Yocto Project Development Tools: A Guide

Here, you can operate like reading code, making it easy to find variable definitions or references, function definitions, or inherited package definitions, with syntax highlighted in different colors for easy viewing. At the same time, some bitbake operations can be performed through the graphical interface, eliminating the need to remember commands.

Those familiar with Yocto should know that Yocto does not display most source code files to simplify the file structure. If you want to view or modify the source code of a certain component, you need to use another tool—devtool. Devtool can help you modify the code and create corresponding patches or layer files and automatically add them back to the Yocto project. You only need to choose the modify option in the corresponding recipe.

Yocto Project Development Tools: A Guide

In the second work area, the corresponding code project will appear. After modifying, integrate the modifications into Yocto as needed.

Yocto Project Development Tools: A Guide

Using this software to view and modify the Yocto project can be very efficient, and you don’t need to remember those cumbersome commands. ๑乛◡乛๑

FAQ

Q1: What is a recipe?

A1: A recipe is a file used in Yocto to describe how to build a software package.

Q2: How to view the parsing logs of the Yocto project?

A2: After setting up the Yocto plugin in VSCode, the terminal will display the parsing logs.

Q3: Where can I find the official documentation for the Yocto project?

A3: The official documentation for the Yocto project can be found on its official website.

Q4: What is a layer file?

A4: A layer file is a hierarchical structure in the Yocto project used to organize and manage different build components.

Q5: How to create patches in the Yocto project?

A5: You can create patches using devtool and automatically add them to the Yocto project.

Yocto Project Development Tools: A Guide
Yocto Project Development Tools: A Guide

Click Read the original text to ask questions/comments, obtain technical documents, and get more information!

Leave a Comment