iMX8M-CM Yocto Linux

From Ronetix's Wiki
Jump to navigation Jump to search




Overview

The Yocto Project is an open source collaboration project that helps developers create custom Linux-based systems for embedded products, regardless of the hardware architecture.
This article show how to build Yocto Image for i.MX8M-CM CPU module using:

Linux Kernel U-BOOT
Yocto dunfell 5.4.105 v2020.04

Learn more about Yocto

Installing required packages

Please make sure your host PC is running Ubuntu 18.04+ 64-bit and install the following packages:

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm

$ sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev python-git \
sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 \
help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev \
mercurial automake groff curl lzop asciidoc u-boot-tools dos2unix mtd-utils pv \
libncurses5 libncurses5-dev libncursesw5-dev libelf-dev zlib1g-dev bmap-tools

More details about the Yocto Environment Setup can be found on the Yocto official site

Download Yocto based on Freescale Community BSP

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ mkdir ~/bin 
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ mkdir ~/yocto-ronetix
$ cd ~/yocto-ronetix
  • Download the Yocto repository
$ repo init -u https://github.com/ronetix/bsp-repo -b dunfell
$ repo sync

Setup and build Yocto

$ MACHINE=imx8mq-cm DISTRO=fslc-xwayland . setup-environment build_xwayland_imx8mq-cm
$ bitbake fsl-image-gui

Build Results

The resulted images are located in tmp/deploy/images/imx8mq-cm.

Create a bootable SD card

Replace sdX with the right device name.

$ umount /dev/sdX1
$ umount /dev/sdX2
$ sudo bmaptool copy tmp/deploy/images/imx8mq-cm/fsl-image-gui-imx8mq-cm.wic.gz /dev/sdX

WiFi Setup

Scan for wireless networks:

 $ ifconfig wlan0 up
 $ iw dev wlan0 scan | grep SSID

Connecting to an Access Point:

 $ wpa_passphrase <YourAP> <YourPassword> > /etc/wpa_supplicant.conf
 $ wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf

wait for:

 $ wlcore: Association completed.

Get an IP via DHCP:

 $ udhcpc -i wlan0
 $ ifconfig

Audio Test

List all sound cards:

 $ aplay -L 

Play a file:

 $ aplay Test.wav

List all sound controls:

 $ amixer controls

Set Speaker Playback volume to max:

 $ amixer cset numid=13 127

QSPI NOR Flash test

 $ mtd_debug info /dev/mtd0
 $ mtd_debug erase /dev/mtd0 0 0x10000
 $ dd if=/dev/urandom of=tmp_write.txt bs=1024 count=64
 $ dd if=tmp_write.txt of=/dev/mtd0 bs=1024 count=64
 $ dd if=/dev/mtd0 of=tmp_read.txt bs=1024 count=64
 $ diff tmp_write.txt tmp_read.txt
 $ hexdump -C tmp_read.txt | more

I2C EEPROM Test

 $ echo "Ronetix GmbH" > /sys/bus/i2c/devices/0-0050/eeprom	
 $ cat /sys/bus/i2c/devices/0-0050/eeprom > eeprom.bin
 $ hexdump -C eeprom.bin

Camera Test

 $ v4l2-ctl --list-devices
 $ gst-launch-1.0 v4l2src num-buffers=1 ! jpegenc ! filesink location=test.jpg

See also