-
Notifications
You must be signed in to change notification settings - Fork 0
Yocto Layer for Odin Control
The Yocto recipe layer is a directory that specifies how the application-specific code should be baked into the Linux image. The is combined with general layers for the hardware provided by the vendor, as well as additional layers for supporting the LOKI infrastructure. In a typical LOKI application repository, this layer is used to create recipe derived from an odin-control base recipe to install the custom adapter into the image such that resources end up in a predictable place, and everything is executed automatically.
A good example of how this can work is in the BabyD repository.
- Create the parent directories from your project root. The name
meta-<project>is just a convention, but the other directories and files must have the same names to overlay properly.
mkdir meta-<project>
cd meta-<project>mkdir conf
touch conf/petalinuxbsp.conf
touch conf/user-rootfsconfig
touch conf/layer.conf- Edit the main config file.
layer.confdescribes the contents of this layer as well as how it overlays. These settings should work fine, but remember to replace "" with whatever your project's name is.
# layer.conf
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "<project>"
BBFILE_PATTERN_<project> = "^${LAYERDIR}/"
BBFILE_PRIORITY_<project> = "9"
LAYERVERSION_<project> = "1"
LAYERSERIES_COMPAT_<project> = "zeus"-
Create an odin-detector recipe instance (see Creating a Recipe for an Odin-Control Instance), by convention called
<project>-detector. -
Add the recipe name to the
layer.confso that it will always be brought into the Linux image without being a dependency.
IMAGE_INSTALL_APPENDS = " <project>-detector"- Update your repository environment file to include the location of the new user layer (see Repository Configuration Files for more information). In
repo.env:
yocto_user_layer_0=$(shell pwd)/meta-<project>An instance of odin-control is the combination of odin-control adapter(s), configuration files(s), sequences for odin-sequencer (optional) any other supporting files.
To make this easier -and to standardise installation locations- a base recipe from which application-specific recipes can be derived has been created.
This means that everything to do with automatically starting the process, system outputs and static resource target locations are all handled.
This guide assumes that you have already created an odin-control adapter for your project, and that it is present in the repository's /control directory, or is in another known repository.
The recipe must be created inside a subdirectory recipes-apps in the user layer. This step takes place assuming the user is CD'ed into /meta-<project>/
mkdir recipes-apps
mkdir recipes-apps/detector
cd recipes-apps/detectorCreate a directory for any files that the recipe will need to import later:
mkdir filesCreate the recipe file itself (update the name to match your project):
touch <project>-detector.bbIf your control code is in the current repository, create a relative symlink to it (if your control code is in a repository, skip this step).
This way, the logic for moving the control software into the image is kept in the Yocto layer, and the control software is in the toplevel with no required knowledge of how this is done, making it easier to work in in isolation.
ln -s ../../../../control files/controlEdit the recipe file <project>-detector.bb, initially creating it from this template:
inherit odin-control-instance
RDEPENDS_${PN} += " python3-tabulate"
RDEPENDS_${PN} += " odin-control (=1.5.0)"
SUMMARY = "This is a recipe for the BabyD Odin-Control Instance"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
# The react UI tag is a separate repository, used to download pre-built static assets
# This will only accept tags that have been built (releases)
REACT_UI_TAG = "v0.0.4"
REACT_SOURCE_PATH = "babyd-ui-${REACT_UI_TAG}"
SRC_URI = "file://control/static \
file://control/sequences \
file://control/config/config.cfg \
file://control/* \
https://github.com/stfc-aeg/babyd-ui/releases/download/${REACT_UI_TAG}/build.zip;subdir=${REACT_SOURCE_PATH};name=react-build-zip \
"
SRC_URI[react-build-zip.md5sum] = "4d7a8b16f7f8c6848335bad367581d0f"
# This has to be in the format expected in Yocto's license list...
LICENSE = "CLOSED"
S = "${WORKDIR}/"
# Used to specify the repository location of setup.py
DISTUTILS_SETUP_PATH = "./control"
# Relative repository locations of standard resources
REPO_STATIC_PATH = 'control/static/'
REPO_SEQUENCES_PATH = 'control/sequences/'
REPO_CONFIG_PATH = 'control/config/config.cfg'
# include the rootfs build directory locations in the yocto rootfs on exit
FILES_${PN} += "${base_prefix}/opt/loki-detector/*"