Friday, January 26, 2024

Yocto notes - 1

Follow the yocto documentation to setup poky. I'm using kirkstone branch. Some details might vary depending on the branch. Always refer to the branch documentation.


How bblayers.conf and local.conf are created in the build directory
====================================================================

- you can see this when you create the build for the first time

- meta-poky/conf/ has the bblayers.conf.sample and local.conf.sample files

- scripts/oe-setup-builddir uses these to create the bblayers.conf and local.conf in your build directory's conf/

- and, oe-setup-builddir spits out this info

- see the following example

- meta-poky/conf/ also has conf-notes.txt, which oe-setup-builddir uses to show you info about the targets etc. at the end

- local.conf.sample.extended has more configs you can add to the local.conf

 

dld@dld:~/yocto/poky$ ls meta-poky/conf/ -F
bblayers.conf.sample  conf-notes.txt  distro/  layer.conf  local.conf.sample  local.conf.sample.extended  site.conf.sample


dld@dld:~/yocto/poky$ source oe-init-build-env ../build-test
You had no conf/local.conf file. This configuration file has therefore been
created for you from /home/dld/yocto/poky/meta-poky/conf/local.conf.sample
You may wish to edit it to, for example, select a different MACHINE (target hardware). See conf/local.conf for more information as common configuration options are commented.
You had no conf/bblayers.conf file. This configuration file has therefore been created for you from /home/dld/yocto/poky/meta-poky/conf/bblayers.conf.sample
To add additional metadata layers into your configuration please add entries to conf/bblayers.conf.
The Yocto Project has extensive documentation about OE including a reference manual which can be found at:
    https://docs.yoctoproject.org
For more information about OpenEmbedded see the website:
    https://www.openembedded.org/
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
    core-image-minimal
    core-image-full-cmdline
    core-image-sato
    core-image-weston
    meta-toolchain
    meta-ide-support
You can also run generated qemu images with a command like 'runqemu qemux86'
Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks


- let's see what's in our build directory's conf/ ,and the contents of conf/bblayers.conf. conf/local.conf is too big to show here, check its contents yourself 


dld@dld:~/yocto/build-test$ ls conf/
bblayers.conf  local.conf  templateconf.cfg


dld@dld:~/yocto/build-test$ cat 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 ?= " \
  /home/dld/yocto/poky/meta \
  /home/dld/yocto/poky/meta-poky \
  /home/dld/yocto/poky/meta-yocto-bsp \
  "


But, why/how does it use meta-poky/conf/ in the first place?
============================================================

- for details, see documentation/ref-manual/structure.rst and scripts/oe-setup-builddir

- a brief explanation follows

- as we saw in the previous listing, our build directory has a conf/templateconf.cfg

dld@dld:~/yocto/build-test$ cat conf/templateconf.cfg 

meta-poky/conf

- poky has a .templateconf

dld@dld:~/yocto/poky$ cat .templateconf
# Template settings
TEMPLATECONF=${TEMPLATECONF:-meta-poky/conf}

- build directory's conf/templateconf.cfg is created by scripts/oe-setup-builddir like this:

. "$OEROOT"/.templateconf
if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
    echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"
fi

. "$OEROOT"/.templateconf is the same as source "$OEROOT"/.templateconf

- now, the bblayers.conf.sample etc. are picked from meta-poky/conf

if [ -n "$TEMPLATECONF" ]; then
    :
    OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
    OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
    OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
fi

- however, if $TEMPLATECONF is empty, $OECORELAYERCONF etc. will be empty, so, those files are picked from meta/conf/

- for example, in scripts/oe-setup-builddir

if [ -z "$OECORELAYERCONF" ]; then
    OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
fi


No comments: