Message-ID: <1866651375.5265.1711718575706.JavaMail.root@dns3> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_5264_1176135309.1711718575706" ------=_Part_5264_1176135309.1711718575706 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html SMARC-iMX8M-BSP-Sumo

SMARC-iMX8M-BSP-Sumo

=20 =20
=20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
=20 =20
=20
=20
=20

Building NXP/Embedian=E2= =80=99s Yocto Sumo BSP Distribution

Eric Lee

version 1.0a, 5/10/2019

Introduction


 

This document describes how Embedian builds a customized version of NXP= =E2=80=99s i.MX8M official Yocto Sumo BSP release for Embedian's S= MARC-iMX8M product platform. The approach is to pull from Embedia= n's public facing GIT repository and build that using bitbake. The reason w= hy we use this approach is that it allows co-development. The build ou= tput is comprised of binary images, feed packages, and an SDK for = SMARC-iMX8M specific development.

 

Freescale makes their i.MX series official bsp build scripts available v= ia the following GIT repository:

=20
=20
=20

git://git.freescale.com/imx/meta-fsl-bsp-release

=20
=20
=20

 

Freescale community BSP release build sc= ript is available via the following repository:  

 

=20
=20
=20

git://git.freescale.com/imx/fsl-arm-yocto-bsp.git

=20
=20
=20

It is this repository that actually p= ulls in the fsl-bsp-relea= se project to perform the Li= nux BSP builds for Freescale's i.MX8M ARM Cortext-A53 chips.  

Generating SSH Keys


 We recommend you use SSH= keys to establish a secure connection between your computer and Embedian G= itlab server. The steps below will walk you through generating an SSH key a= nd then adding the public key to our Gitlab account. 

Step 1. Check for SSH keys


First, we need to check for existing ssh keys on your computer. Open up&= nbsp;Git Bash and run: 

=20
$ cd ~/.ssh
$ ls
# Lists the files in your .ssh directory
=20

 Check the directory list= ing to see if you have a file named either id_rsa.pub&nbs= p;or id_dsa.pub. If you don't have either of those files = go to step 2. Otherwise, you already have an existing= keypair, and you can skip to step 3. 

Step 2. Generate a new SSH key


 To generate a new SSH ke= y, enter the code below. We want the default settings so when asked to ente= r a file in which to save the key, just press enter.

=20
$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press en=
ter]
$ ssh-add id_rsa
=20

 Now you need to enter a = passphrase.

=20
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
=20

 Which should give you so= mething like this:

=20
Your identification has been saved in /c/Users/you/.ssh/id_rsa.
Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com=20

<= span style=3D"color: rgb(0,51,102);">Step 3. Add your SSH key to Embedian G= itlab Server


 Copy the key to your cli= pboard.

=20
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAABDAQABAAABAQDQUEnh8uGpfxaZVU6+uE4bsDrs/tEE5/BPW7j=
MAxak
6qgOh6nUrQGBWS+VxMM2un3KzwvLRJSj8G4TnTK2CSmlBvR+X8ZeXNTyAdaDxULs/StVhH+QRtF=
EGy4o
iMIzvIlTyORY89jzhIsgZzwr01nqoSeWWASd+59JWtFjVy0nwVNVtbek7NfuIGGAPaijO5Wnshr=
2uChB
Pk8ScGjQ3z4VqNXP6CWhCXTqIk7EQl7yX2GKd6FgEFrzae+5Jf63Xm8g6abbE3ytCrMT/jYy5OO=
j2XSg
6jlxSFnKcONAcfMTWkTXeG/OgeGeG5kZdtqryRtOlGmOeuQe1dd3I+Zz3JyT your_email@exa=
mple.c
om
=20

Go to Embedian Git Server. At Profile Setting --> SSH Keys --> Add SSH Key 

Paste your public key and press "Add Key" and your are done.

Overview of the meta-smarcimx8m-sumo = Yocto Layer


The supplied meta-smarcimx8m-sumo Yocto compliant layer has the following organization:

=20
=20
=20

.
|-- conf
|&nbs= p;  |-- layer.conf
|   |-- site.conf
| = ;  |-- machine
|       |-- sma= rcimx8m2g.conf
|   |   `-- smarcimx8m4g.conf
= |-- README
|-- recipes-bsp
|   |-- u-boot
| &nbs= p;     `-- u-boot-smarcimx8m_2017.03.bb
|   |-- alsa-state
|    &nb= sp;  |   |-- alsa-state
|       | &= nbsp; |   `-- asound.state
|       `--&n= bsp;alsa-state.bbappend
|   |-- pm-ut= ils
|       `-- p= m-utils_%.bbappend
|   |-- imx-mkimag= e
|       `-- imx= -boot_0.2.bbappend

|-- recipes-core
|   |-- busybox
| &nbs= p;     `-- busybox_%.bbappend
|  &n= bsp;    |   |-- busybox
| &nbs= p;     |   |   |-- f= tpget.cfg
|       |  &nbs= p;|   `-- defconfig
|   |-- pa= ckagegroups
|       `-- packag= egroup-core-tools-testapps.bbappend
|   |-- psplash
|       `-- psplash_git.bbappend
|       |&= nbsp;  |-- files
0001-psplash-Change-color= s-for-the-Embedian-Yocto-logo.patch

