Xilinx Yocto Builds without an Internet Connection

Table of Contents


Yocto requires internet access in order to download all the source packages required to build an embedded Linux system.  However, internet access may not always be available when building with Yocto.  A developer may have a build machine with internet restrictions or the developer may simply be unplugged while on an airplane.  This wiki covers a few options for building with offline machines.

Downloads and Shared State Cache Refresher

Two important directories in the build directory are the downloads and sstate-cache.

The downloads directory is where all the source packages are downloaded locally.  This directory may be relocated with the DL_DIR variable in your local.conf.

DL_DIR (default)
DL_DIR ?= "${TOPDIR}/downloads"

The sstate-cache directory is where all the build artifacts are cached which can be reused to accelerate subsequent builds.  This directory may be relocated with the SSTATE_DIR variable in your local.conf.

SSTATE_DIR (default)
SSTATE_DIR ?= "${TOPDIR}/sstate-cache"

For example, if you want to place the downloads and sstate-cache directories outside of the standard Yocto build directory, you may edit your local.conf as shown below.

DL_DIR = "/home/<user>/yocto/downloads"
SSTATE_DIR = "/home/<user>/yocto/sstate-cache"

Downloading Source Packages

At some point, you will need a Yocto machine that has internet access to download all the source required for a build.  You may download all the source packages (without building) by issuing bitbake with the fetchall command as shown in the fetchall listing below.  All the source packages required for your build are now located in the downloads directory.  You may generate tarballs from the Git repositories by setting the BB_GENERATE_MIRROR_TARBALLS flag to "1" in your local.conf if desired.

$ bitbake -c fetchall petalinux-image-minimal

If you want to download every package, you can fetchall the world.

fetchall (everything)
$ bitbake -c fetchall world

No Network Access

If you are working on a machine with no network access, you may tar the downloads directory (including .done files) from an internet connected machine or mirror server and copy the tarball to your build machine.  Then extract the source packages into the downloads directory.  Internet accesses can be disabled on the build machine by setting the BB_NO_NETWORK flag in local.conf.  The Yocto build will immediately throw an error if it tries to access the network.

local.conf (developer's machine)

No Internet Access

Mirror Server

If you are connected to a local network, but do not have internet access, your IT department may setup a mirror server to provide the source packages.  Fetching source packages from a local mirror server, requires network access, but only the mirror server requires internet access.  Set the BB_GENERATE_MIRROR_TARBALLS flag in local.conf to generate tarballs from Git repositories on the mirror server.  This is only required on the mirror server and not on the developer's machine.

local.conf (mirror server)

If you are administering a mirror server, you may download all the source packages (without building) by issuing bitbake with the fetchall command as shown in the fetchall listing above.  These packages will be available to all developers with LAN access to the mirror server.

On the developer's machine, point to the mirror server with the SOURCE_MIRROR_URL variable and force fetching source from the mirror server by setting the BB_FETCH_PREMIRRORONLY variable in local.conf. Any requests that cannot be serviced by the mirror server will throw an error.

local.conf (developer's machine)
MIRROR_SERVER = "http://your-mirror-server/"


INHERIT += "own-mirrors"

Build Server

A build server is a machine that has internet access and performs periodic Yocto builds.  These builds may be scheduled at intervals such as nightly or weekly to keep the developers coherent.  Developers can fetch the build artifacts from the shared state cache of the build server significantly reducing local build times.

The configuration below will first fetch from the shared state cache if there is a hit and then attempt to download source from the mirror server if the package is not cached or stale.

local.conf (developer's machine)
MIRROR_SERVER = "http://your-mirror-server/"


INHERIT += "own-mirrors"

	file://.* ${MIRROR_SERVER}/sstate-cache/PATH \


If you are using a different Linux Distro than your mirror server, you may still be able to take advantage of the shared state cache for native packages if the two machines have compatible GCC versions.  Uninative attempts to normalize distributions such that you can reuse the shared state cache, but that requires compatible GCC version between the machines.  If the GCC version are not compatible, then your host will need to rebuild the native packages, requiring access to the native source packages resulting in longer build times.


While Yocto requires internet access at some point to fetch all the required source packages to build an embedded distribution, it does provide tools that allow building on machines that do not have internet access.  A couple of options for building without internet access include:

  1. Downloading source packages and then copying them to your build machine.
  2. Using a mirror server to host the source packages locally on your intranet.
  3. Using a build server to run periodic builds and provide the build artifacts through the shared state cache.

Creating a Custom Yocto Layer

Adding a Hardware Platform to a Xilinx Yocto Layer

Xilinx Yocto Builds without an Internet Connection


Yocto Project Mega-Manual (2.4.4)

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy