Skip to end of metadata
Go to start of metadata

Build and Install Debian Stretch for SMARC-iMX8MM (Solo, Solo Lite, Dual, Dual Lite, Quad and Quad Lite Core)


This document provides instructions for advanced users how Embedian offers patches and builds Debian Stretch for Embedian's SMARC-iMX8MM product platform and how to install the images to bring the evaluation board up and running. 

Our aim is to fully support our hardware through device drivers. We also provide unit tests so that testing a board is easy and custom development can start precisely. The recommended host environment is Ubuntu 16.04.

Availability


SMARC-iMX8MM from Embedian

Carrier Board


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

Basic Resources


 

Generating SSH Keys


We recommend you use SSH keys to establish a secure connection between your computer and Embedian Gitlab server. To download u-boot and kernel source 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 through generating an SSH key and 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 Git Bash and run:

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, 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 key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

Now you need to enter a passphrase.

Which should give you something like this:

Step 3. Add your SSH key to Embedian Gitlab Server


Copy the key to your clipboard.

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:

$ sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx \
lvm2 dosfstools gpart binutils git lib32ncurses5-dev python-m2crypto 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 subversion \
coreutils texi2html bc 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 mtd-utils device-tree-compiler

Deploy Sources


 Download archive containing the build script and support files for building Debian Stretch

$ cd ~/

$ git clone git@git.embedian.com:developer/smarc_mx8m_debian_stretch.git smarc_mx8mm_debian_stretch -b debian_stretch_mx8mm_smarc01

$ cd ~/smarc_mx8mm_debian_stretch

$ ./make_smarc_mx8m_debian.sh -c deploy

This environment prepared to build.

Make Debian


Build all


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

$ cd ~/smarc_mx8mm_debian_stretch

$ sudo ./make_smarc_mx8m_debian.sh -c all | tee 2.log

Build by parts


Build bootloader


 

$ cd ~/smarc_mx8mm_debian_stretch

$ sudo ./make_smarc_mx8m_debian.sh -c bootloader

Build kernel, dtb files and kernel modules


 

$ cd ~/smarc_mx8mm_debian_stretch

$ sudo ./make_smarc_mx8m_debian.sh -c kernel

$ sudo ./make_smarc_mx8m_debian.sh -c modules

Build rootfs


 

$ cd ~/smarc_mx8mm_debian_stretch

$ sudo ./make_smarc_mx8m_debian.sh -c rootfs

Pack rootfs


 

$ cd ~/smarc_mx8mm_debian_stretch

$ sudo ./make_smarc_mx8m_debian.sh -c rtar

Setup SD card Automatically


 

$ cd ~/smarc_mx8mm_debian_stretch

$ sudo ./make_smarc_mx8m_debian.sh -c sdcard -d /dev/sdX


where "/dev/sdX" is 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-iMX8MM booting with Debian Stretch. Console port is defined on SER3


The device tree file of SMARC-iMX8MM is fsl-smarcimx8mm.dtb

Setup SD Card Manually


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

$ export DISK=/dev/mmcblk0

Erase SD card:

$ sudo dd if=/dev/zero of=${DISK} bs=1M count=16

Create Partition Layout: Leave 2MB offset for flash.bin.

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

sfdisk

$ sudo sfdisk --version
sfdisk from util-linux 2.27.1

Create Partitions:

sfdisk >=2.26.x

Icon
$ sudo sfdisk ${DISK} <<-__EOF__
2M,48M,0x83,*
50M,,,
__EOF__

sfdisk <=2.25

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

Format Partitions:

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

Mount Partitions:

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

$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
 
for: DISK=/dev/mmcblk0
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
 
for: DISK=/dev/sdX
$ sudo mount ${DISK}1 /media/boot/
$ sudo mount ${DISK}2 /media/rootfs/

Install Boot File

Users need to shunt cross the TEST# pin to ground. In this way, SMARC-iMX8MM will always boot up from SD card. 

Fuse flash.bin to the SD card. 

~/


$ cd ~/smarc_mx8mm_debian_stretch
$ sudo dd if=output/imx-boot-sd.bin of=${DISK} bs=1024 seek=33

uEnv.txt based bootscript

Copy uEnv.txt to the boot partition:

~/smarc_mx8m_debian_stretch


$ sudo cp -v embedian/uEnv.txt /media/boot/

Install Kernel Image

Copy Image to the boot partition:

~/smarc_mx8mm_debian_stretch


$ sudo cp -v output/Image /media/boot

Install Kernel Device Tree Binary

$ sudo mkdir -p /media/boot/dtbs

$ sudo cp -v output/fsl-imx8mm.dtb /media/boot/dtbs/fsl-smarcimx8mm.dtb

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

Install Root File System and Kernel Modules


Extract Root File System:

directory where your root file system is


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

Note

Icon
  1. MAC address is factory pre-installed at on board I2C EEPROM at offset 60 bytes). It starts with Embedian's vendor code 10:0D:32. u-boot will read it and pass this parameter to kernel.
  2. Kernel module is pre-built in debian rootfs
  3. The default console port is SER3.


Remove SD card:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

Build Results


The resulted images are locared in ~/smarc_mx8mm_debian_stretch/output directory:

Image NameDescription
rootfs.tar.gzRoot filesystem tarball for installation on SD card and eMMC
ImageLinux Kernel Image
imx-boot-sd.binBoot file for SD card and eMMC
DTB File NameDescription
fsl-smarcimx8mm.dtbdevice tree blob for SMARC-iMX8MM

Linux Console Access


User NameUser PasswordUser Descriptor
rootrootsystem administrator
useruserlocal user
x_user used for X session access

Setup eMMC


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

$ debian-emmc.sh

Modify the kernel configuration


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

$ cd ~/smarc_mx8mm_debian_stretch/src/kernel

$ sudo make arch=arm64 mrproper

$ sudo make arch=arm64 smarcimx8mm_defconfig

$ sudo make arch=arm64 menuconfig

 

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 cp .config arch/arm64/configs/smarcimx8mm_defconfig

Follow the instructions above to rebuild kernel and modules, repack rootfs images and recreate SD card


Video Decoding


For playing video, we can use three solutions to support it. 

a) # gplay-1.0 <video file>

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


version 1.0a, 3/19/2020

Last updated 2020-03-19

  • No labels