Building AGL Development Enviornment on Mac: 2. Configure poky layers & bitbake for AGL

| November 13, 2025

Set up Yocto layers for Automotive Grade Linux (AGL), configure local.conf and bblayers.conf, and run your first AGL bitbake build inside the Docker container.

Overview

In part 1 we set up Docker, created a persistent volume, exposed it via Samba, and started a poky container. Now we’ll use the dnangellight/agl-poky-dev:latest container specifically designed for AGL development to configure the Yocto layers, set up local.conf and bblayers.conf, and run your first bitbake build.

1. Start the AGL development container

Instead of the generic crops/poky container, use the AGL-specific development container with the shared volume:

Terminal window
docker run --rm -it -v myvolume:/workdir dnangellight/agl-poky-dev:latest --workdir=/workdir

This container comes pre-configured with all the tools and dependencies needed for AGL development, including git, curl, python3, and the repo tool.

You should see a prompt like:

agluser@<container-id>:/workdir$

2. Verify required tools

The dnangellight/agl-poky-dev:latest container comes with all necessary AGL development tools pre-installed. Verify they are available:

Terminal window
curl --version
git --version
python3 --version
repo --version

All these commands should return version information without errors.

3. Initialize and sync the AGL workspace

Create a workspace directory and initialize the repo manifest. Replace <AGL_BRANCH> with your desired AGL release (e.g., octopus, needlefish):

Terminal window
cd /workdir
mkdir agl-workspace
cd agl-workspace
repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo -b octopus

Fetch all layers defined in the manifest (this may take several minutes):

Terminal window
repo sync

When complete, you’ll have a directory structure containing meta-agl, poky, and other required layers.

4. Set up the build environment

Source the AGL setup script to initialize the build environment. Replace <MACHINE> with your target (e.g., qemux86-64 for QEMU, raspberrypi4 for Raspberry Pi):

Terminal window
source meta-agl/scripts/aglsetup.sh -m qemux86-64 -b build agl-demo agl-devel

Notes:

  • -m qemux86-64: target machine type
  • -b build: build directory name
  • agl-demo: includes AGL demo platform features
  • agl-devel: includes development tools

After running this, you’ll be in the build directory with the environment configured.

5. Configure local.conf

Open conf/local.conf to adjust build settings:

Terminal window
vi conf/local.conf

Increase parallelism for faster builds (adjust based on your Mac’s CPU cores):

BB_NUMBER_THREADS ?= "8"
PARALLEL_MAKE ?= "-j 8"

Set persistent download and shared state directories to speed up rebuilds:

DL_DIR ?= "/workdir/downloads"
SSTATE_DIR ?= "/workdir/sstate-cache"

Create these directories:

Terminal window
mkdir -p /workdir/downloads /workdir/sstate-cache

Confirm the machine and distro settings (usually auto-configured):

MACHINE ??= "qemux86-64"
DISTRO ?= "poky-agl"

Save and exit.

6. Run your first AGL build

With the environment configured, start the build:

Terminal window
bitbake agl-demo-platform

Notes:

  • The first build can take several hours depending on CPU and network speed
  • Bitbake downloads source tarballs to DL_DIR and shows tasks like do_fetch, do_compile, do_install
  • Build artifacts will be in tmp/deploy/images/<MACHINE>/
  • If downloads fail, re-run the command; bitbake resumes from the last successful task

7. Locate and test the built image

After a successful build, find the output image:

Terminal window
ls tmp/deploy/images/qemux86-64/

You should see files like agl-demo-platform-qemux86-64.wic, bzImage-qemux86-64.bin, and *.rootfs.ext4.

Test the image with QEMU (if available in the container):

Terminal window
runqemu qemux86-64

This boots the AGL demo platform. To exit, press Ctrl-A, then X.

8. Incremental builds and cleanup

To rebuild after making changes:

Terminal window
bitbake agl-demo-platform

Bitbake only rebuilds changed tasks.

To force rebuild of a specific recipe:

Terminal window
bitbake -c cleansstate <recipe-name>
bitbake <recipe-name>

To clean the entire build and start fresh:

Terminal window
rm -rf tmp