Effortlessly Create a BSP Layer Using Yocto-BSP Script

For embedded system developers working with the Yocto Project, creating a Board Support Package (BSP) layer is crucial for customizing and configuring hardware-specific settings. The yocto-bsp script simplifies this process, providing a guided way to set up a BSP layer that works seamlessly with your platform. This guide explains what a BSP layer is, how to create one using the yocto-bsp script, and addresses common concerns.


What is a BSP Layer in Yocto?

A BSP layer in the Yocto Project is a collection of configurations, recipes, and metadata required to support specific hardware platforms. It includes:

  • Bootloader configuration.
  • Kernel settings.
  • Device tree files.
  • Machine configuration files.

The yocto-bsp script automates the creation of a BSP layer, reducing manual effort and errors.


How Does the Yocto-BSP Script Work?

The yocto-bsp script is a command-line tool designed to create a scaffold for a BSP layer. It:

  • Prompts users for input about the hardware platform (e.g., CPU architecture, board name).
  • Generates a structured BSP directory.
  • Includes necessary configuration files to get started.

This script eliminates the guesswork in setting up a new BSP layer and ensures consistency with Yocto standards.


Steps to Create a New BSP Layer Using the Yocto-BSP Script

Creating a BSP layer involves a series of straightforward steps:


1. Set Up the Yocto Environment

Before using the yocto-bsp script, ensure you have a functional Yocto environment:

  • Clone the Yocto Project repository: git clone git://git.yoctoproject.org/poky.git cd poky
  • Source the Yocto build environment: source oe-init-build-env

2. Run the Yocto-BSP Script

  • Navigate to the scripts directory: cd scripts
  • Launch the yocto-bsp script: ./yocto-bsp create <board_name> <architecture> Replace <board_name> with your board’s name and <architecture> with the target CPU architecture (x86, arm, mips, etc.). Setup Icon

3. Follow the Interactive Prompts

The script will ask for details about the platform:

  • Board Name: Name of the target board.
  • Vendor Name: The board’s manufacturer.
  • Architecture: Target architecture (e.g., ARM, x86).
  • Kernel Source: Specify the kernel source path.

Answer these prompts to create a customized BSP layer.


4. Verify the Generated BSP Layer

Once the script completes, it generates a new directory in the meta folder:

  • meta-<board_name>: Contains all machine-specific files.
    • conf/machine/: Machine configuration files.
    • recipes-bsp/: Recipes for bootloader and kernel.

5. Integrate the BSP Layer into Your Yocto Build

  • Add the BSP layer to the bblayers.conf file: bitbake-layers add-layer ../meta-<board_name>
  • Build the Yocto image: bitbake core-image-minimal

Source Code Example

Below is an example of a machine configuration file generated by the yocto-bsp script:

# meta-myboard/conf/machine/myboard.conf
MACHINE = "myboard"
DEFAULTTUNE = "cortex-a9"
TUNE_FEATURES = "armv7a"
PREFERRED_PROVIDER_virtual/kernel = "linux-myboard"

Probable Issues and Their Solutions

  • Issue: Script fails with a “command not found” error.
    • Solution: Ensure you’re in the correct directory and the script has executable permissions: chmod +x yocto-bsp
  • Issue: Generated BSP layer lacks key files.
    • Solution: Double-check input values during the script’s interactive prompts.
  • Issue: Build fails with missing dependencies.
    • Solution: Run: bitbake-layers show-layers Verify all required layers are added.

Why Use the Yocto-BSP Script?

  • Simplifies Setup: Automates the creation of machine-specific layers.
  • Ensures Compliance: Generates Yocto-compliant structures.
  • Saves Time: Reduces manual configuration effort.

Tips for Effective BSP Layer Management

  • Keep Layers Modular: Separate BSP configurations from application-specific layers.
  • Test Iteratively: Validate each component (e.g., kernel, bootloader) during development.
  • Leverage Community Resources: Refer to Yocto documentation and forums for troubleshooting.

An Example : The below steps gives details about how to create a custom BSP layer with yocto,

$ mkdir ~/Desktop/devlab/yocto/metadata/
$ cd ~/Desktop/devlab/yocto/metadata/
$ git clone git://git.yoctoproject.org/poky poky
$ cd poky
$ git checkout -b fido origin/fido

Here, we have used poky / yocto fido version,

$ source oe-init-build-env

You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to use a
different MACHINE (target hardware) or enable parallel build options to take advantage of multiple cores for example. See the file for more information as common configuration options are commented. To add additional metadata layers into your configuration please add entries to this file.

You can now run ‘bitbake ‘

Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
adt-installer
meta-ide-support

You can also run generated qemu images with a command like ‘runqemu qemux86’

<pre>$ yocto-bsp create lynxbee qemu</pre>

Checking basic git connectivity…Done.

Which qemu architecture would you like to use? [default: i386]
1) i386    (32-bit)
2) x86_64  (64-bit)
3) ARM     (32-bit)
4) PowerPC (32-bit)
5) MIPS    (32-bit)
6) MIPS64  (64-bit)

=> We entered 3

Would you like to use the default (3.19) kernel? (y/n) [default: y]

=> We entered y

Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n] [default: y] y

Getting branches from remote repo git://git.yoctoproject.org/linux-yocto-3.19.git…
Please choose a machine branch to base your new BSP branch on: [default: standard/base]
1) standard/arm-versatile-926ejs
2) standard/base
3) standard/beagleboard
4) standard/beaglebone
5) standard/ck
6) standard/common-pc
7) standard/edgerouter
8) standard/fsl-mpc8315e-rdb
9) standard/mti-malta32
10) standard/mti-malta64
11) standard/qemuarm64
12) standard/qemuppc

Would you like SMP support? (y/n) [default: y]

=> We entered y

Does your BSP have a touchscreen? (y/n) [default: n]

=> We entered y

Does your BSP have a keyboard? (y/n) [default: y]

=> We entered y

New qemu BSP created in meta-lynxbee

$ tree meta-lynxbee/
meta-lynxbee/
|– binary
|– conf
|   |– layer.conf
|   `– machine
|       `– lynxbee.conf
|– COPYING.MIT
|– README
|– README.sources
|– recipes-bsp
|   `– formfactor
|       |– formfactor
|       |   `– lynxbee
|       |       `– machconfig
|       `– formfactor_0.0.bbappend
|– recipes-core
|   `– init-ifupdown
|       |– init-ifupdown
|       |   `– lynxbee
|       |       `– interfaces
|       `– init-ifupdown_1.0.bbappend
|– recipes-graphics
|   `– xorg-xserver
|       |– xserver-xf86-config
|       |   `– lynxbee
|       |       `– xorg.conf
|       `– xserver-xf86-config_0.1.bbappend
`– recipes-kernel
`– linux
|– files
|   |– lynxbee.cfg
|   |– lynxbee-preempt-rt.scc
|   |– lynxbee.scc
|   |– lynxbee-standard.scc
|   |– lynxbee-tiny.scc
|   |– lynxbee-user-config.cfg
|   |– lynxbee-user-features.scc
|   `– lynxbee-user-patches.scc
`– linux-yocto_3.19.bbappend

18 directories, 20 files

Here, may be you will need to change conf/bblayers.conf file to point to your newly created meta layer, as

BBLAYERS ?= ” \
~/devlab/yocto/metadata/meta-lynxbee \

Now you can customize the meta layer as per your need, this will give us a framework to work for our own BSP.

Reference : http://www.yoctoproject.org/docs/1.8/bsp-guide/bsp-guide.html#creating-a-new-bsp-layer-using-the-yocto-bsp-script

Leave a Comment