Use local mirror to build yocto file system from internal server

As we have seen in “Configure yocto to download from local mirror to save bandwidth” one way to setup your local server to build yocto is to modify PREMIRRORS and MIRRORS arguments permanantly in conf/distro/my_platform.conf but if we want to change between local mirrors for some reason, instead of changing distro configurations we can override those arguments from local.conf as,

 $ vim build/conf/local.conf 
# Source download dir
DL_DIR = "your_yocto_dir/sources"
 
# The sstate-cache dir
SSTATE_DIR = "your_yocto_dir/sstate-cache"
 
# Packages source mirrors
SOURCE_MIRROR_URL = "http://your_IP/yocto-mirrors/mirrored-sources/"
INHERIT += "own-mirrors"
BB_GENERATE_MIRROR_TARBALLS = "1"
 
# The sstate-cache mirrors
SSTATE_MIRRORS = "http://your_IP/yocto-mirrors/sstate-cache/"

Reference – https://www.yoctoproject.org/docs/1.5.1/ref-manual/ref-manual.html#var-BB_GENERATE_MIRROR_TARBALLS

SOURCE_MIRROR_URL => Defines your own PREMIRRORS from which to first fetch source before attempting to fetch from the upstream specified in SRC_URI.
To use this variable, you must globally inherit the own-mirrors class and then provide the URL to your mirrors. Here is an example:

INHERIT += "own-mirrors"
SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"

BB_GENERATE_MIRROR_TARBALLS => Causes tarballs of the Git repositories to be placed in the DL_DIR directory. For performance reasons, creating and placing tarballs of the Git repositories is not the default action by the OpenEmbedded build system.

BB_GENERATE_MIRROR_TARBALLS = "1"

1 thought on “Use local mirror to build yocto file system from internal server”

Leave a Comment