When using OpenEmbedded for product development, there are several reasons you may want to consider setting up a source mirror for your OpenEmbedded build:
- over time, sources disappear from download locations
- various servers for source packages may be off-line at the time a build is run
- some servers may be very slow, which slows down your build
- occasionally the checksums of a source package will change
For a production build system, you want the build to be reliable and consistent, so this means not depending on 3rd party web sites/servers for a clean build to complete. Fortunately, OpenEmbedded makes it easy to set up a source mirror with the PREMIRRORS variable. When bitbake tries to fetch source code, it tries PREMIRRORS, the upstream source, and then MIRRORS. There are several advantages to using a PREMIRROR variable over a MIRROR for your source mirror:
- your source mirror will be used first, thus slow web sites are not an issue
- if the checksums of the package change, the build will not fail because its still using the original source package from the mirror. You are guaranteed to be always using the same source package.
Setting up a source mirror is as simple as copying the contents of your downloads directory to a web server, and then populating the following variable in local.conf:
PREMIRRORS_prepend = "\ git://.*/.* http://my-server/sources/ \n \ ftp://.*/.* http://my-server/sources/ \n \ http://.*/.* http://my-server/sources/ \n \ https://.*/.* http://my-server/sources/ \n"
The Poky reference manual has more details.