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

Debian_Bullseye_SMARC-iMX8M

=20 =20

Bui= ld and Install Debian Bullseye for SMARC-iMX8M (Dua= l, Quad Lite and Quad Core)


This document provides instructions for advanced users how Embedian offe= rs patches and builds Debian Bullseye for Embedian's SMARC-iM= X8M product platform and how to install the images to bring the e= valuation board up and running. 

Our aim is to fully support our hardw= are through device drivers. We also provide unit tests so that testing a bo= ard is easy and custom development can start precisely. The recommended hos= t environment is Ubuntu 16.04.

Availability


= SMARC-iMX8M from Embedian

Carrier Board


= EVK-STD-CARRIER-S20 (universal carrier board for all SMARC 2.0 mod= ules) from Embedian

Basic Resources


 

Generating SSH Keys


We recommend you use SSH keys to establish a secure connection between y= our computer and Embedian Gitlab server. To download u-boot and kernel sour= ce codes from Embedian server. You need to register from Embedian's Gitlab = server and put your ssh public key there. The steps below will walk you thr= ough generating an SSH key and then adding the public key to our Gitlab acc= ount.

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 listing to see if you have a file named either = id_rsa.pub or id_dsa.pub. If you don't = have either of those files go to step 2. Otherwise, y= ou already have an existing keypair, and you can skip to step = 3.

Step 2. Generate a new SSH key


To generate a new SSH key, enter the code below. We want the default set= tings so when asked to enter a file in which to save the key, just press en= ter.

=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 something 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

Step 3. Add your SSH key to Emb= edian Gitlab Server


Copy the key to your clipboard.

=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.

Create build environment


Install required packages


On Ubuntu machine:

=20
=20
=20 $ sudo apt-get install binfmt-support qemu qemu-user-static debootstr= ap kpartx \
lvm2 dosfstools gpart binutils git lib32ncurses5-dev python-m2cr=
ypto gawk wget \
git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat =
libsdl1.2-dev \
autoconf libtool libglib2.0-dev libarchive-dev python-git xterm sed cvs sub=
version \
coreutils texi2html bc docbook-utils python-pysqlite2 help2man make gcc g++=
 \
desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial automake grof=
f curl \
lzop asciidoc u-boot-tools mtd-utils device-tree-compiler
=20
=20
=20

Deploy Sources


 Download archive containing the build script and support files f= or building Debian Bullseye

=20
=20
=20

$ cd ~/

$ git clone git@git.embedi= an.com:developer/smarc_mx8_debian.git smarc_mx8mq_debian -b debian_bull= seye_mx8mq

$ cd ~/smarc_mx8mq_debian

$ MACHINE=3Dsmarcimx8mq4g ./= smarc_make_debian.sh -c deploy

=20
=20
=20

This environment prepared to build.

=20
=20 Icon=20
=20

If the LPDDR4 is 2GB on your SMARC module, the MACHINE name will be smarcims8m2g

=20
=20
=20

Make Debian


Build all


 The internet connection in your= host PC has to be available.

=20
=20
=20

$ cd ~/smarc_mx8mq_debian

$ sudo MACHINE=3Dsmarcimx8mq= 4g ./smarc_make_debian.sh -c all |& tee build.log

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

If the LPDDR4 is 2GB on your SMARC module, the MACHINE name will be smarcims8m2g


=20
=20
=20

Build by parts


Build bootloader


 

=20
=20
=20

$ cd ~/smarc_mx8mq_debian

$ sudo MACHINE=3Dsmarc= imx8mq4g ./smarc_make_debian.sh -c bootloader

=20
=20
=20

Build kernel, dtb files and kerne= l modules


 

=20
=20
=20

$ cd ~/smarc_mx8mq_debian

$ sudo MACHINE=3Dsmarc= imx8mq4g ./smarc_make_debian.sh -c kernel

$ sudo MACHINE=3Dsmarc= imx8mq4g ./smarc_make_debian.sh -c modules

=20
=20
=20

Build rootfs


 

=20
=20
=20

$ cd ~/smarc_mx8mq_debian

$ sudo MACHINE=3Dsmarc= imx8mq4g ./smarc_make_debian.sh -c rootfs

=20
=20
=20

Pack rootfs


 

=20
=20
=20

$ cd ~/smarc_mx8mq_debian

