Flint Weller
Published © GPL3+

Build NXP Desktop Linux for the i.MX 8MPlus using Yocto

Build Ubuntu-like NXP Desktop Linux (L5.15.5_1.0.0) for the i.MX 8MPlus using Yocto Project version 3.4 "Honister" using Docker

IntermediateProtip4 hours3,590
Build NXP Desktop Linux for the i.MX 8MPlus using Yocto

Things used in this project

Hardware components

NXP 8MPLUSLPD4-EVK
×1

Software apps and online services

NXP i.MX Embedded Linux

Story

Read more

Code

Dockerfile

Dockerfile
Build an Ubuntu 20.04 LTS image that will play nicely with Yocto Project Honister
# DOCKERFILE : yocto-honister-ubuntu-20
# PURPOSE    : Building NXP i.MX Embedded Linux using Yocto Project Honister 
#              on Ubuntu 20.04 LTS "Focal"
# ----------------------------------------------------------------------
# Flint Weller
# 20220520 Original
# 20220804 Changed name and directory location
# ----------------------------------------------------------------------
# INSTRUCTIONS
#
# Create Docker image from this dockerfile with command:
# $ docker build --no-cache \
#     --file ${HOME}/tools/dockerfiles/yocto-honister-ubuntu-20 \
#     --tag yocto-honister-ubuntu-20 .
#
# Deploy a container with the working directory mounted
# SYNTAX   :
# $ docker run -dit -P --hostname DockerHostname --name DockerContainerName \
#     -v WorkstationDirectory:DockerDirectory DockerImageName
# EXAMPLE  :
# $ docker run -dit -P --hostname docker-honister --name imx8-honister \
#     -v /work/docker/honister:/home/build yocto-honister-ubuntu-20
# ----------------------------------------------------------------------
# Ubuntu LTS release version numbers with code names
# Ubuntu 22.04 LTS = Jammy Jellyfish
# Ubuntu 20.04 LTS = Focal Fossa
# Ubuntu 18.04 LTS = Bionic Beaver
# Ubuntu 16.04 LTS = Xenial Xerus
# Ubuntu 14.04 LTS = Trusty Tahr
# ----------------------------------------------------------------------
# NOTE: NXP now has instructions on building a dockerfile:
# https://source.codeaurora.org/external/imx/imx-docker/tree/Dockerfile-Ubuntu-20.04
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# FROM must be the first command in a dockerfile
# Specify Ubuntu digest to pull from
FROM ubuntu:focal
# Could instead use FROM ubuntu:20.04


# ----------------------------------------------------------------------
# Use DEBIAN_FRONTEND=noninteractive to avoid image build hang waiting
# for a default confirmation [Y/n] at some configurations.
ENV DEBIAN_FRONTEND=noninteractive


# ----------------------------------------------------------------------
# Install dependencies
RUN apt update && apt upgrade -y


# ----------------------------------------------------------------------
# Handle the tzdata prompt
RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata


# ----------------------------------------------------------------------
# Put everything we want to install here
RUN DEBIAN_FRONTEND=noninteractive apt install \
  -y --no-install-recommends --fix-missing \
  openssh-client gawk wget git diffstat unzip texinfo file tar \
  gcc-multilib build-essential chrpath socat cpio python \
  python3 python3-pip python3-pexpect xz-utils debianutils \
  iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
  pylint3 xterm rsync curl locales apt-utils sudo vim bash-completion screen \
  python3-subunit mesa-common-dev zstd liblz4-tool zstd net-tools \
  ca-certificates less
# Notes
#   git-core is a dummy package that calls git
#   zstd provides pzstd
#   liblz4-tool provides lz4c and lz4


# ----------------------------------------------------------------------
# Clean up after the installs
RUN DEBIAN_FRONTEND=noninteractive apt clean -y --no-install-recommends \
  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# ----------------------------------------------------------------------
# Set up locales
RUN locale-gen en_US.UTF-8 \
  && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8


# ----------------------------------------------------------------------
# Yocto requires the source command for setting up the build environment, so
# Replace dash with bash (Ubuntu uses dash as /bin/sh for system shells)
# https://wiki.ubuntu.com/DashAsBinSh
# Note that using && below to chain commands is essential to avoid failure
RUN rm /bin/sh && ln -s bash /bin/sh


# ----------------------------------------------------------------------
# Install the google repo utility
RUN curl -o /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo 
RUN chmod a+x /usr/local/bin/repo


# ----------------------------------------------------------------------
# Create user called build (because we can not run Yocto Project as root)
# Change uid and gid, to match my account on my workstation
# Username is not all that important
ENV UID=1000
ENV GID=1000
ENV USER=build
RUN groupadd -g $GID $USER && \
useradd -u $UID -g $GID -ms /bin/bash $USER && \
usermod -a -G sudo $USER && \
usermod -a -G users $USER 


# ----------------------------------------------------------------------
# Change username and work directory
USER $USER
WORKDIR /home/$USER
#RUN cd /home/$USER/

# ----------------------------------------------------------------------
# Configure git

# This step is unnecessary because it doesn't stick with the image
# replaced by installing dotfiles
RUN git config --global user.name "Flint Weller"
RUN git config --global user.email "flint.weller@hackster.io"
RUN git config --global color.ui true
RUN git config --list

# ----------------------------------------------------------------------
## End

dotfiles

SH
Optional dotfiles that I like to use on the command line
No preview (download only).

Credits

Flint Weller

Flint Weller

24 projects • 20 followers
NXP Dedicated Applications Processor FAE

Comments