Set Up a Yocto Build Host and Build core-image-minimal
Install the host packages on Ubuntu 24.04, clone Poky at Scarthgap, source oe-init-build-env and run bitbake core-image-minimal for your first image.

The first Yocto build is where most newcomers lose an afternoon, and rarely to anything deep. A missing host package stops the parse in the first minute, a locale that is not UTF-8 stops it in the second, and a build run as root stops it before it starts. After those hurdles the build itself is mostly waiting. This post gets you from a clean Ubuntu 24.04 machine to a finished core-image-minimal using the Scarthgap 5.0 LTS release, and it explains what each step does so you can adapt it to another distribution. It sits under the Yocto cornerstone guide, which covers the same ground in a wider frame.
What you need before you start
Yocto builds the whole system from source, including the compiler, so it is hungry for disk, memory and time, and the manual's system requirements section lists the minimums for your release: https://docs.yoctoproject.org/5.0/ref-manual/system-requirements.html. Read it before choosing a machine. Two practical points follow from the way the build works.
The build must run as an ordinary user. BitBake refuses to run as root and prints
ERROR: Do not use Bitbake as root.if you try. Create a normal account or use a container (see the Docker post in this series).Put the work on a native Linux filesystem such as ext4 or XFS. Network shares and some virtual-machine shared folders break the case sensitivity and hard-link behaviour the build relies on.
The host also needs to be one the release supports. Scarthgap's manual lists the tested distributions, and Ubuntu 22.04 and 24.04 are among them. The ref-manual page above also carries the package list for each distribution family, which is the authoritative source if the command below ever differs from it.
Install the host packages
On Ubuntu and Debian derivatives, the essential packages for building images are these:
sudo apt update
sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential \
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils \
debianutils iputils-ping python3-git python3-jinja2 python3-subunit \
zstd liblz4-tool file locales libacl1
sudo locale-gen en_US.UTF-8The packages fall into three groups. build-essential, gcc and gawk provide the host toolchain that builds the cross-compiler. git, wget and unzip fetch and unpack sources. The Python 3 packages run BitBake itself, which is written in Python. The locales package and the last line matter because BitBake checks that the host locale is UTF-8 and stops with a message that starts Please use a locale setting which supports UTF-8 otherwise. libacl1 is needed by tools that are built for the host during the first stage.
If a package is missing, the failure usually names the host tool, for example Missing host tool: chrpath, and the build stops in the sanity check before any compilation happens. That check is useful: it fails fast.
Clone Poky at the release branch
Pick the release branch rather than master. Branches are named for the release, so Scarthgap is scarthgap:
git clone -b scarthgap https://git.yoctoproject.org/poky
cd poky
git log -1 --format=%hCloning into 'poky'...
a1b2c3dThe hash printed on your machine will differ because the branch moves with point releases. Record it. When someone later asks which Poky you used, the hash answers precisely, and the next section's banner prints it too.
Keep the clone outside /tmp and outside any directory that gets cleaned. Long builds create large trees below the clone's build directory, and losing the directory means losing the sstate cache.
Initialise the build environment
The script oe-init-build-env has to be sourced, not executed, because it changes the environment of your current shell:
source oe-init-build-env buildYou had no conf/local.conf file. This configuration file has therefore been
created for you from /home/builder/poky/meta-poky/conf/templates/default/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/builder/poky/meta-poky/conf/templates/default/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-64'.The exact list of common targets and the paths depend on your release and your home directory. What the script has done is worth stating plainly. It created the build directory, wrote build/conf/local.conf and build/conf/bblayers.conf from templates, added poky/bitbake/bin and poky/scripts to your PATH, and made build your current directory. If you open another terminal, you must source the script again with the same build directory name. The second time it will not overwrite your configuration, and it will say nothing about creating files.
Review the two configuration files
Open conf/local.conf once before the first build. You do not need to change anything for a first image, but you should see the lines that matter later:
MACHINE ??= "qemux86-64"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_rpm"MACHINE is the target hardware, and the default is a virtual x86-64 machine that QEMU can run, so the first image needs no board. DISTRO selects the Poky policy. PACKAGE_CLASSES picks the package format used inside the build, and it does not mean the final image contains a package manager. If your host has limited threads or memory, you can also set BB_NUMBER_THREADS and PARALLEL_MAKE here, which the performance post in this series covers. Keep the defaults for now.
Run the build
Everything so far was preparation. This is the build:
bitbake core-image-minimalBitBake prints the build configuration banner, parses the recipes, and then shows progress such as the number of tasks done out of the total. A first build on a clean machine fetches sources, compiles the cross-toolchain, then the C library, the kernel, busybox and the rest. The wait is long, and the time depends on your CPU count, disk and network, so no figure is quoted here. Do not stop it: the work is stored in the sstate cache as it goes, so an interrupted build resumes by rerunning the command.
A successful run ends like this:
NOTE: Tasks Summary: Attempted 3102 tasks of which 2874 didn't need to be rerun and all succeeded.
Summary: There was 1 WARNING message.The task counts are specific to your tree and will differ. The part to look for is all succeeded. Warnings are normal for a first build, and they are worth reading once, but they do not mean failure.
Find what you built
Output goes below the build directory, in tmp/deploy/images/<machine>/:
ls tmp/deploy/images/qemux86-64/ | grep core-image-minimalcore-image-minimal-qemux86-64.rootfs-20250101000000.ext4
core-image-minimal-qemux86-64.rootfs.ext4
core-image-minimal-qemux86-64.rootfs.manifest
core-image-minimal-qemux86-64.rootfs.qemuboot.conf
core-image-minimal-qemux86-64.rootfs.testdata.json
core-image-minimal-qemux86-64.rootfs.tar.bz2The timestamp in the first name is when your build ran, so yours will differ. The files without the timestamp are symlinks to the latest build. The .ext4 is the root filesystem image, the .tar.bz2 is the same content as an archive, and the .manifest lists every package installed. The kernel image bzImage-qemux86-64.bin sits in the same directory. Whether .rootfs.manifest or the newer .manifest naming appears depends on the release, so read the directory rather than assuming names.
The qemuboot.conf file is the one that runqemu reads to boot the image, which is the next post in this series.
When the build fails
Three failures cover most first attempts.
A sanity check error at the start, before any compile. Read the message: it names a missing host tool, a bad locale, or a path with a space. Fix it and run
bitbakeagain.A fetch error such as
do_fetchfailing withUnable to fetch URL. Check network and proxy settings. A flaky network usually succeeds on a retry.A compile error in one recipe. BitBake prints the path of the task log, for instance
tmp/work/.../temp/log.do_compile. Open that file, not the terminal output, and search upward from the end for the firsterror:.
Never fix a failing build by editing files under tmp/work. That directory is rebuilt. Fix the recipe, the configuration or the host.


