Flint Weller
Published © GPL3+

Build NXP LLDP Layerscape Linux Distribution POC

Learn how to configure a Docker container, configure the environment, build LLDP, and deploy to hardware

BeginnerProtip1 hour742
Build NXP LLDP Layerscape Linux Distribution POC

Things used in this project

Hardware components

NXP Layerscape Developer Board
×1

Software apps and online services

NXP Layerscape Linux Distribution PoC
Yocto Project
Yocto Project
Docker Engine

Story

Read more

Code

yocto-mickledore-ubuntu-20

Dockerfile
This is the Dockerfile we will use to build our Docker container
# DOCKERFILE : yocto-mickledore-ubuntu-20
# AUTHOR     : Flint Weller
# PURPOSE    : Provide a known Ubuntu 20.04 LTS "Focal" environment
#              for building NXP i.MX Embedded Linux
#              or NXP LLDP (Layerscape Linux Distribution PoC)
#              using Yocto Project 4.2 "Mickledore"
#              on Ubuntu 20.04 LTS "Focal"
# ----------------------------------------------------------------------
# INSTRUCTIONS
#
# Create Docker image from this dockerfile with command:
# $ docker build --no-cache \
#     --file ${HOME}/Tools/dockerfiles/yocto-mickledore-ubuntu-20 \
#     --tag yocto-mickledore-ubuntu-20 .
#
# Deploy a container with the working directory mounted
# SYNTAX   :
# $ docker run -dit -P --hostname DockerHostname --name DockerContainerName \
#     -v HostDirectory:DockerDirectory DockerImageName
# EXAMPLE  :
# $ docker run -dit -P --hostname docker-mickledore --name imx8-mickledore \
#     -v /work/docker/mickledore:/home/build yocto-mickledore-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
#
# ----------------------------------------------------------------------
# Yocto Project version numbers and codenames
#
# 4.4 Scarthgap
# 4.3 Nanbield
# 4.2 Mickledore
# 4.1 Langdale
# 4.0 Kirkstone
#
# ----------------------------------------------------------------------
# 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

# ----------------------------------------------------------------------

dotfiles.zip

SH
Zip archive of my preferred dotfiles
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.