Yocto Build System

For generic information on how to setup and use the Yocto BSPs provided by KED, please read the main documentation first.

Repository and Directory Structure

This is how the directory tree with the most important files and directories of the i.MX BSP will look like:

yocto-ktn                   # the core repository
│
├── build-ktn-imx           # the build repository for the i.MX BSP
│   │
│   ├── conf
│   │   ├── repo.conf       # specifies the revisions of all layers
│   │   ├── local.conf      # specifies local settings for the build
│   │   └── bblayers.conf   # specifies all layers that will be parsed by bitbake
│   │
│   └── tmp                 # contains all of the build data
│       ├── deploy
│       │   ├─ images       # contains image files and binaries for the target
│       │   ├─ ipk          # contains packages
│       │   ├─ licenses     # contains licenses of the packages in use
│       │   └─ sdk          # contains SDK and toolchain binaries
│       │
│       └── work
│           └─ ...          # contains all source and build files for the packages
│
├── layers                  # contains all meta layers with recipes
│   │                       # (each one is a git repository)
│   │
│   ├ poky                  # contains the Yocto/Poky build system and meta data
│   ├ meta-openembedded     # contains basic meta layers
│   ├ meta-ktn              # contains basic Kontron adaptations and modifications
|   ├ meta-ktn-imx          # contains Kontron platform adaptations and modifications for i.MX
|   ├ meta-freescale        # contains NXP platform adaptations and modifications
│   └ ...
│
├── scripts                 # contains scripts to automate certain tasks
├── downloads               # contains all the files downloaded by the fetcher# (shared by all builds)
├── sstate-cache            # contains the sstate cache (shared by all builds)
└── init-env                # this is a script to initialize the build environment

Example Setup

This is an example for setting up and running a build for the kontron-mx6ul machine. For more details on each of these steps, please visit the main documentation. For information and examples on your specific hardware, please look in the hardware section.

# move to your working directory
cd ~

# clone the core repository
git clone https://git.kontron-electronics.de/yocto-ktn/yocto-ktn.git

# clone the build repository for NXP i.MX and initialize the build environment
# for the 'kontron-mx6ul' machine configuration.
. init-env -u -m kontron-mx6ul build-ktn-imx

# build an image including the Qt5 libraries and demos for the target hardware
bitbake image-ktn-qt

Modify the BSP

This section provides some examples for modifying the BSP for i.MX. For further general information on how to modify the BSPs, please visit the main documentation. For information and examples on your specific hardware, please look in the hardware section.

Modifying the Kernel Configuration

With Bitbake

# use menuconfig to change the configuration and save them in .config
bitbake virtual/kernel -c menuconfig

# rebuild the kernel (and the image if needed) to test the changes
bitbake virtual/kernel -C compile -f
bitbake image-ktn

# create a reduced defconfig
bitbake virtual/kernel -c savedefconfig

# make the changes persistent by copying the defconfig to your meta-layer
cp ~/yocto-ktn/build-ktn-imx/tmp/work/kontron_mx6ul-ktn-linux-gnueabi/linux-ktn/5.4-r0/build/defconfig ~/yocto-ktn/layers/meta-<customer>/recipes-kernel/linux/linux-ktn/mx6/defconfig

In a 'devshell'

# open a devshell for the kernel
bitbake virtual/kernel -c devshell

# use menuconfig to change the configuration and save them in .config
make menuconfig

# build the kernel to test the changes
make

# create a reduced defconfig
make savedefconfig

# make the changes persistent by copying the defconfig to your meta-layer
cp ~/yocto-ktn/build-ktn-imx/tmp/work/kontron_mx6ul-ktn-linux-gnueabi/linux-ktn/5.4-r0/build/defconfig ~/yocto-ktn/layers/meta-<customer>/recipes-kernel/linux/linux-ktn/mx6/defconfig

Modifying the Kernel Code

# start devtool to create a temporary workspace for the kernel source code
devtool modify linux-ktn

# modify the code and rebuild with
bitbake linux-ktn

# test your changes, create patches if necessary and reset the recipe with
devtool reset linux-ktn