Skip to content

Instantly share code, notes, and snippets.

@Scott31393
Last active March 20, 2024 22:20
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/da49dcb8a749d23f07399464b194f93d to your computer and use it in GitHub Desktop.
Save Scott31393/da49dcb8a749d23f07399464b194f93d to your computer and use it in GitHub Desktop.
Cross Compile libcamera using Yocto sdk

Cross Compile Libcamera Using Yocto SDK

This try was done using imx8mp-evk, using fsl Yocto bsp master branch.

Get Yocto 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 \
+"

And add the SDK and image required packages:

TOOLCHAIN_HOST_TASK:append = "\
    nativesdk-ninja \
    nativesdk-libyaml \
    nativesdk-libevent \
    nativesdk-libsdl2 \
    nativesdk-libdrm \
    nativesdk-gnutls \
    nativesdk-libssl \
    nativesdk-pkgconfig \
    nativesdk-meson \
    nativesdk-python3-pyyaml \
    nativesdk-python3-ply \
    nativesdk-python3-jinja2 \
    nativesdk-clang \
    nativesdk-g++ \
    nativesdk-openssl \
    nativesdk-boost \
    nativesdk-python3-sphinx \
    nativesdk-doxygen \
    nativesdk-graphviz \
    nativesdk-qtbase \
    nativesdk-qttools \
"

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 \
    e2fsprogs-mke2fs \
    elfutils \
"

Build Yocto image + SDK with libcamera support

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

Get Libcamera sources and Build

source /opt/fslc-xwayland/4.1-snapshot-20240320/environment-setup-cortexa53-crypto-fslc-linux
git clone https://git.libcamera.org/libcamera/libcamera.git
cd libcamera
meson setup build -Dprefix=/targetfs/usr/
ninja -C build install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment