Build#
Clone the BSP Repository#
First of all you need a local copy of the BSP repository. This can be either
meta-ked-bsp or a custom layer. This guide will use the public meta-ked-bsp
BSP repository to build images for our standard and demo hardware.
cd ~
git clone https://git.kontron-electronics.de/sw/ked/meta-ked-bsp.git
cd meta-ked-bsp
Use the Menu to Configure (Recommended)#
kas command
In the following we will use the kas-container script to build inside of a
container. If you do native builds, you can use the kas command directly
instead.
Run the menu command:
kas-container menu
Navigate through the menu using UpDown and select the options you need using Space.
Afterwards use Tab to navigate to the button menu, select "Save & Build", "Save & Exit" or "Exit" using LeftRight and confirm with Enter.
The configuration is saved to .config.yaml which is excluded from being
tracked in Git.
The configuration in .config.yaml will mainly consist of references to other
configuration files in the kas subdirectory.
Kontron Electronics kas Container Images
kas-container itself provides maintained container images with integrated
kas tools. These images are well suited to build Yocto images.
Nevertheless they may lack some tools for special use cases.
Therefore Kontron Electonics provides extended kas container images which contain all tools to build the Kontron demo images. They are used for our CI and release builds.
The public container registry URI for BSP builds is
registry.kontron-electronics.de/sw/ked/meta-ked-bsp.
The KAS_CONTAINER_IMAGE environment variable can be set to use a non
standard container image. For example to use a Kontron Electronics
provided image suited to build the BSP version 7.0:
export KAS_CONTAINER_IMAGE="registry.kontron-electronics.de/sw/ked/meta-ked-bsp/kas-ked:5.2"
Run the Build#
If you selected "Save & Build" in the configuration menu, a build will be started automatically. Otherwise you can start a build with:
kas-container build .config.yaml
Now kas will fetch all repos specified in the configuration, initialize the
build environment and launch bitbake.
Select Configuration Files Manually#
Instead of using the menu command and creating a .config.yaml you can also
select the existing configuration file(s) manually.
The following command produces the same result as when selecting the option "Kontron Electronics SL/BL/OSM i.MX8MM" via the menu.
kas-container build kas/ked-mx8mm.yml
Using the shell Command#
Instead of using the build command to start bitbake, you can also use the
shell command to instruct kas to drop you to a shell inside the build
environment.
kas-container shell .config.yaml
Once inside the shell, you can run any bitbake command you like.
Best Practices#
To build the Kontron Electronics BSP, we made the best experiences with
podman as container runtime.
kas-container and the podman container runtime environment has some
command line options which eases some development tasks.
This is what works fine in our CI pipelin for the BSP 7.x series:
export KAS_CONTAINER_ENGINE=podman
export KAS_CONTAINER_IMAGE="registry.kontron-electronics.de/sw/ked/meta-ked-bsp/kas-ked:5.2"
kas-container build
If you also want to use this container for development use, the following additions might be helpful:
# Starts an interactive bitbake environment with the users ssh keys.
# This is helpful when git commands with ssh protocol should be performed in the
# bitbake environment. Additionally the /mnt/mirrors directory is shared between
# the development host and the container runtime. This can be used to provide a
# shared sstate cache and dowonload mirror across various builds
# Remark: For this additional yocto settings are required!
kas-container --ssh-agent --ssh-dir ${HOME}/.ssh --runtime-args "-v /mnt/mirrors:/mnt/mirrors" shell
# Shell alias for the rather long kas-container command and its command line options
alias kasc="kas-container --ssh-agent --ssh-dir ${HOME}/.ssh --runtime-args \"-v /mnt/mirrors:/mnt/mirrors\""