Building Components From Source
By default, a BitBake recipe fetches the source artifact named
in its SRC_URI (typically a tarball or a pinned git
revision hosted by AMD). Override that source without editing
the EDF recipe when you track an upstream branch,
prototype a fix, or iterate on a working copy on your local
filesystem.
This page describes the two supported overrides and the Yocto
plumbing they need, using u-boot-xlnx as the worked
example:
Building from a Remote Source Repository – point the recipe at a different git repository, branch, or commit.
Building from a Local External Repository – build directly from a checkout on your build host using
externalsrc.
Both overrides take effect through a .bbappend file in a
user layer. If you edit recipes inside the AMD-provided
layers directly, the next layer update overwrites those
edits, and rebasing onto a newer EDF release turns
into a manual merge instead of a clean repo sync.
Prerequisites
Before you can add a .bbappend, your build environment must
contain a writable user layer that BitBake parses. The
following steps create meta-user next to the AMD layers in
the sources/ directory. Skip them if your project already
has a user layer.
Source the Yocto build environment (see Setting Up the Yocto Environment) so that
bitbake-layersis on yourPATHandBBPATHhas a value.Create the layer:
$ bitbake-layers create-layer ../sources/meta-user
Add the layer to
bblayers.confso BitBake parses it:$ bitbake-layers add-layer ../sources/meta-user
Confirm BitBake sees the layer:
$ bitbake-layers show-layers
Note
The .bbappend filename must match the recipe it extends.
Use <recipe>_<version>.bbappend to target a specific
version, or <recipe>_%.bbappend to match every version
of the recipe. The directory under recipes-*/ should
mirror the layout used by the original recipe. For
u-boot-xlnx that path is
meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend.
Building from a Remote Source Repository
Use this override when you want a recipe to fetch from a
different git repository, branch, or commit than the one AMD
ships. This is the typical workflow for tracking an upstream
fix on github.com/Xilinx before it lands in the next
EDF release.
Generic Pattern
For any recipe whose SRC_URI is a plain git source with a
SRCREV pin, create
meta-user/recipes-<class>/<recipe>/<recipe>_%.bbappend
and reassign the relevant variables:
# Generic remote-source override
SRC_URI = "git://<host>/<org>/<repo>.git;protocol=https;branch=<branch>"
SRCREV = "<full 40-char commit hash>"
Key variables:
SRC_URI– the fetch address. Use thegit://scheme withprotocol=https(orprotocol=sshfor private repos) and select the upstream branch with;branch=<branch>.SRCREV– the exact commit BitBake checks out from that branch. Must be a full 40-character SHA.An optional
UBRANCH(or similarly named) variable keeps the branch name in one place when bothSRC_URIand another recipe variable need it.
These assignments use = (not :append or :prepend,
and not the legacy _append / _prepend forms that
older recipes still use), so they fully replace the values
the upstream recipe inherits. BitBake then fetches from your
fork or branch instead of the AMD default.
Example: u-boot-xlnx
The UBRANCH and SRC_URI values shown match the
EDF v26.06 release. The example pins
SRCREV to a commit other than the recipe default, so
the bitbake -e u-boot-xlnx | grep ^SRCREV= step that
follows shows a different SHA and confirms the override.
In your own bbappend, set SRCREV to whichever commit
on UBRANCH you want to build.
Create the bbappend directory in your user layer:
$ mkdir -p ../sources/meta-user/recipes-bsp/u-boot
Create
../sources/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappendwith the following content:# Build u-boot-xlnx from a remote source repository # (custom fork or branch). UBRANCH = "xlnx_rebase_v2026.01" SRCREV = "980da51527e0a9a7a79ac218347ade2bfd5bb330" SRC_URI = "git://github.com/Xilinx/u-boot-xlnx.git;protocol=https;branch=${UBRANCH}"
The upstream
u-boot-xlnx-common.incalready buildsSRC_URIfromUBOOTURIandUBRANCH(SRC_URI = "${UBOOTURI};${UBRANCHARG}"), so when you stay on the samegithub.com/Xilinx/u-boot-xlnxfork you only need to overrideUBRANCHandSRCREV- the inheritedSRC_URIrecomputes. ReassignSRC_URIonly when the override fetches from a different repository (a fork, a mirror, or an internal git host).Verify BitBake picks up the bbappend:
$ bitbake-layers show-appends | grep u-boot-xlnx u-boot-xlnx_2026.01-xilinx-v2026.1.bb: .../meta-amd-edf/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend .../meta-kria/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend .../meta-embedded-plus/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend .../meta-amd-adaptive-socs/meta-amd-adaptive-socs-bsp/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend .../meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
Confirm BitBake applies the override values by inspecting the recipe’s parsed environment:
$ bitbake -e u-boot-xlnx | grep ^SRC_URI= SRC_URI="git://github.com/Xilinx/u-boot-xlnx.git;protocol=https;branch=xlnx_rebase_v2026.01 " $ bitbake -e u-boot-xlnx | grep ^SRCREV= SRCREV="980da51527e0a9a7a79ac218347ade2bfd5bb330"
Build U-Boot for your target board:
$ MACHINE=versal-vek280-sdt-seg bitbake -c cleansstate u-boot-xlnx $ MACHINE=versal-vek280-sdt-seg bitbake u-boot-xlnx
The output binaries land in
tmp/deploy/images/<machine>/u-boot*.
Tip
SRCREV must be a full 40-character commit hash. Using
a branch name or short hash causes BitBake to fail with
Fetcher failure for URL errors. To always track the
tip of a branch (not recommended for reproducible builds),
set SRCREV = "${AUTOREV}".
Building from a Local External Repository
Use this override when you have a working copy on the build
host and want BitBake to compile it directly, skipping
do_fetch and do_unpack. This is the fastest iteration
loop for local patches. Edits in your working copy take
effect on the next bitbake invocation.
Generic Pattern
For any recipe, create the bbappend at the matching path in
your user layer and inherit the externalsrc class:
# Generic externalsrc override
inherit externalsrc
EXTERNALSRC = "/abs/path/to/source"
EXTERNALSRC_BUILD = "/abs/path/to/source/build"
Key variables:
inherit externalsrc– swaps the recipe’sdo_fetchanddo_unpackfor a no-op that points at a directory on disk, so edits in your working copy take effect on the next build.EXTERNALSRC– absolute path to the source tree BitBake compiles.EXTERNALSRC_BUILD– absolute path to a writable directory for object files and intermediates. It can be the same asEXTERNALSRCor a subdirectory of it.
Note
The unqualified EXTERNALSRC and EXTERNALSRC_BUILD
assignments in the preceding code block work because the
bbappend is already scoped to a single recipe. If you
ever drive externalsrc from local.conf (or
another non-recipe context), switch to the global form:
add INHERIT += "externalsrc" to the configuration
and use EXTERNALSRC:pn-<recipe> /
EXTERNALSRC_BUILD:pn-<recipe> so the override binds
to a specific recipe instead of every recipe BitBake
parses.
Example: u-boot-xlnx
Clone (or otherwise place) the U-Boot source at a stable location on the build host, outside the Yocto
build/directory:$ git clone https://github.com/Xilinx/u-boot-xlnx.git \ /path/to/local/directory
Create the bbappend directory in your user layer:
$ mkdir -p ../sources/meta-user/recipes-bsp/u-boot
Create
../sources/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappendwith the following content:# Build u-boot-xlnx from a local external source repo. inherit externalsrc EXTERNALSRC = "/path/to/u-boot-xlnx" EXTERNALSRC_BUILD = "/path/to/u-boot-xlnx/build"
EXTERNALSRC_BUILDmust point at a writable directory. BitBake writes object files and intermediates there instead of under${WORKDIR}. The directory must exist (or the recipe’s build step must create it), and the user running BitBake must have write permission.Build U-Boot.
externalsrcbypassesdo_fetch/do_unpack, so every rebuild compiles the current contents ofEXTERNALSRCin place:$ MACHINE=versal-vek280-sdt-seg bitbake u-boot-xlnx
Confirm the recipe is compiling from your tree (not the shipped tarball) by checking the build log header:
$ head -5 tmp/work/*/u-boot-xlnx/*/temp/log.do_compile \ | grep "compiling from external source tree" NOTE: u-boot-xlnx: compiling from external source tree /path/to/u-boot-xlnx
Warning
externalsrc weakens Yocto’s reproducibility guarantees.
The recipe signature no longer reflects the source
contents, so sstate does not automatically detect changes
in the external tree. Use bitbake -c cleansstate
<recipe> if a rebuild does not pick up your local edits.
Remove the externalsrc override from your bbappend
before you produce a release build. Rebuild release
artifacts from the recipe’s pinned SRC_URI /
SRCREV so the signatures sstate records match the
shipped sources.