|       |  &= nbsp;|   `-- pspl= ash-poky-img.h
|   |-- udev
<= br />|     &= nbsp; |   |-- files
|       |  &nbs= p;|   `-- usb-power.rules
|       `-- ud= ev-rules-imx.bbappend
|-- recipe= s-devtools
|  &= nbsp;|-- meson
|&nbs= p;      |   |-- meson_0.47.2.b= b
|   &nbs= p;   |   |-- nativesdk-meson_0.47.2.bb=
|     =   |   |   `-- meson.inc=
|     = ;  `-- meson
|       |   |=    |-- 0001-gtkdoc-fix-issues-that-arise-when-cross-c= ompiling.patch
|  &nbs= p;    |   |   |-- 0001-Li= nker-rules-move-cross_args-in-front-of-output_args.patch
|       = |   |   |-- 0001-python-module-do-not-manipul= ate-the-environment-when.patch
|       |   | =   |-- 0002-gobject-introspection-determine-g-ir-scanner-and-g-i.p= atch
|   &= nbsp;   |   |   |-- 0002-Make-= CPU-family-warnings-fatal.patch
|       |   | = ;  |-- 0003-native_bindir.patch
|       |  &n= bsp;|   |-- disable-rpath-handling.patch
|       |=    |   |-- gi-flags.patch
|       | &= nbsp; |   |-- gtkdoc-flags.patch
|       |&nb= sp;  |   |-- meson-setup.py
|      &nb= sp;|   |   `-- 
meson-wrapper
|-- recipes-multimedia
|   |-- gst-plugins-good
|   | &= nbsp; |-- files
|         = ;  `-- increase_min_buffers.patch
|   |-- pulseaud= io
|   |   |-- pulseaudio
|   =     |   |   |-- default.p= a
|       |   | = ;  |-- init
|       |&nbs= p;  |   |-- pulseaudio-bluetooth.conf
| =       |   |   |= -- pulseaudio.service
|       |&nbs= p;  |   `-- system.pa
|   = ;    `-- pulseaudio_%.bbappend
|-- recipes-kernel =
|   |-- linux
|      &nb= sp;`-- linux-smarcimx8m_4.14.78.bb
`-- scripts
| &n= bsp; `-- emb_mk_yocto_sdcard

=20
=20
=20


Notes on 
meta-smarcimx8m-sumo layer content

