Xilinx Yocto Builds without an Internet Connection

Table of Contents

Introduction

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.

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.

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.

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.

If you want to download every package, you can fetchall the 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.

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.

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.

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.

Conclusion

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 Xilinx Yocto Layer

Adding an HDF to a Xilinx Yocto Layer

Xilinx Yocto Builds without an Internet Connection

References

Yocto Project Mega-Manual (2.4.4)