Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scott31393/9b0f4fcce3463ea8df6454d10a9f622a to your computer and use it in GitHub Desktop.
Save Scott31393/9b0f4fcce3463ea8df6454d10a9f622a to your computer and use it in GitHub Desktop.
Build Yocto fs for i.MX8MP support Etnaviv + Mesa Mainline Kernel

Build Yocto Filesystem for i.MX8MP with support for Etnaviv + Mesa using Mainline Kernel

Introduction

Steps to build the following software for i.MX8MP EVK:

 - yocto: scarthgap (master) 5.0
 - linux: Linux Kernel 6.8-rc2, media-stage master
 - driver: new upstream drv alvium-csi2.c
 - mesa: Mesa 24.0.2 using etnaviv driver
 - weston: weston + eglfs backend
 - gst: GStreamer 1.22.10

Get Sources

cd fsl-community-bsp
repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b master
repo sync

You need also the following metas: meta-clang and meta-qt6:

cd sources
git clone git://code.qt.io/yocto/meta-qt6.git
git clone https://github.com/kraj/meta-clang.git

Then add newest meta layers to bblayers.conf

+ ${BSPDIR}/sources/meta-clang \
+ ${BSPDIR}/sources/meta-qt6 \
+"

Append the following to your local.conf file:

IMAGE_INSTALL:append = "\
    ninja \
    pkgconfig \
    meson \
    libyaml \
    python3-pyyaml \
    python3-ply \
    python3-jinja2 \
    clang g++ \
    libevent \
    libsdl2 \
    libsdl2 \
    libsdl2-ttf \
    libsdl2-image \
    libsdl2-mixer \
    jpeg \
    libdrm \
    gstreamer1.0 \
    gstreamer1.0-plugins-base \
    gnutls \
    libssl \
    openssl \
    boost \
    packagegroup-core-buildessential \
    python3-sphinx doxygen \
    graphviz \
    qtbase \
    qttools \
    v4l-utils \
    libcamera \
    kmscube \
    kernel-modules \
    packagegroup-qt6-addons \
    e2fsprogs \
    elfutils \
"
MACHINEOVERRIDES .= ":use-mainline-bsp"
DISTRO_FEATURES:remove = " qtwebengine"

DISTRO_FEATURES:append = " gles2 eglfs"
PACKAGECONFIG:append:pn-weston = " systemd egl kms "
IMAGE_FSTYPES += "tar.bz2"

BB_NUMBER_THREADS = "4"

Build Yocto image + SDK with libcamera support

source ./setup-environment build
bitbake fsl-image-multimedia-full
bitbake fsl-image-multimedia-full -c populate_sdk

Build the Kernel

Get Linux kernel mainline sources from:

git clone https://github.com/torvalds/linux.git

Note: defconfig for imx8mp can be found here:

You can build the Linux kernel in a stand alone way and copy the image and Kernel modules after using:

export ARCH=arm64
export DTC_FLAGS="-@"
export PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-linux-gnu/bin/:$PATH
export CROSS_COMPILE=aarch64-none-linux-gnu-

make imx8mp_evk_defconfig
make Image dtbs modules

sudo rm -r MODULES
mkdir MODULES
make -j16 modules_install CROSS_COMPILE=$CROSS_COMPILER ARCH=arm64 INSTALL_MOD_PATH=./MODULES


cp arch/arm64/boot/Image /tftp-folder/
cp arch/arm64/boot/dts/freescale/imx8mp-evk.dtb /tftp-folder/
sudo cp -rf MODULES/lib/* /targetfs/lib/

Extract into your FS

sudo tar -xf tmp/deploy/images/imx8mp-lpddr4-evk/fsl-image-multimedia-full-imx8mp-lpddr4-evk.rootfs.tar.bz2 -C /targetfs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment