From SomLabs Wiki
VisionSOM imx-meta-somlabs layer for iMX Yocto Kirkstone
This tutorial explains how to build the iMX Yocto Kirkstone system for the SoMLabs modules. The Yocto system uses the following kernel and u-boot repositories:
- kernel (5.15.52): https://github.com/SoMLabs/somlabs-linux-imx/tree/somlabs_imx_5.15.52-2.1.0
- u-boot (2022.04): https://github.com/SoMLabs/somlabs-uboot-imx/tree/somlabs-imx_v2022.04_5.15.52-2.1.0
Meta-somlabs is a layer providing the SoMLabs modules and carrier boards hardware support for Yocto-based NXP Linux system.
Host system prerequisites
This tutorial was prepared for the Ubuntu 18.04.5 LTS host operating system. All of the files required for system image compilation may require up to 120 GB of the disk space. The SDK build requires additional 25 GB (145 GB in total).
The following packages need to be installed before the building process:
sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc u-boot-tools liblz4-tool zstd
The source code will be obtained using git, so it needs to be configured by setting the user name and email with correctly set values:
git config --global user.email "email@example.com" git config --global user.name "Your Name"
A new repo tool version is also required. It may be downloaded directly from the project site. The repo binary needs to be available in the system PATH variable and have the execution privilege:
wget https://storage.googleapis.com/git-repo-downloads/repo sudo mv repo /usr/bin/repo sudo chmod a+x /usr/bin/repo
This layer should be used in order to build the system image. This layer adds a new example image called somlabs-image. It includes the SoMLabs demo application using the GTK and GStreamer libraries.
Building the system image
The general description of the building process is described in the iMX Yocto Project User's Guide document:
The summary of required steps including the meta-somlabs layer is shown below:
mkdir imx-yocto-bsp cd imx-yocto-bsp repo init -u https://github.com/SoMLabs/imx-meta-somlabs -b kirkstone -m imx-somlabs-5.15.52-2.1.0.xml repo sync
System building may be configured for one of the available machine configurations:
- visioncb-6ull-std - VisionCB-6ULL-STD board with VisionSOM-6ULL modules
- visionsom-8mm-cb - VisionCB-8M board family with VisionSOM-8Mmini modules
- visionsbc-8mmini - VisionSBC-8Mmini board
- starsom-cb-6ull - StarCB-6ULL board with StarSOM-6ULL modules
- starsbc-6ull - StarSBC-6ULL board with or without the COMM shield
The following system distributions were tested on SoMLabs modules:
- fsl-imx-fb - distribution without graphical environment for 6ULL modules
- fsl-imx-xwayland - distribution with xwayland
System building may be started by the following commands (the first one needs to be called from the imx-yocto-bsp directory):
DISTRO=<SELECTED_DISTRIBUTION> MACHINE=<SELECTED_MACHINE> source imx-somlabs-setup-release.sh -b <BUILD_DIRECTORY> bitbake somlabs-image
The system image is located in the somlabs-image-<SELECTED_MACHINE>.wic.zst file in the tmp/deploy/images/<SELECTED_MACHINE> directory. It should be extracted and installed on a SD-card:
unzstd somlabs-image-<SELECTED_MACHINE>.wic.zst sudo dd if=somlabs-image-<SELECTED_MACHINE>.wic of=/dev/sdX bs=1M
The instruction for the eMMC memory image installation may be found on the following wiki pages:
- VisionSOM-6ULL: https://wiki.somlabs.com/index.php/Writing_VisionSOM-6ULL_system_image_to_eMMC_memory
- VisionSOM-8MM: https://wiki.somlabs.com/index.php/Writing_VisionSOM-8MM_system_image_to_eMMC_memory
Weston configuration on VisionSOM-8MM boards
Weston graphical environment is configured by /etc/xdg/weston/weston.ini file. On VisionSOM-8MM boards this file is a link created by systemd service somlabs-weston-init.service during system boot. This service uses somlabs-weston-init.sh script to check which display is in use and to create weston.ini link to normal or rotated display configuration. This script removes the existing link during each boot bo verify currently connected display.
#!/bin/sh WESON_INI_FILE="/etc/xdg/weston/weston.ini" if [ -L "$WESON_INI_FILE" ]; then rm $WESON_INI_FILE elif [ -f "$WESON_INI_FILE" ]; then exit 0 fi CMDLINE="`cat /proc/device-tree/model`" case "$CMDLINE" in *MIPI7-POWERTIP*) ln -s /etc/xdg/weston/weston_8m_rotated.ini $WESON_INI_FILE ;; *) ln -s /etc/xdg/weston/weston_8m.ini $WESON_INI_FILE ;; esac exit 0
In order to disable this functionality the service may be disabled using systemd:
systemctl disable somlabs-weston-init.service