This setup helps to build i.MX BSP in an isolated environment with Docker.
There are various methods of installing [docker], i.e. by docker script:
curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.shTo work better with docker, without sudo, add your user to docker group.
sudo usermod -aG docker <your_user>Log out and log back in so that your group membership is re-evaluated.
Create a docker config file at ~/.docker/config.json and enter the following:
{
"proxies": {
"default": {
"httpProxy": "http://proxy.example.com:80"
}
}
}Note: replace the 'example' proxy with your proxy info.
sudo mkdir -p /etc/systemd/system/docker.service.dsudo vim /etc/systemd/system/docker.service.d/http-proxy.confAdd the following:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,someservices.somecompany.com"Restart Docker:
sudo systemctl daemon-reloadsudo systemctl restart docker.
├── Dockerfile-Ubuntu-18.04
├── Dockerfile-Ubuntu-20.04
├── Dockerfile-Ubuntu-22.04
├── Dockerfile-Ubuntu-24.04
├── README.md
├── config.sh
├── docker-build.sh
├── docker-run.sh
├── versions.txt
└── yocto-build.sh
This file contains the mapping of i.MX versions to their build configurations:
# VERSION UBUNTU BRANCH MANIFEST
6.18.20-2.0.0 24.04 imx-linux-wrynose imx-6.18.20-2.0.0.xml
6.18.2-1.0.0 24.04 imx-linux-whinlatter imx-6.18.2-1.0.0.xml
6.6.23-2.0.0 22.04 imx-linux-scarthgap imx-6.6.23-2.0.0.xml
Edit config.sh to customize your build environment:
# Docker configuration
export DOCKER_WORKDIR="${HOME}/yocto-builds" # Build workspace
# Yocto build configuration
export REMOTE="https://github.com/nxp-imx/imx-manifest"
# Default build configuration (can be overridden)
export MACHINE="${MACHINE:-imx8mpevk}"
export DISTRO="${DISTRO:-fsl-imx-wayland}"
export IMAGES="${IMAGES:-imx-image-core}"Important: The DOCKER_WORKDIR should be a directory you have write permissions to. Using ${HOME}/yocto-builds is recommended to avoid permission issues.
Build the Docker image for your desired i.MX version:
./docker-build.sh 6.18.20-2.0.0To rebuild without cache:
./docker-build.sh 6.18.20-2.0.0 --no-cacheThis will:
- Read the version configuration from
versions.txt - Select the appropriate Ubuntu-based Dockerfile
- Install all Yocto build dependencies
- Create a user matching your host UID/GID
- Copy the
yocto-build.shscript into the image
Start an interactive shell in the container:
./docker-run.sh 6.18.20-2.0.0Then manually run the build script:
. /usr/local/bin/yocto-build.shRun the build directly without entering the container:
./docker-run.sh 6.18.20-2.0.0 yocto-build.shYou can override default build parameters using environment variables:
MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland IMAGES=imx-image-full ./docker-run.sh 6.18.20-2.0.0 yocto-build.shWhen running the container, the following volumes are mounted:
${DOCKER_WORKDIR}:${DOCKER_WORKDIR}- Main workspace for build artifacts${HOME}/.ssh:${HOME}/.ssh:ro- SSH keys for Git authentication (read-only)${HOME}/.gitconfig:${HOME}/.gitconfig:ro- Git configuration (read-only)
Build artifacts will be saved to ${DOCKER_WORKDIR}/imx-<VERSION>/ on your host machine.
To see all available versions:
./docker-build.shor
./docker-run.shIf you encounter permission errors when building, ensure your DOCKER_WORKDIR exists and is owned by your user:
mkdir -p ~/yocto-buildschown -R $(whoami):$(whoami) ~/yocto-buildsBuild artifacts are located at:
${DOCKER_WORKDIR}/imx-<VERSION>/build_<DISTRO>/tmp/deploy/images/<MACHINE>/
For example:
~/yocto-builds/imx-6.18.20-2.0.0/build_fsl-imx-wayland/tmp/deploy/images/imx8mpevk/
To remove a Docker image:
docker rmi imx-docker:imx-6.18.0-2.0.0To clean up build artifacts:
rm -rf ~/yocto-builds/imx-6.18.20-2.0.0