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

Debian_Stretch_SMARC-iMX8M

=20 =20

Build= and Install Debian Stretch for SMARC-iMX8M (Dual, Quad = Lite and Quad Core)


This document provides instructions for advanced users how Embedian offe= rs patches and builds Debian Stretch for Embedian's SMARC-iMX8M product platform and how to install the images to bring the evaluat= ion 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 Embe= dian 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 Stretch

=20
=20
=20

$ cd ~/

$ git clone git@git.embedi= an.com:developer/smarc_mx8m_debian_stretch.git -b debian_stretch_mx8m_s= marc01

$ cd ~/smarc_mx8m_debian_stretch

$ ./make_smarc_mx8m_debian.sh -c deploy

= =20
=20
=20

This environment prepared to build.

Make Debian


Build all


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

=20
=20
=20

$ cd ~/smarc_mx8m_de= bian_stretch

$ sud= o ./make_smarc_mx8m_debian.sh -c all = | tee 2.log

=20
=20
=20

Build by parts


Build bootloader


 

=20
=20
=20

$ cd ~/sm= arc_mx8m_debian_stretch

$ sud= o ./make_smarc_mx8m_debian.sh -c bootloader

=20
=20
=20

= Build kernel, dtb files and kernel= modules


 

=20
=20
=20

$ cd ~/smarc_mx8m_debian_str= etch

$ sud= o ./make_smarc_mx8m_debian.sh -c kernel

$ sud= o ./make_smarc_mx8m_debian.sh -c modules

=20
=20
=20

Build rootfs


 

=20
=20
=20

$ cd ~/smarc_mx8m_debian_str= etch

$ sud= o ./make_smarc_mx8m_debian.sh -c rootfs

=20
=20
=20

Pack rootfs


 

=20
=20
=20

$ cd ~/smarc_mx8m_debian_str= etch

$ sud= o ./make_smarc_mx8m_debian.sh -c rtar

=20
=20
=20

Setup SD card Automatically


 

=20
=20
=20

$ cd ~/smarc_mx8m_debian_str= etch

$ sud= o ./make_smarc_mx8m_debian.sh -c sdcard -d /dev/sdX=20

=20
=20


where "/dev/sdX" i= s the SD block device in your host system. Shunt the "TEST#" pin = of your device to Ground. Insert the SD card and you will see SMARC-iMX8M b= ooting with Debian Stretch. Console port is defined on SER3


=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
= 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-dp.dtb Device tree b= lob for Display Port (DP) 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-edp.dtb Device tree b= lob for Embedded Display Port (eDP) display configuration (DCSS).
=20
= =20
=20
  1. The default display output is HDMI. If you would like to change to defa= ult display output to different interfaces, make chages the file make_smarc= _mx8m_debian.sh and find readonly DISP= LAY=3D"-hdmi"
    No Display: readonly DISPLAY=3D""
    LVDS (DCSS): = readonly DISPLAY=3D"-dcss-lv= ds"
    LVDS (LCDIF): readonly DISPLAY=3D"lcdif-lvds"
    Dual Display: readonly DISPLAY=3D"= -dual-display"
    Display Port: readon= ly DISPLAY=3D"-dp"
    Embedded Display Port: readonly DISPLAY=3D"-edp"
=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_mx8m_debian_stretch
$ 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_mx8m_debian_stretch

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

=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/fsl-= smarcimx8mq.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
= 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-dp.dtb Device tree b= lob for Display Port (DP) 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-edp.dtb Device tree b= lob for Embedded Display Port (eDP) display configuration (DCSS).
=20
= =20
=20

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

= =20
=20
=20

Install Root File System and Ke= rnel 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_mx8m_debian_stretch/output directory:=

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
= 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-dp.dtb Device tree b= lob for Display Port (DP) 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-edp.dtb Device tree b= lob for Embedded Display Port (eDP) display configuration (DCSS).

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<= /em> user.

=20
=20
=20

$ debian-emmc.sh -d <-hdm= i/-dp/-lcdif-lvds/-dcss-lvds/-dual-display/-edp>

= =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_mx8m_debian_str= etch/src/kernel

$ sudo make arch=3Darm64 mrp= roper

$ sudo make arch=3Darm64 sma= rcimx8m_defconfig

$ sudo make arch=3Darm64 men= uconfig

 

Navigate the menu and select= the desired kernel functionality Exit the menu and answer "Yes" = when asked "Do you wish to save your new configuration?" $ sudo m= ake ARCH=3Darm64 savedefconfig $ sudo cp arch/arm64/configs/smarcimx8m_defc= onfig arch/arm64/configs/smarcimx8m_defconfig.orig $ sudo cp .config arch/a= rm64/configs/smarcimx8m_defconfig Follow the instructions above to rebuild = kernel and modules, repack rootfs images and recreate SD card=

=20
=20
=20

Video Decoding


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

a) # gplay-1.0 <video file&= gt;

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

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

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

    ( ii ) if video container on .ts format

        =  # gst-launch-1.0 filesrc location=3D<file name.ts> typefind=3Dt= rue ! video/mpegts ! tsdemux ! queue max-size-time=3D0 ! vpudec ! queue max= -size-time=3D0 ! waylandsink


version 1.0a, 5/13/2019

Last updated 2019-05-13

------=_Part_5230_1774710156.1711667870013--