yoctoyocto-recipeyocto-layer

Activating distro layer in Yocto


What are the required steps to use a distro layer in Yocto?

Currently, I have the following setup:

meta-my-distro-layer/conf/distro/mydistro.conf:

DISTROOVERRIDES =. "poky:"

require conf/distro/poky.conf

DISTRO = "mydistro"
DISTRO_NAME = "MyDistro"
DISTRO_VERSION = "1.0"
DISTRO_CODENAME = "one"

INIT_MANAGER = "systemd"

meta-my-distro-layer/conf/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 += "meta-my-distro-layer"
BBFILE_PATTERN_meta-my-distro-layer = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-my-distro-layer = "6"

LAYERDEPENDS_meta-my-distro-layer = "core"
LAYERSERIES_COMPAT_meta-my-distro-layer = "kirkstone"

meta-my-distro-layer/recipes-core/images/console-image.bb

DESCRIPTION = "A console-only image"

IMAGE_FEATURES += "ssh-server-openssh"

IMAGE_INSTALL = "\
    packagegroup-core-boot \
    packagegroup-core-full-cmdline \
    ${CORE_IMAGE_EXTRA_INSTALL} \
    "

inherit core-image

IMAGE_INSTALL += "curl"

build/conf/bblayers.conf:

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /my-work-dir/poky/meta \
  /my-work-dir/poky/meta-poky \
  /my-work-dir/poky/meta-yocto-bsp \
  /my-work-dir/poky/meta-my-distro-layer \
  "

I can build the console image defined in that layer, but nothing set in mydistro.conf seems to have any effect on bitbake. According to bitbake -e, DISTRO and INIT_MANAGER never get set to my values and (consequently) trying to set INIT_MANAGER to systemd never takes effect. I can set INIT_MANAGER in conf/local.conf and it takes effect then, but I'd like to do that in a distro layer.


Solution

  • You need to set DISTRO to mydistro in local.conf