conf/machine/*

This folder contains the machine definiti= ons for the smarcimx8m2g/smarcimx8m2gind/smarcimx8m4g platfo= rm and backup repository in Embedian. These select the associated kernel, k= ernel config, u-boot, u-boot config, and tar.bz2 image settings.

recipes-bsp/u-boot/*

This folder contains recipes used to buil= d DAS U-boot for smarcimx8m2= g/smarcimx8m2gind/smarcimx8m4g platform.

recipes-bsp/alsa-state/*

This folder contains sgtl5000 sound chip = default state for smarcimx8m= 2g/smarcimx8m2gind/smarcimx8m4g platform.

recipes-bsp/imx-mkimage/*<= /code>

This folder contains imx-mkimage tool for=  smarcimx8m2g/smarcimx8m2gin= d/smarcimx8m4g platform.

recipes-devtools/meson/*

This folder contains meson 0.45 version f= or this yocto build.

recipes-core/busybox/*

This folder remove telnetd from bysybox f= or smarcimx8m2g/smarci= mx8m2gind/smarcimx8m4g platform.  

recipes-core/psplash/* 

This folder customized Yocto boot psplash= for smarcimx8m2g/smarcimx8m= 2gind/smarcimx8m4g platform.

recipes-kernel/linux/*

Contains the recipes needed to build the&= nbsp;smarcimx8m2g/smarcimx8m2gind= /smarcimx8m4g Linux kernels.

Setting Up the Tools and Build Environment<= /span>


To build the latest Freescale i.MX8M fsl-bsp-release, you first need an Ub= untu 16.04 LTS installation. Since bitbake does not accept building images = using root privileges, please do not login as a = root user when performing the instructions in this section. 

Once you have Ubuntu 16.04 LTS running, install the additional required su= pport packages using the following console command:

=20
=20
=20

$ sudo apt-get install gawk = wget git-core diffstat unzip texinfo build-essential chrpath libsdl1.2-dev = xterm python-m2crypto bc libsd= l1.2-dev pv=

=20
=20
=20

If you are using a 64-bit Linux, then= you'd also need to install 32-bit support libraries, needed by the pre-bui= lt Linaro toolchain and other binary tools.

=20
=20
=20

$ sudo dpkg --add-architectu= re i386
$ sudo apt-get update
$ sudo apt-get install curl g++-mul= tilib gcc-multilib lib32z1-dev libcrypto++9v5:i386 libcrypto++-dev:i386 liblz= o2-dev:i386 libusb-1.0-0:i386 libusb-1.0-0-dev:i386 uuid-dev:i386
=

=20
=20
=20
=20 Icon=20
=20

If you saw error like the following after running "sudo dpkg --add-architecture i386"

pkg: error: unknown option --add-architecture

make sure the only file present in /etc/dpkg/dpkg.cfg.d/ is "multia= rch"

ls /etc/dpkg/dpkg.cfg.d/

if output is

multiarch

execute the following commands as it is else replace "multiarch&quo= t; with the name of file present in that directory.

$ sudo sh -c "echo 'foreign-architecture i386' > /etc/dp=
kg/dpkg.cfg.d/multiarch"

The above command will add i386 architecture.

=20
=20
=20

 

To get the BSP you need to have 'repo' installed and use it as:

Install the 'repo' utility:

=20
=20
=20

$ mkdir ~/bin
$ curl http://commondatas= torage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ PATH=3D${PATH}:~/bin&= nbsp;

=20
=20
=20

Download the BSP Yocto Project Environme= nt.

=20
=20
=20

$ mkdir ~/smarc-imx8m-sumo-r= elease

$ cd ~/smarc-imx8m-sumo-rele= ase

$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest = -b imx-linux-sumo -m imx-4.14.78-1.0.0_ga.xml

$ repo sync=20

=20
=20

Download the Embedian Yocto build script= and meta layer.

 

=20
=20
=20

$ wget ftp://ftp.embedian.co= m/public/dev/minfs/smarc-imx8m-bsp-release/fsl-smarcimx8m-sumo-setup-releas= e.sh

$ chmod 444 fsl-smarcimx8m-s= umo-setup-release.sh

$ cd sources

$ git clone git@git.embedian= .com:developer/meta-smarcimx8m-sumo.git -b 8m_4.14.78_1.0.0_ga_sumo<= /code>

$ cd ~/smarc-imx8m-sumo-rele= ase

$ DISTRO=3Dfsl-imx-wayland M= ACHINE=3Dsmarcimx8m2g source fsl-smarcimx8m-sumo-setup-release.sh -b imx8m-= build-qt5wayland 

=20
=20
=20
Choose "y&=
quot; to accept EULA.
This script wil=
l create and bring you to ~/smarc-imx8m-sumo-release/imx8m-buil=
d-qt5wayland directory.

 

=20
=20

Note

=20 Icon=20
=20

The last line of the above script

$ DISTRO=3D<distro name> MACHINE=3D<machine name> sour= ce fsl-smarcimx8m-sumo-setup-release.= sh -b <build dir>

  1. <distro name> 
    • fsl-imx-x11 - Only X11 graphics
    • fsl-imx-wayland - Wayland weston graphics

    • fsl-imx-xwayland - Wayland graphics and X11. X11 applications = using EGL are not supported

    • fsl-imx-fb - Frame Buffer graphics - no X11 or Wayland (Frame Buffer DISTRO is not supported on i.M= X8M.)

  2. <machine name>

    • smarcimx8m2g - if your board is SMARC-iMX8M-D-2G, SMA= RC-iMX8M-L-2G or SMARC-iMX8M-Q-2G.

    • smarcimx8m2gind - if your board is SMARC-iMX8M-D-2G-I= , SMARC-iMX8M-L-2G-I or SMARC-iMX8M-Q-2G.

    • smarcimx8m4g - if your board is SMARC-iMX8M-Q-4G or S= MARC-iMX8M-Q-4G-I.

The default console debug port is SER3.

In this document, we will use smarcimx8m2g as the example of machine name. Users need to cha= nge different machine name if you have different SMARC card variants.

=20
=20
=20  
Building the target platforms

  To build Embedian/Freescale Yocto BSP,&n= bsp; use the following commands:
=20
=20
=20

$ MACHINE=3Dsmarcimx8m2g= bitbake -k fsl-image-qt5-validation-imx
or
$ MACHI= NE=3Dsmarcimx8m2g bitbake -k fsl-image-validation-imx

=20
=20
=20


=20
=20

Note

=20 Icon=20
=20

fsl-image-validation-imx provides a gui image without QT5.&= nbsp;

fsl-image-qt5-validation-imx provides a Qt5 image for X11, wayland= or FB backends depending on your distro name.

If your machine name is smarcimx8m2g and your gui image is without= QT5 , the following command gives you as an example.

$ MACHINE=3Dsmarcimx8m2g bit= bake -k fsl-image-validation-imx

The first build takes time.

=20
=20
=20

 

Once it done, you can find all required images under ~/smarc-imx8m-sumo-release/<build dire=
ctory>/tmp/deploy/images/<machine name>/

You may want to build programs that aren=E2=80=99t installed into a root= file system so you can make them available via a feed site (described belo= w.) To do this you can build the package directly and then build the packag= e named package-index&nbs= p;to add the new package to the feed site.

 

The following example builds the minicom program and makes it available on the feed site:=20

=20
=20

$ MACHINE=3Dsmarcimx8m2g bit= bake tcpdump
$ MACHINE=3Dsmarcimx8m2g bitbake package-index

=20
=20
=20

Once the build(s) are completed you=E2= =80=99ll find the resulting images, rpm and licenses in folder  ~/smarc-imx8m-sumo-release/= <build directory>/tmp/deploy .

deploy/images/<machine name>/* 

This folder contains the binary images for = the root file system and the Embedian SMARC-iMX8M specif= ic version of the boot file, Image and device tree file. Specifically the i= mages are:

deploy/images/<machine name>/imx-boot-<machine name>-sd= .bin-flash_evk&n= bsp;

This boot file binary for SMARC-iM= X8M if your device has HDMI

deploy/images/<machine name>/imx-boot-<machine name>-sd= .bin-flash_dp_evk 

This boot file binary for SMARC-iM= X8M if your device has Display Port 

deploy/images/<machine name>/imx-boot-<machine name>-sd= .bin-flash_evk_no_hdmi  

This boot file binary for SMARC-iM= X8M if your device has no HDMI


deploy/images/<machine name>/Image

The k= ernel Image for SMARC-iMX8M. =  

deploy/images/<machine name>/<device tee file>

=20
= =20
=20

DCSS vs LCDIF

i.MX8M comes with 2 display controlle= rs: DCSS and LCDIF.

 DCSS can be connected to either HDMI or MIPI-DSI (to LVDS bridge= ) and supports resolutions up to 4K.

 LCDIF can be connected only to MIPI-DSI and supports resolutions= up to 1080p.

=20
=20
=20

Select= ing display configuration is a matter of selecting an appropriate DTB file = under deploy/images/<machine name>/<device tee file>=

All available DTB files are listed in= the table below.

DTB File Name Description
= fsl-smarcimx8mq.dtb Device tree b= lob for no display configuration.
= fsl-smarcimx8mq-hdmi.dtb Device tree b= lob for HDMI display configuration (DCSS).
= fsl-smarcimx8mq-hdmi-4k.dtb Device tree b= lob for HDMI 4k display configuration (DCSS).
= fsl-smarcimx8mq-lcdif-lvds.dtb Device tree b= lob for LCDIF LVDS display configuration.
= fsl-smarcimx8mq-dcss-lvds.dtb Device tree b= lob for DCSS LVDS display configuration.
= fsl-smarcimx8mq-dual-display.dtb Device tree b= lob for dual LVDS+HDMI display configuration.
= fsl-smarcimx8mq-dp.dtb Device tree b= lob for Display Port (DP) display configuration.
= fsl-smarcimx8mq-edp.dtb Device tree b= lob for embedded Display Port (eDP) configuration.

 

deploy/images/<machine name>/fsl-image-validation-imx-&l= t;machine name>.*

Embedian root file system images for softwa= re development on Embedian=E2=80=99s SMARC-iMX8M  platfo= rms without QT5.

deploy/images/<machine name>/fsl-image-qt5-validation-= imx-<machine name>.*

Embedian root file system images for softwa= re development on Embedian=E2=80=99s SMARC-iMX8M  with Q= T5.


deploy/rpm/*

 This folder contains all the p= ackages used to construct the root file system images. They are in rpm format (similar format to Fedora package= s) and can be dynamically installed on the target platform via a properly &= nbsp;constructed feed=  file. Here is an examp= le of the feed file (named imx8m_qt5wayland_update.repo) that is used internally at Embedian to install upgrades onto a = ;imx8msmarc QT5 platform directl= y on framebuffer without reflashing the file system:

=20 =20

deploy/licenses/* 
A = database of all licenses used in all packages built for the system.<= /span>

Setup SD Card Manually


For these instruction, we are assuming: DISK=3D/dev/mmcblk0, "lsblk= " is very useful for determining the device id.

=20
=20
=20
$ export DISK=3D/dev/mmcblk0
=20
=20
=20

Erase SD card:

=20
=20
=20

$ sudo = dd if=3D/dev/zero of=3D${DISK} bs=3D1M count=3D16

=20
=20
=20

Create Partition Layout: Leave 2MB offset for boot file.

With util-linux v2.26, sfdisk was rewritten and is now based on = libfdisk.

=20
=20

sfdisk

=20
=20
$ sudo sfd= isk --version
sfdisk from util-linux 2.27.1
=20
=20
=20

Create Partitions:

=20
=20

sfdisk >=3D2.26.x

=20 Icon=20
=20
$ sudo sfdisk ${DISK} <<-__EOF__
2M,48M,0x83,*
50M,,,<= br />__EOF__
=20
=20
=20
=20

sfdisk <=3D2.25

=20 Icon=20
=20
$ sudo sfdisk --in-order --Linux --=
unit M ${DISK} <<-__EOF__
2,48,0x83,*
,,,-
__EOF__=20
=20
=20

Format Partitions:

=20
=20
=20
for: DISK=3D/dev/mmcblk0
$ sudo mkf= s.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkf= s.ext4 ${DISK}p2 -L rootfs
 
for: DISK=3D/dev/sdX
$ sudo mkf= s.vfat -F 16 ${DISK}1 -n boot
$ sudo mkf= s.ext4 ${DISK}2 -L rootfs
=20
=20
=20

Mount Partitions:

On some systems, these partitions may be auto-mounted...

=20
=20
=20
$ sudo mkd= ir -p /media/boot/
$ sudo mkd= ir -p /media/rootfs/
 
for: DISK=3D/dev/mmcblk0
$ sudo mou= nt ${DISK}p1 /media/boot/
$ sudo mou= nt ${DISK}p2 /media/rootfs/
 
for: DISK=3D/dev/sdX
$ sudo mou= nt ${DISK}1 /media/boot/
$ sudo mou= nt ${DISK}2 /media/rootfs/
=20
=20
=20

Install Boot File (i= mx-boot-<machine name>-sd= .bin-flash_evkimx-boot-<machine = name>-sd.bin-flash_dp_evk or imx-boot-<machine name>-sd.bin-flash_evk_no_hdmi)

Boot file is factory default flash= ed at on-module eMMC flash.

If on-module eMMC Flash is empty<= /strong>

In some cases, when eMMC flash is erased = or the u-boot is under development, we need a way to boot from SD card firs= t. Users need to shunt cross the TEST# pin to ground. In this way,&nb= sp;SMARC-iMX8M will always boot up from SD card. 

Fuse flash.bin to the SD card. 

= =20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>/

=20
=20

$ sudo dd if=3D<boot file> of=3D${DISK} bs=3D1024 seek=3D33
=20
=20
=20

If on-module eMMC Flash is not em= pty

The <boot file> = is pre-installed in on-module eMMC flash at factory default. SMARC-iMX8M is= designed to always boot up from on-module eMMC flash and to load Image, de= vice tree blob and root file systems based on the setting of BOOT_= SEL. If users need to fuse your own flash.bin or perform u-boot upgrad= e. This section will instruct you how to do that.

Copy <boot file> to the second part= ition home directory of your SD card and boot into SD card. Go to home dire= ctory and you should see flash.bin file. 

=20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>/

=20
=20

$ sudo cp -v <boot file> /media/root= fs/home/root/
=20
=20
=20

Fuse <boot file> to the on-module e= MMC flash. (The eMMC flash is emulated as /dev/mmcblk0 in SMARC-iMX8M)

= =20
=20

home directory

=20
=20

$ sudo dd if=3D<boot file> of=3D/dev/mmcblk0 bs=3D1024 see= k=3D33

=20
=20
=20
=20 Icon=20
=20
  1. If your u-boot hasn't been finalized= and still under development, it is recommended to shunt cross the test pin= and boot directly from SD card first. Once your u-boot is fully tested and= finalized, you can fuse your <boot file> to eMMC flash.=
  2. When TEST# pin of SMARC-iMX= 8M is not shunt crossed, it will always boot up from on-module eMMC flash. = U-boot will read the BOOT_SEL configuration and determine where it= should load Image and device tree blob. When TEST# is shunt crossed (pull = low), it will always boot up from SD card.
=20
=20
=20

uEnv.txt based bootscript

Create "uEnv.txt" boot script: ($ vim uEnv.txt)

=20
=20

~/uEnv.txt

=20
=20

optargs=3D"video=3DHDMI-A-1:1920x1080-32@60 consoleblank=3D0"<= br />#optargs=3D"video=3DHDMI-A-1:3840x2160-32@30 consoleblank=3D0&quo= t;
#optargs=3D"video=3DHDMI-A-1:3840x2160-32@60 consoleblank=3D0&= quot;
#console port SER3
console=3Dttymxc0,115200 earlycon=3Dec_i= mx6q,0x30860000,115200
#console port SER2
#console=3Dttymxc1,1152= 00 earlycon=3Dec_imx6q,0x30890000,115200
#console port SER1
#cons= ole=3Dttymxc2,115200 earlycon=3Dec_imx6q,0x30880000,115200
#console po= rt SER0
#console=3Dttymxc3,115200 earlycon=3Dec_imx6q,0x30A60000,11520= 0
mmcdev=3D1
mmcpart=3D1
image=3DImage
loadaddr=3D0x404= 80000
fdt_addr=3D0x43000000
mmcroot=3D/dev/mmcblk1p2 rw
usbr= oot=3D/dev/sda2 rw
mmcrootfstype=3Dext4 rootwait fixrtc
netdev=3D= eth0
ethact=3DFEC0
ipaddr=3D192.168.1.150
serverip=3D192.168= .1.53
gatewayip=3D192.168.1.254
mmcargs=3Dsetenv bootargs console= =3D${console} root=3D${mmcroot} rootfstype=3D${mmcrootfstype} ${optargs}uenvcmd=3Drun loadimage; run loadfdt; run mmcboot
# USB Boot
#= usbargs=3Dsetenv bootargs console=3D${console} root=3D${usbroot} rootfstype= =3D${mmcrootfstype} ${optargs}
#uenvcmd=3Drun loadusbimage; run loadus= bfdt; run usbboot

=20
=20
=20

Copy uEnv.txt to the boot partition:

=20
=20

~/

=20
=20
$ sudo cp -v ~/uEnv.txt /media/boot/
=20
=20
=20

Install Kernel Image

Copy Image to the boot partition:

=20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>/

=20
=20
$ sudo cp -v Image /media/boot
=20
=20
=20

Install Kernel Device Tree Binary

=20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>/

=20
=20
$ sudo mkdir -p /media/boot/dtbs
$ sudo cp -v <device tree nam=
e> /media/boot/dtbs/fsl-smar=
cimx8mq.dtb
=20
=20
=20

All available DTB files are listed in= the table below.

DTB File Name Description
= fsl-smarcimx8mq.dtb Device tree b= lob for no display configuration.
= fsl-smarcimx8mq-hdmi.dtb Device tree b= lob for HDMI display configuration (DCSS).
= fsl-smarcimx8mq-hdmi-4k.dtb Device tree b= lob for HDMI 4k display configuration (DCSS).
= fsl-smarcimx8mq-lcdif-lvds.dtb Device tree b= lob for LCDIF LVDS display configuration.
= fsl-smarcimx8mq-dcss-lvds.dtb Device tree b= lob for DCSS LVDS display configuration.
= fsl-smarcimx8mq-dual-display.dtb Device tree b= lob for dual LVDS+HDMI display configuration.
fsl-smarcimx8mq-dp.dtb Device tree blob for Display Port (DP) display c= onfiguration.
fsl-smarcimx8mq-edp.dtb Device tree blob for Embedded Display Port (eDP)= display configuration.
=20
= =20
=20

The device tree name in your SD card has be to fsl-smarcimx8mq.dtb

= =20
=20
=20

Install Root File System


Copy Root File System:

Yocto Built Rootfs:

=20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>/

=20
=20
$ sudo tar jxvf <filename.tar.bz2> -C /media/rootfs
=20
=20
=20
=20

Note

=20 Icon=20
=20
  1. SMARC-iMX8M always boots up from on-module eMMCI flash first. = The firmware in eMMC flash is factory pre-installed from Embedian. It will = read the BOOT_SEL configuration that defined by SMARC specificatio= n on your carrier board and load Image and device tree blob from the partit= ion one of the device (could be SD card, eMMC, GBE,..etc) that you selected= .
  2. MAC address is factory pre-installed at on board I2C EEPROM at offset 6= 0 bytes. It starts with Embedian's vendor code 10:0D:32. u-boot wi= ll read it and pass this parameter to kernel.
  3. The kernel modules is included in the Yocto rootfs.
=20
=20
=20

Remove SD card:

=20
=20
=20
$ sync
$ sudo umo= unt /media/boot
$ sudo umo= unt /media/rootfs
=20
=20
=20

Setup SD Card Automatically


This section tells you how to set up an SD card automatically. It mainly= uses a script to do all the steps in the above section.

=20
=20
=20

$ cd ~/smarc-imx8m-sumo-rele= ase

$ sudo MACHINE=3Dsmarcimx8m2g sources/meta-smarcimx8m-sumo/scripts/emb_mk_yo= cto_sdcard/emb-create-yocto-sdcard.sh /dev/sdX

=20
=20
=20
=20 Icon=20
=20

The default output display is HDMI. If you need to use other device tree= output, change "DISPLAY" parameters in the script.

=20
=20
=20

Shunt cross TEST# pin to = ground and set the BOOT_SEL to ON OFF OFF. The module will boot up= from SD card.  

Feed Packages 


The following procedure can be used o= n a Embedian SMARC-iMX8M device to download and utilize = the feed file show above to install the tcpdump&n= bsp;Ethernet packet analyzer program:

=20
=20
=20
$ smart channel -y --add http://=
www.embedian.com/smarcimx8m-sumo-feed/imx8m_qt5wayland_update.repo
$ smart update
$ smart install tcpdump=20
=20
=20

 

Writing Bitbake Recipes


In order to package your application and include it in the root filesyst= em image, you must write a BitBake recipe for it.

When starting from scratch, it is easiest to learn by example from exist= ing recipes. 

Examp= le HelloWorld recipe using autotools

For software that uses autotools (./configure; make; make install), writ= ing recipes can be very simple:

 

DESCRIPTION =3D  "Hello World Recipe using autotools"
HOMEPAGE =3D  "http://www.embedian.com/"
SECTION =3D  "console/utils"
PRIORITY =3D  "optional"
LICENSE =3D  "GPL"
PR =3D  "r0"
  
S =3D  "${WORKDIR}/git"
  
inherit autotools

 

SRC_URI sp= ecifies the location to download the source from. It can take the form of a= ny standard URL using http://, ftp://, etc. It can also fetch from SCM syst= ems, such as git in the example above.

PR is the = package revision variable. Any time a recipe is updated that should require= the package to be rebuilt, this variable should be incremented.

inherit autotools brings in support for the package to be built using autotools, and = thus no other instructions on how to compile and install the software are n= eeded unless something needs to be customized.

S is the s= ource directory variable. This specifies where the source code will exist a= fter it is fetched from SRC_URI and unpacked. The default value is ${WORKDIR}/${PN}-${PV}, where PN&n= bsp;is the package name and PV is the package version. Both PN and PV are set by default using the = filename of the recipe, where the filename has the format PN_PV.bb.

Example HelloWorld recipe using a single source file

This example shows a simple case of building a helloworld.c file directl= y using the default compiler (gcc). Since it isn=E2=80=99t using autotools = or make, we have to tell BitBake how to build it explicitly.

 

DESCRIPTION =3D  "HelloWorld"
SECTION =3D  "examples"
LICENSE =3D  "GPL"
  
SRC_URI =3D  "file://helloworld.c"
  
S =3D  "${WORKDIR}"
  
do_compile() {
     ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o hellow= orld
}
  
do_install() {
     install -d ${D}${bindir}
     install -m 0755 helloworld ${D}${bindir}
}

 

In this case, SRC_URI specifies a file that must exist locally with the recipe. = Since there is no code to download and unpack, we set S to WORKDIR since that is where he= lloworld.c will be copied to before it is built.

WORKDIR is= located at ${OETREE}/<= build directory>/tmp/work/aarch64-poky-linux/<package name and versio= n> for most packages. If the package is machine-speci= fic (rather than generic for the aarxh64 architecture), it may be located i= n the aarch64-mx8m-poky-linux subdirectory depending on your hardware = (this applies to kernel packages, images, etc).

do_compile = ;defines how to compile the source. In this case, we just call gcc directly= . If it isn=E2=80=99t defined, do_compile runs make in the source directory by default.

do_install = ;defines how to install the application. This example runs install to create a bin = directory where the application will be copied to and then copies the appli= cation there with permissions set to 755.

D is the d= estination directory where the application is installed to before it is pac= kaged.

${bindir} = is the directory where most binary applications are installed, typically&nb= sp;/usr/bin.

For a more in-depth explanation of BitBake recipes, syntax, and variable= s, see the Recipe Ch= apter of the OpenEmbedded User Manual.

Setup eMMC Manually


Setting up eMMC usually is the last step at development stage after the = development work is done at your SD card or NFS environments. From software= point of view, eMMC is nothing but a non-removable SD card on board. For&n= bsp;SMARC-iMX8M, the SD card is always emulated as /dev/mmcblk1 an= d on-module eMMC is always emulated as /dev/mmcblk0. Setting up eMMC now is= nothing but changing the device descriptor. 

This section gives a step-by-step procedure to setup eMMC flash. Users c= an write a shell script your own at production to simplify the steps.

First, we need to backup the final firmware from your SD card or NFS.

Prepare for eMMC binaries from SD card = (or NFS):

Insert SD card into your Linux PC. For these instructions, we are assumi= ng: DISK=3D/dev/mmcblk0, "lsblk" is very useful for determining t= he device id.

For these instruction, we are assuming: DISK=3D/dev/mmcblk0, "lsblk= " is very useful for determining the device id.

=20
=20
=20
$ export DISK=3D/dev/mmcblk0
=20
=20
=20

Mount Partitions:

On some systems, these partitions may be auto-mounted...

=20
=20
=20
$ sudo mkd= ir -p /media/boot/
$ sudo mkd= ir -p /media/rootfs/
 
for: DISK=3D/dev/mmcblk0
$ sudo mou= nt ${DISK}p1 /media/boot/
$ sudo mou= nt ${DISK}p2 /media/rootfs/
 
for: DISK=3D/dev/sdX
$ sudo mou= nt ${DISK}1 /media/boot/
$ sudo mou= nt ${DISK}2 /media/rootfs/
=20
=20
=20

 

Copy Image to rootfs pa= rtition:

=20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>

=20
=20
$ sudo cp -v Image /media/rootfs=
/home/root
=20
=20
=20

Copy uEnv.txt to rootfs= partition:

Copy and paste the following contents to /media/rootfs/home/root ($ sudo= vim /media/rootfs/home/root/uEnv.txt)

=20
=20
=20

optargs=3D"video=3DHDMI-A-1:1920x1080-32@60 consoleblank=3D0"<= br />#optargs=3D"video=3DHDMI-A-1:3840x2160-32@30 consoleblank=3D0&quo= t;
#optargs=3D"video=3DHDMI-A-1:3840x2160-32@60 consoleblank=3D0&= quot;
#console port SER3
console=3Dttymxc0,115200 earlycon=3Dec_i= mx6q,0x30860000,115200
#console port SER2
#console=3Dttymxc1,1152= 00 earlycon=3Dec_imx6q,0x30890000,115200
#console port SER1
#cons= ole=3Dttymxc2,115200 earlycon=3Dec_imx6q,0x30880000,115200
#console po= rt SER0
#console=3Dttymxc3,115200 earlycon=3Dec_imx6q,0x30A60000,11520= 0
mmcdev=3D0
mmcpart= =3D1
image=3DImage
loadaddr=3D0x40480000
fdt_addr=3D0x430000= 00
mmcroot=3D/dev/mmcblk0p2 rw
usbroot=3D/dev/sda2 rw
mmcrootfstype=3Dext4 rootwait fixrtc<= br />netdev=3Deth0
ethact=3DFEC0
ipaddr=3D192.168.1.150
serv= erip=3D192.168.1.53
gatewayip=3D192.168.1.254
mmcargs=3Dsetenv bo= otargs console=3D${console} root=3D${mmcroot} rootfstype=3D${mmcrootfstype}= ${optargs}
uenvcmd=3Drun loadimage; run loadfdt; run mmcboot
# U= SB Boot
#usbargs=3Dsetenv bootargs console=3D${console} root=3D${usbro= ot} rootfstype=3D${mmcrootfstype} ${optargs}
#uenvcmd=3Drun loadusbima= ge; run loadusbfdt; run usbboot

=20
=20
=20

Copy device tree blob t= o rootfs partition:

=20
=20

~/smarc-imx8m-sumo-release/<build dir>/tmp/deploy/= images/<machine name>

=20
=20
$ sudo cp -v <device tree blo=
b> /media/rootfs/home/root/fsl-smarcimx8mq.dtb
=20
=20
=20

Copy real rootfs to roo= tfs partition:

=20
=20
=20
$ pushd /media/rootfs
$ sudo tar cvfz ~/sm=
arcimx8mq-emmc-rootfs.tar.gz .
$ sudo mv ~/smarcimx=
8mq-emmc-rootfs.tar.gz /media/rootfs/home/root
$ popd
= =20
=20
=20

Remove SD card:

=20
=20
=20
$ sync
$ sudo umo= unt /media/boot
$ sudo umo= unt /media/rootfs
=20
=20
=20

Copy Binaries to eMMC from SD card:

Insert this SD card into your SMARC-iMX8M device.

Now it will be almost the same as you did when setup your SD card, but t= he eMMC device descriptor is /dev/mmcblk0 now. Booting up the device.

=20
=20
=20
$ export DISK=3D/dev/mmcblk0
=20
=20
=20

Erase eMMC:

=20
=20
=20

$ sudo = dd if=3D/dev/zero of=3D${DISK} bs=3D2M count=3D16

=20
=20
=20

Create Partition Layout:

=20
=20
=20
$ sudo sfdisk ${DISK} <<-__EOF__
2M,<= /code>48M,0x83,*
50M,= ,,
__EO= F__
=20
=20
=20

Format Partitions:

=20
=20
=20
$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkfs.ext4 ${DISK}p2 -L rootfs
=20
=20
=20

Mount Partitions:

=20
=20
=20
$ sudo mkd= ir -p /media/boot/
$ sudo mkd= ir -p /media/rootfs/
$ sudo mou= nt ${DISK}p1 /media/boot/
$ sudo mou= nt ${DISK}p2 /media/rootfs/
=20
=20
=20

Install binaries for partition 1

Copy uEnv.txt/Image/*.dtb to the boot partition

=20
=20
=20

$ sudo cp = -v Image uEnv.txt /media/boot/
=20
=20
=20

Install Kernel Device Tree Binary

=20
=20
=20
$ sudo mkdir -p /media/boot/dtbs=
$ sudo cp -v fsl-smarcimx8mq.dtb=
 /media/boot/dtbs/
=20
=20
=20

Install Root File System


=20
=20
=20
$ sudo tar -zxvf smarcimx8=
mq-emmc-rootfs.tar.gz -C /media/rootfs
=20
=20
=20

 

Unmount eMMC:

=20
=20
=20
$ sync
$ sudo umo= unt /media/boot
$ sudo umo= unt /media/rootfs
=20
=20
=20

 

Switch your Boot Select to eMMC and you will be able to boot up from eMM= C now.

Setup eMMC Automatically 


Boot up the module from SD card and run the following script. The Yocto = images will be written into on-module eMMC.

=20
=20
=20

$ emb-create-yocto-emmc.sh /= dev/mmcblk0

=20
=20
=20

 Shutdown the device. Se= t TEST# pin= floating and set the BOOT_SEL to OFF ON ON. The module will boot up from on-module eM= MC. 

Video Decoding


For playing video, we can use three solutions to support it. <= /span>

a) # gplay-1.0 <video file>

b) # gst-launch-1.0 playbin uri=3Dfile://<video absolute path>

c) ( i ) if video container on .mp4 format

          # gst-launch-1.0 fil= esrc location=3D<file name.mp4> typefind=3Dtrue ! video/quicktime ! q= tdemux ! queue max-size-time=3D0 ! vpudec ! queue max-size-time=3D0 ! kmssi= nk force-hantrope=3Dtrue sync=3Dfalse &

    ( ii ) if video container on .ts format

         # gst-launch-1.0 filesrc location=3D&l= t;file name.ts> typefind=3Dtrue ! video/mpegts ! tsdemux ! queue max-siz= e-time=3D0 ! vpudec ! queue max-size-time=3D0 ! waylandsink


version 1.0a, 5/10/2019

Last updated 2020-02-07

------=_Part_5264_1176135309.1711718575706--