Building the Linux microPlatform¶
This is a guide for building the base Linux microPlatform from source for Raspberry Pi 3. Additional information specific to other targets is provided in Additional Linux microPlatform Targets.
This guide assumes the reader is familiar with basic concepts of OpenEmbedded. It is not meant to be an introduction to the OpenEmbedded / Yocto Project. If you’re just getting started, it’s strongly recommended to begin with the documentation provided in References.
You will need a x86 computer to develop on; Linux is currently natively supported. On macOS and Windows, see Linux microPlatform Development Container for information on setting up a containerized Linux build environment.
You will also require at least 50GB of storage for a complete Linux microPlatform build.
Set Up Build Environment¶
On Debian-based Linux distributions, including Ubuntu, run:
$ sudo apt-get install coreutils gawk wget git-core diffstat unzip \ texinfo gcc-multilib build-essential chrpath socat cpio \ openjdk-9-jre python python3 python3-pip python3-pexpect xz-utils \ debianutils iputils-ping libsdl1.2-dev xterm \ android-tools-fsutils repo whiptail
If you are running Ubuntu 16.04, make sure to enable the universe repository by adding following line to your
deb http://archive.ubuntu.com/ubuntu/ xenial universe
On other Linux distributions, please check the Yocto Project Quick Start Guide for additional guidance.
Install the Linux microPlatform¶
The Linux microPlatform sources can be placed in any directory on your workstation, as long it provides enough disk space for the complete build. This uses the Repo tool to fetch a variety of Git repositories at known-good revisions, and keep them in sync as time goes on.
(If you’re new to Repo and want to know more, see Repo Primer for Zephyr microPlatform.)
Configure Git to cache usernames and passwords you enter in memory for one hour:
git config --global credential.helper 'cache --timeout=3600'
Using some form of credential helper is necessary for repo sync to work later.
If you haven’t already, create a subscriber access token on app.foundries.io.
Make an installation directory for the Linux microPlatform, and change into its directory:
mkdir lmp && cd lmp
(You can also reuse an existing installation directory.)
Install update 33 using repo:
repo init -u https://source.foundries.io/lmp-manifest \ -b refs/tags/33 repo sync
When prompted by repo init, enter your subscriber token for your username and nothing for the password.
Set up Work Environment¶
Next, set up your work environment for building the source.
MACHINE target used by this guide is
raspberrypi3-64. (For information on other hardware platforms, see Additional Linux microPlatform Targets.)
The default distribution (
DISTRO) is automatically set to
lmp, which is provided by the meta-lmp layer (see Linux microPlatform OpenEmbedded / Yocto Layers for more details).
Set up your work environment using the
MACHINE=raspberrypi3-64 source setup-environment [BUILDDIR]
MACHINE is not provided, the script will list all possible machines found in every enabled OpenEmbedded / Yocto Project layer, and force one to be selected.
BUILDDIR is optional; if it is not specified, the script will default to
Build the lmp-gateway Image¶
Bitbake requires passwordless authentication when fetching repositories from https://source.foundries.io.
To arrange for this, create a file named
.netrc (note the leading
.) in your home directory, readable only by your user, with the following contents:
machine source.foundries.io login <your-subscriber-token>
Then build the Linux microPlatform gateway image:
Depending on the amount of RAM and number of processors and cores in your system, the speed of your Internet connection, and other factors, the first build could take several hours. Subsequent builds run much faster since some artifacts are cached.
At the end of the build, your build artifacts will be found under
deploy/images/raspberrypi3-64. The artifact you will use to flash your board is
Install the lmp-gateway Image¶
If you’re using a Raspberry Pi 3, you can use the same procedure outlined for prebuilt binaries in Install Linux microPlatform. See Additional Linux microPlatform Targets for additional information on other targets.