Building From Source: Development Container
This is a guide for building the Linux® microPlatform (LmP) from source using a Docker container. The container uses Ubuntu and provides the build environment for the LmP.
Tip
This is the same container used by the FoundriesFactory™ Platform CI, and is the recommendecd environment for building local LmP images.
This guide assumes some familiarity with Open Embedded concepts. If you are new to Open Embedded/the Yocto Project, we strongly recommend beginning with the documentation provided under References.
Important
Locally built images are useful for testing and hardware enablement, but are not meant to be updated via OTA. For OTA support, use our CI system.
Requirements
Minimum 50GB of storage for a complete LmP build
Setup
Create local folders for
sstate-cache
,downloads
andbuild
to save the build outside the container:mkdir -p ~/lmp/sstate-cache ~/lmp/downloads ~/lmp/build
Run 95 of the container as the
builder
user:docker run --rm -u builder --name lmp-sdk -v ~/lmp/build:/build/lmp -v ~/lmp/sstate-cache:/build/lmp/sstate-cache -v ~/lmp/downloads:/build/lmp/downloads -it hub.foundries.io/lmp-sdk:95
Setup Git inside the container (required by
repo
):git config --global user.name "Your Full Name" git config --global user.email "your-email-address@example.com"
Download the Layers
The Google Repo tool fetches Git repos at known-good revisions, and keeps them in sync.
Enter the build directory:
cd build/lmp
Fetch release 95 using Repo:
repo init -u https://github.com/foundriesio/lmp-manifest -b refs/tags/95 repo sync
Setup the Build Environment
Next, set up your environment for building the source.
Tip
For information on supported hardware platforms, see Board Machine Names.
The distribution variable DISTRO
is lmp
by default.
This distro comes from the meta-lmp-base layer (see OpenEmbedded / Yocto Project Layers for more details).
Set up your environment using the setup-environment
script:
MACHINE=qemuarm64-secureboot source setup-environment [BUILDDIR]
If MACHINE
is not provided, the script will list all machines from the enabled layers and prompt you to select one.
BUILDDIR
is optional; if not specified, the script defaults to build-lmp
.
Keep in mind that BUILDDIR
must be within the lmp
directory, otherwise your build will fail.
Important
For iMX based devices, the Freescale EULA must be accepted.
Add ACCEPT_FSL_EULA = "1"
to conf/local.conf
Build the Image
To build the LmP base-console, run:
bitbake lmp-base-console-image
Note
Depending on your system’s resources, the speed of your internet connection, and other factors, the first build could take several hours. Subsequent builds are much faster since some artifacts are cached.
At the end of the build, your build artifacts will be under deploy/images/<MACHINE>
.
The artifact you will use to flash your board will be something similar to lmp-base-console-image-<MACHINE>.wic.gz
.
Install the Image
For QEMU, follow the procedure outlined in the arm64 flashing instructions.
For other targets, see Board Machine Names for their instructions.
Build and Install the LmP for your Factory
If you are already working with a Factory, you can instead download the source code for that factory with the following steps.
Make and enter an installation directory for the LmP using your
<factory-name>
:mkdir <factory-name> && cd <factory-name>
Install the
<factory-name>
meta-layers using repo:repo init -u https://source.foundries.io/factories/<factory-name>/lmp-manifest.git -b main -m <factory-name>.xml repo sync
The manifest
<factory-name>.xml
refers to all the LmP meta-layers and also to the<factory-name>
specific repositories as described Factory Source Code.Build the image for
<factory-name>
with bitbake:
MACHINE=<machine-name> source setup-environment [BUILDDIR] bitbake lmp-factory-imageSet
MACHINE
to a supported machine. See the current available options in Board Machine Names.
BUILDDIR
is optional; the script defaults tobuild-lmp
.
lmp-factory-image
is the suggested default image. Customize it with the steps from Adding Packages to the Image.
Tip
The bitbake
step can take a while.
Your build artifacts will be under deploy/images/<machine-name>
.
The artifact you use to flash your board is lmp-base-console-image-<machine-name>.wic.gz
.
Important
While the local build is great for developing and debugging, the image is not visible for the OTA system, and is for local use.
When you push the changes to your Factory Git repos, it will trigger a new build. You can then flash and register your device following the instructions of Flashing Your Device and Registering Your Device. Then, you can take advantage of the OTA system.
References
We recommend the following reference material on OpenEmbedded and the Yocto Project: