Please rely on the newly published project Build NXP iMX Embedded Linux instead of this one you are presently looking at. Although this project is still technically correct, the codeaurora repository no longer exists.
Goals for this project- This project will demonstrate how I built i.MX Embedded Linux version 5.15.5_1.0.0 for the NXP i.MX 8M Plus SoC using Yocto Project version 3.4 "Honister"
- This project will also demonstrate how I built a Docker image from a Dockerfile so that I could run the entire build process within a Docker container.
In this project I provide all of the necessary commands to perform the goals, but I do not provide additional commentary. If you are a beginner to using Docker or Yocto Project, then please complete my earlier project, "Using Docker for Building NXP i. MX 8M Plus Yocto Project", before continuing with this project.
Documentation"i.MX Yocto Project User’s Guide" for version 5.15.5_1.0.0 released March 2022.
HardwareHardware is not required to complete this project, but this project will build the BSP for the 8MPLUSLPD4-EVK and the 8MPLUSLPD4-PEVK
DockerYocto Project builds are extremely sensitive to changes in the Linux environment. Because of multiple bizarre issues that I have experienced, I have completely given up trying to build directly on my Linux workstation and I now rely completely on Docker containers within which I can guarantee a stable and known environment for my Yocto builds.
For instructions on how to install Docker
- Follow my earlier project for instructions on how to install Docker
- Follow the Docker installation instructions
Note: My dockerfile is attached to this project. It is also available on my GitLab account
First StepLets get started
Create our Yocto Project directory
mkdir /work/imx8mp/honister/imx-5.15.5-1.0.0
DockerBuild the Ubuntu 20.04 "Focal Fossil" Docker image for Yocto Honister
We are going to use our Dockerfile "dockerfile-yocto20" to automate building a Docker image "yocto20" that I designed especially for building i.MX Embedded Linux.
Note: Do not forget the dot "." at the end of the command.
docker build --file ~/dockerfile-yocto20 --tag yocto20 .
Deploy our Docker image to a container while mounting the working directory
Note:
- The Hostname for the container will be docker-imx8mp
- I will name the Docker container "imx8mp-honister-5.15.5.1.0.0" to reflect the target SoC, Yocto version, and Linux version.
- The location on my Linux workstation for the working directory is "/work/imx8mp/honister/imx-5.15.5-1.0.0"
- The location within the Docker container "yocto20" for the working directory is "/home/build"
docker run -dit -P --hostname docker-imx8mp --name imx8mp-honister-5.15.5.1.0.0 -v /work/imx8mp/honister/imx-5.15.5-1.0.0:/home/build yocto20
Attach to the new container
docker attach imx8mp-honister-5.15.5.1.0.0
Install configuration dotfilesThis step is optional. I like to install some configuration dotfiles that will make Bash a little easier to use, configure Vim, create some aliases, etc.
curl https://gitlab.com/fweller/flint-configuration/-/raw/master/.dockerfile/dotfiles/install | bash && source .bashrc
Work within the containerConfigure Repo
repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-honister -m imx-5.15.5-1.0.0.xml
Download the basic applications with the Repo tool
repo sync
Configure our i.MX Linux build
EULA=1 MACHINE=imx8mpevk DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b bld-imx8mpevk-xwayland
Build imx-image-coreFirst we are going to build the image "imx-image-core". This smaller image is much more likely to be successful than the larger and significantly more complicated "imx-image-full". If this builds properly, then we have confidence to continue with the more complicated build later.
Download the source files first
I like to download the files before kicking off the build, just in case there are issues getting the files from the mirrors.
bitbake imx-image-core --runall fetch
Perform the build
Note: The "-k" tells BitBake to continue building as much as possible and not stopping as soon as there is an error.
bitbake -k imx-image-core
Now that the smaller "imx-image-core" has successfully built, we can have confidence that our Docker container was properly built. We can now attempt the larger "imx-image-full".
Build imx-image-fullDownload the source files first
bitbake imx-image-full --runall fetch
Perform the build
bitbake -k imx-image-full
I experienced an error during my build. I find that errors tend to pop up occasionally during a first build, and that they are usually permanently fixed within a few months after I experience them. But since I don't want to wait for the permanent fix in open source land, I will attempt the fix myself.
Debug the problem
Note:
- -v means "verbose"
- -DDD means add three levels of debug to the output
bitbake -k -v -DDD imx-image-full
View the BitBakeconsolelogfile
Note: BitBake console log files are stored in directory/home/build/bld-imx8mpevk-xwayland/tmp/log/cooker/imx8mpevk/
Note: The file console-latest.log is a soft link to the latest log file.
more /home/build/bld-imx8mpevk-xwayland/tmp/log/cooker/imx8mpevk/console-latest.log
Search for the error
Type "/Error" and <ENTER> to search within the more command.
CMake Error at /home/build/bld-imx8mpevk-xwayland/tmp/work/cortexa53-crypto-poky-linux/onnxruntime/1.10.0-r0/build/pybind11/tmp/pybind11-gitupdate.cmake:25 (message):
fatal: unsafe repository ('/home/build/bld-imx8mpevk-xwayland/tmp/work/cortexa53-crypto-poky-linux/onnxruntime/1.10.0-r0/build/pybind11/src/pybind11' is owned by someone else)
To add an exception for this directory, call: git config --global --add safe.directory /home/build/bld-imx8mpevk-xwayland/tmp/work/cortexa53-crypto-poky-linux/onnxruntime/1.10.0-r0/build/pybind11/src/pybind11
Fortunately this is a very easy fix to make as the instructions are provided to us in the log file.
Fix the problem
git config --global --add safe.directory /home/build/bld-imx8mpevk-xwayland/tmp/work/cortexa53-crypto-poky-linux/onnxruntime/1.10.0-r0/build/pybind11/src/pybind11
Perform the build
bitbake -k imx-image-full
My build completed successfully
Exit the docker container
exit
We are done. The files to program the eMMC or a microSD card are waiting for you.
To return to this project laterRestart the Docker container
docker restart imx8mp-honister-5.15.5.1.0.0
Attach to the Docker container
docker attach imx8mp-honister-5.15.5.1.0.0
Set up the environment
source setup-environment bld-imx8mpevk-xwayland
Extra Docker commands that may be useful to youdocker container rm imx8mp-honister-5.15.5.1.0.0
docker image rm yocto20
docker container ps -a
docker image ls
Comments