$ sudo MACHINE=3Dsmarc= imx8mq4g ./smarc_make_debian.sh -c rtar

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

If the LPDDR4 is 2GB on your SMARC module, the MACHINE name will be smarcims8m2g

=20
=20
=20

Setup SD card Automatically


 

=20
=20
=20

$ cd ~/smarc_mx8mq_debian

$ sudo MACHINE=3Dsmarc= imx8mq4g ./smarc_make_debian.sh -c sdcard -d /dev/sdX<= /p>=20

=20
=20


where "/dev/sdX" is the SD block device in your host sys= tem. Shunt the "TEST#" pin of your device to Ground. Insert the S= D card and you will see SMARC-iMX8M booting with Debian Bullseye. Console p= ort is defined on SER3<= /span>. 

=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

 

Selecting display configuration is a = matter of selecting an appropriate DTB file.

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

DTB File Name Description
= imx8mq-smarc.dtb Device tree b= lob for no display configuration.
= imx8mq-smarc-hdmi.dtb Device tree b= lob for HDMI display configuration (DCSS).
= imx8mq-smarc-dp.dtb Device tree b= lob for Display Port (DP) display configuration (DCSS).
= imx8mq-smarc-lcdif-lvds.dtb Device tree b= lob for LCDIF LVDS display configuration.
= imx8mq-smarc-dcss-lvds.dtb Device tree b= lob for DCSS LVDS display configuration.
= imx8mq-smarc-dual-display.dtb Device tree b= lob for dual LVDS+HDMI display configuration.


=20
= =20
=20
  1. The default display output is lcdif-lvds. If you would like to change t= o default display output to different interfaces, make changes the file sma= rc_make_debian.sh and find reado= nly DISPLAY=3D"-lcdif-lvds"
    No Display: readonly DISPLAY=3D""
    HDMI: readonly DISPLAY=3D"= -hdmi"
    LVDS (DCSS): readonly DISPLAY=3D"-dcss-lvds"=
    LVDS (LCDIF): readonl= y DISPLAY=3D"lcdif-lvds&q= uot;
    Dual Display: readonly DISPLAY=3D"-dual-display"
    Display Port: = readonly DISPLAY=3D"<= span style=3D"color: rgb(0,51,102);">-dp"
=20
=20
=20

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 flash.bin.

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 sfd= isk ${DISK} <<-__EOF__
2M<= code class=3D"java plain">,48M,0x83,*
50M,,,
__EOF__
=20
=20
=20
=20

sfdisk <=3D2.25

=20 Icon=20
=20
$ sudo sfd= isk --in-order --Linux --unit M ${DISK} <<-__EOF__
2,<= code class=3D"java value">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

Users need to shunt cross the TEST# = ;pin to ground. In this way, SMARC-iMX8M will always boo= t up from SD card. 

Fuse flash.bin to the SD card. 

= =20
=20

~/

=20
=20

$ cd ~/smarc_mx8mq_debian
$ sudo= dd if=3Doutput/imx-boot-sd.bin of=3D${DISK} bs=3D1024 seek=3D33
=20
=20
=20

uEnv.txt based bootscript

Copy uEnv.txt to the boot partition:

=20
=20

~/smarc_mx8_debian

=20
=20

$ sudo cp -v embedian/uEnv.t= xt /media/boot/

=20
=20
=20

Install Kernel Image

Copy Image to the boot partition:

=20
=20

~/smarc_mx8_debian

=20
=20

$ sudo cp -v output/Image /m= edia/boot

=20
=20
=20

Install Kernel Device Tree Binary=20
=20
=20

$ sudo mkdir -p /media/boot/= dtbs

$ sudo cp -v output/<devi= ce tree name> /media/boot/dtbs/imx= 8mq-smarc.dtb

=20
=20
=20

Selecting display configuration is a = matter of selecting an appropriate DTB file.

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

DTB File Name Description
= imx8mq-smarc.dtb Device tree b= lob for no display configuration.
= imx8mq-smarc-hdmi.dtb Device tree b= lob for HDMI display configuration (DCSS).
= imx8mq-smarc-dp.dtb Device tree b= lob for Display Port (DP) display configuration (DCSS).
= imx8mq-smarc-lcdif-lvds.dtb Device tree b= lob for LCDIF LVDS display configuration.
= imx8mq-smarc-dcss-lvds.dtb Device tree b= lob for DCSS LVDS display configuration.
= imx8mq-smarc-dual-display.dtb Device tree b= lob for dual LVDS+HDMI display configuration.


=20
= =20
=20

The device tree name in your SD card has be to imx8mq-smarc.dtb

=20
=20
=20

Install Root File System and K= ernel Modules


Extract Root File System:

=20
=20

directory where your root file system is

=20
=20

$ sudo tar xvfz output/rootf= s.tar.gx -C /media/rootfs

=20
=20
=20
=20

Note

=20 Icon=20
=20
  1. 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 w= ill read it and pass this parameter to kernel.
  2. Kernel module is pre-built in debian rootfs
  3. The default console port is S= ER3.
=20
=20
=20


Remove SD card:

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

Build Results


The resulted images are locared in=  ~/smarc_mx8mq_debian/output directo= ry:

Image Name Description
rootfs.tar.gz Root filesystem tarball for installation on SD c= ard and eMMC
Image Linux Kernel Image
imx-boot-sd.bin Boot file for SD card and eMMC
DTB File Name Description
= imx8mq-smarc.dtb Device tree b= lob for no display configuration.
= imx8mq-smarc-hdmi.dtb Device tree b= lob for HDMI display configuration (DCSS).
= imx8mq-smarc-dp.dtb Device tree b= lob for Display Port (DP) display configuration (DCSS).
= imx8mq-smarc-lcdif-lvds.dtb Device tree b= lob for LCDIF LVDS display configuration.
= imx8mq-smarc-dcss-lvds.dtb Device tree b= lob for DCSS LVDS display configuration.
= imx8mq-smarc-dual-display.dtb Device tree b= lob for dual LVDS+HDMI display configuration.

Linux Console Access


User Name User Password User Descriptor
root root system administrator
user user local user
x_user   used for X session access

Setup eMMC


Shunt TEST# pin to Ground and boot up from your SD card. Run the followi= ng command as = root user.

=20
=20
=20

$ install_debian.sh -d <-= hdmi/-dp/-lcdif-lvds/-dcss-lvds/-dual-display/-edp>
<= /p>=20

=20
=20
= =20
=20
  1. The "-d" parameter specifies which device tree blob that you = would like copy to eMMC. <= br />No Display: readonly DISPLAY=3D&= quot;"
    LVDS (DCSS): -d -dcss-lvds
    LVDS (LCDIF): -d lcdif-lvds
    Dual Display: -d -dual-display
    Display Port: -d -dp
    Embedded Display -d -edp
=20
=20
=20

Modify the kernel configuration


To modify the kernel configuration (add/remove features and drivers). Pl= ease follow the step below.

=20
=20
=20

$ cd ~/smarc_mx8mq_debian/sr= c/kernel

$ sudo make arch=3Darm64 mrp= roper

$ sudo make arch=3Darm64 sma= rcimx8mq_defconfig

$ sudo make arch=3Darm64 men= uconfig

 

Navigate the menu and select= the desired kernel functionality.

Exit the menu and answer &qu= ot;Yes" when asked "Do you wish to save your new configuration?&q= uot;

$ sudo make ARCH=3Darm64 sav= edefconfig

$ sudo cp arch/arm64/configs= /smarcimx8mq_defconfig arch/arm64/configs/smarcimx8mq_defconfig.orig

$ sudo cp .config arch/arm64= /configs/smarcimx8mq_defconfig

Follow the instructions abov= e to rebuild kernel and modules, repack rootfs images and recreate SD card<= /span>

=20
=20
=20


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 playb= in uri=3Dfile://<video absolute path>

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

          gst-launch-1.0 filesrc location=3D<file name.mp4> typef= ind=3Dtrue ! video/quicktime ! qtdemux ! queue max-size-time=3D0 ! vpudec != queue max-size-time=3D0 ! kmssink force-hantrope=3Dtrue sync=3Dfalse &=

    ( ii ) if video container on .ts format

       &= nbsp; # gst-launch-1.0 filesrc location=3D<file name.ts> typefin= d=3Dtrue ! video/mpegts ! tsdemux ! queue max-size-time=3D0 ! vpudec ! queu= e max-size-time=3D0 ! waylandsink


version 1.0a, 6/12/2020

Last updated 2020-06-12

------=_Part_5244_639623200.1711689841439--