Customizing the BSP

This page describes how to add your custom layer to our Zeus Mainline BSP. You will also get an idea how a Yocto recipe works and how you can create your own image.

Your possibilities with Yocto are endless - if you know how to use it. The sections below shall just give common examples and an easier entry.

Further information can be found in the Yocto Project Mega-Manual.

Hint

All below commands are examples and have to be fitted to your needs.

Setup your build-directory with the desired machine and distro like explained in Building TX6/TXUL Series or Building QSMP/TXMP Series.

DISTRO=karo-minimal MACHINE=qsmp-1570 source setup-environment build-qsmp-1570

Kernel & Devicetree

The following steps describe how Kernel and Devicetree can be modified.
You can use these steps to develop Kernel and Devicetree fitted to your needs.
Once you’re done you can read further to persist your changes.

Entering Devshell

  1. Configure Kernel with the current defconfig
bitbake linux-karo -c configure
  1. Enter Devshell
bitbake linux-karo -c devshell

Note

In the devshell you are inside the already patched and configured Kernel source, with a working cross-compile environment.

Building Kernel

Building the Kernel inside the devshell:

make uImage LOADADDR=<kernel-loadaddr>
Module LOADADDR
TXMP/QSMP 0xc0008000
TX6 0x10008000
TXUL 0x80008000

Note

The console output will tell you the build directory it left. Inside it at arch/arm/boot/uImage you’ll find your Kernel.

Devicetree

.dts(i) files are located in arch/arm/boot/dts/.

Note

For your own hardware add your own *.dts files.

To compile a specific devicetree run:

make <dts-file-name>.dtb

Note

The console output will tell you the build directory it left. Inside it at arch/arm/boot/dts/ you’ll find the compiled dtb files.

Create Custom Layer

Use bitbake-layers to create a new layer.

bitbake-layers create-layer ../layers/meta-custom

This creates an empty example layer for you:

../layers/meta-custom/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-example
    └── example
        └── example_0.1.bb

3 directories, 4 files

To make your layer available, add it to conf/bblayers.conf inside your build-directory.

BBLAYERS = " \
  (...)
  \
  ${BSPDIR}/layers/meta-karo \
  ${BSPDIR}/layers/meta-karo-distro \
  \
  ${BSPDIR}/layers/meta-custom \
"

Append Kernel Recipe

You can remove the recipes-example folder inside your custom layer. Instead add a folder recipes-kernel with different subdirectories.

rm -rf ../layers/meta-custom/recipes-example/
mkdir -p ../layers/meta-custom/recipes-kernel/linux/linux-karo/patches
mkdir ../layers/meta-custom/recipes-kernel/linux/linux-karo/stm32mp1

The directory stm32mp1 comes from MACHINE=qsmp-1570 and is used by it’s MACHINEOVERRIDES.
Depending on the MACHINE you use, the folder structure differs. See our meta-karo layer structure as reference.

Now create the *.bbappend file to extend the kernel recipe.

touch ../layers/meta-custom/recipes-kernel/linux/linux-karo_%.bbappend

The content of linux-karo_%.bbappend could be something like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/patches:${THISDIR}/${PN}:"

SRC_URI_append = " \
     file://${KBUILD_DEFCONFIG} \
     file://0001-custom-magic-kernel-source.patch \
"

SRC_URI_append_stm32mp1 = " \
     file://dts/stm32mp157c-qsmp-1570-customboard.dts;subdir=git/arch/arm/boot \
"

KERNEL_DEVICETREE_append_qsmp-1570 = " \
     stm32mp157c-qsmp-1570-customboard.dtb \
"

The files in your custom-layer then would look like this:

../layers/meta-custom/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel
    └── linux
        ├── linux-karo
        │   ├── patches
        │   │   └── 0001-custom-magic-kernel-source.patch
        │   └── stm32mp1
        │       ├── defconfig
        │       └── dts
        │           └── stm32mp157c-qsmp-1570-customboard.dts
        └── linux-karo_%.bbappend

7 directories, 7 files

Tip

Build your modified Kernel Recipe.

bitbake linux-karo

This will compile and deploy your modified Kernel and additionally the Devicetree you added.

Note

The way you expanded our kernel recipe, you can customize any recipe inside the BSP. You can use our layers as a reference if unsure what you can do.

You can also add any new recipe.

Create Custom Image

To add a custom image you can add a new recipe under recipes-core/images. Your custom layer will then look like this:

../layers/meta-custom/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
├── recipes-core
│   └── images
│       └── custom-image.bb
└── recipes-kernel
    └── linux
        ├── linux-karo
        │   ├── patches
        │   │   └── 0001-custom-magic-kernel-source.patch
        │   └── stm32mp1
        │       ├── defconfig
        │       └── dts
        │           └── stm32mp157c-qsmp-1570-customboard.dts
        └── linux-karo_%.bbappend

9 directories, 8 files

The custom-image.bb below would include the karo-image-weston as basis and additionally add the pip3 python package manager.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
SUMMARY = "A custom image with Weston desktop"

require recipes-core/images/karo-image-weston.bb

IMAGE_INSTALL_append = " \
                       python3-pip \
"

python extend_recipe_sysroot_append() {
    if d.getVar('DISTRO') != 'karo-wayland':
        raise_sanity_error("cannot build 'custom-image' with DISTRO '%s'" % d.getVar('DISTRO'), d)
}

Tip

Build your custom image.

bitbake custom-image

With this example you would get the desired weston desktop image with included pip3.