3

What is correct way to keep track of bitbake configuration and used layers in git?

senx
  • 141
  • 2

1 Answers1

6

Here's what I find works best:

  • Make new, empty git repository e.g. my-yocto on a drive with at least 50 GB of free space.
  • Add poky as a git submodule of my-yocto.
git submodule add git://git.yoctoproject.org/poky.git
  • From my-yocto root, run:
source poky/oe-init-build-env .

Note the "." in that command; initializing the build environment in my-yocto instead of poky prevents Yocto's GB of temp files from accumulating under poky.

  • The script will create a directory conf in my-yocto with some files in it; git-add conf/local.conf and conf/bblayers.conf to your repo.
  • By default, yocto sets up bblayers.conf using absolute paths, which means a repo set up by Alice won't work on Bob's machine. Fix that by modifying bblayers.conf using the Yocto ${TOPDIR} variable:
(...)
BBLAYERS ?= " \
  ${TOPDIR}/poky/meta \
  ${TOPDIR}/poky/meta-poky \
  ${TOPDIR}/poky/meta-yocto-bsp \
(...)
  • Edit local.conf to a supported platform in e.g MACHINE=beaglebone-yocto

  • From my-yocto, run bitbake core-image-minimal . Make sure your computer is well-ventilated and go for a hike.

If that works, you can build out the rest of your configuration by adding meta-openembedded etc. as submodules. I recommend any custom layers be distinct git repos from my-yocto, so that my-yocto only contains the git submodule details and the bitbake configuration.

To update before building, run:

git pull
git submodule update --remote --recursive

Other users will need to run git submodule init one time after cloning my-yocto.

Two other recommendations:

First, if you build for more than one machine, create a local.conf for each machine and create a symbolic link from local.conf to the machine-specific conf file. This allows you to track multiple machines in my-yocto.

Second, create a temp directory for each yocto branch (e.g. tmp-zeus, tmp-dunfell, tmp-gatesgarth) and then make a symbolic link from tmp to whichever branch you are building. (Don't add these to git.) Yocto accumulates an enormous amount of data in the tmp directory, and it requires you to clean out tmp when you switch branches. That's fine if you move to a newer release, but if you switch back and forth between branches it's a bummer to lose all of that cached data.

Robert Calhoun
  • 386
  • 1
  • 4