iMX8M-CM Yocto Linux: Difference between revisions

From Ronetix's Wiki
Jump to navigation Jump to search
(remove empty comments)
(switch to template)
Tag: Replaced
Line 1: Line 1:
{{#vardefine:HARDWARE_NAME|i.MX8M-CM}}
{{#vardefine:HARDWARE_NAME|i.MX8M-CM}}
{{#vardefine:YOCTO_NAME|Dunfell}}
{{#vardefine:MACHINE_NAME|imx8mq-cm}}
{{#vardefine:BUILD_FOLDER|~/yocto-ronetix}}
{{#vardefine:YOCTO_NAME|dunfell}}
{{#vardefine:MACHINE_NAME|imx8m-cm}}
{{#vardefine:KERNEL_VER|5.4.105}}
{{#vardefine:CURL|curl}}
{{#vardefine:UBOOT_VER|v2020.04}}


[[File:imx8m-cm-top.png|thumb]]
[[File:imx8m-cm-top.png|thumb]]
= 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.<br>
This article show how to build Yocto Image for i.MX8M-CM CPU module using:<br>
{| class="wikitable"
|-
!
! Linux Kernel
! U-BOOT
|-
| Yocto Dunfell
| 5.4.105
| v2020.04
|}


[https://www.yoctoproject.org/docs/ Learn more about Yocto]
<!-- use template -->
 
{{iMX8M-YOCTO}}
= Installing required packages =
 
Please make sure your host PC is running Ubuntu 18.04+ 64-bit and install the following packages:
<pre>
$ 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
</pre>
 
More details about the Yocto Environment Setup can be found
[https://www.yoctoproject.org/docs/2.6/brief-yoctoprojectqs/brief-yoctoprojectqs.html#brief-build-system-packages 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
$ {{#var:CURL}} <nowiki>http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo</nowiki>
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
 
$ mkdir {{#var:BUILD_FOLDER}}
$ cd {{#var:BUILD_FOLDER}}
 
* '''Download the Yocto repository'''<br>
$ 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_mx8mq_cm
$ bitbake fsl-image-gui
 
== Build Results ==
The resulted images are located in tmp/deploy/images/{{#var:MACHINE_NAME}}.
 
== Create a bootable SD card ==
Replace sdX with the right device name.
$ umount /dev/sdX1
$ umount /dev/sdX2
$ sudo bmaptool copy tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-gui-{{#var:MACHINE_NAME}}.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
 
= See also =
* [[iMX8M-CM Yocto Linux | Yocto Linux]]
* [[iMX8M-CM Linux|Building Linux Kernel]]
* [[iMX8M-CM U-Boot|Building U-Boot]]

Revision as of 17:59, 7 October 2021




File:imx8m-cm-top.png

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