Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Flint Weller
Published © GPL3+

Build Linux using Yocto Kirkstone for the NXP i. MX8M Nano

Build Linux 5.15.32_2.0.0 for the MX8MNano SoC using Yocto version 4.0 "Kirkstone" within a Docker container built with a Dockerfile

BeginnerFull instructions provided30 minutes1,617
Build Linux using Yocto Kirkstone for the NXP i. MX8M Nano

Things used in this project

Hardware components

NXP 8MNANOLPD4-EVK
×1

Software apps and online services

NXP i.MX Embedded Linux

Story

Read more

Code

yocto-kirkstone-ubuntu-20

Dockerfile
# DOCKERFILE : yocto-kirkstone-ubuntu-20
# PURPOSE    : Building NXP i.MX Embedded Linux using Yocto Project kirkstone 
#              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-kirkstone-ubuntu-20 \
#     --tag yocto-kirkstone-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-kirkstone --name imx8-kirkstone \
#     -v /work/docker/kirkstone:/home/build yocto-kirkstone-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

dockerfile_and_dotfiles-20220805.zip

SH
ZIP Archive
No preview (download only).

Credits

Flint Weller
24 projects • 21 followers
NXP Dedicated Applications Processor FAE
Contact

Comments

Please log in or sign up to comment.