Skip to end of metadata
Go to start of metadata

Build and Install Debian Bullseye for SMARC-iMX8MP (Dual and Quad Core)


This document provides instructions for advanced users how Embedian offers patches and builds Debian Bullseye for Embedian's SMARC-iMX8MP 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-iMX8MP 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 Bullseye

$ cd ~/

$ git clone git@git.embedian.com:developer/smarc_mx8_debian.git smarc_mx8mp_debian -b debian_bullseye_mx8mp

$ cd ~/smarc_mx8mp_debian

$ MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c deploy

This environment prepared to build.

Icon

If the LPDDR4 is 6GB on your SMARC module, the MACHINE name will be smarcims8mp6g

Make Debian


Build all


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

$ cd ~/smarc_mx8mp_debian

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c all |& tee build.log

Icon

If the LPDDR4 is 6GB on your SMARC module, the MACHINE name will be smarcimx8mp6g


Build by parts


Build bootloader


 

$ cd ~/smarc_mx8mp_debian

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c bootloader

Build kernel, dtb files and kernel modules


 

$ cd ~/smarc_mx8mp_debian

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c kernel

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c modules

Build rootfs


 

$ cd ~/smarc_mx8mp_debian

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c rootfs

Pack rootfs


 

$ cd ~/smarc_mx8mp_debian

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_debian.sh -c rtar

Icon

If the LPDDR4 is 6GB on your SMARC module, the MACHINE name will be smarcims8mp6g

Setup SD card Automatically


 

$ cd ~/smarc_mx8mp_debian

$ sudo MACHINE=smarcimx8mp4g ./smarc_make_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-iMX8MP booting with Debian Bullseye. Console port is defined on SER3

 

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

All available DTB files are listed in the table below.


DTB File NameDescription
imx8mp-smarc.dtbDevice tree blob for no display configuration.
imx8mp-smarc-hdmi.dtbDevice tree blob for HDMI display configuration.
imx8mp-smarc-lvds.dtbDevice tree blob for LVDS display configuration.
imx8mp-smarc-m7.dtbDevice tree blob for Cortex-M7 co-processor configuration.


  1. The default display output is hdmi. If you would like to change to default display output to different interfaces, make changes the file smarc_make_debian.sh and find readonly DISPLAY="-lvds"
    No Display: readonly DISPLAY=""
    HDMI: readonly DISPLAY="-hdmi"
    LVDS : readonly DISPLAY="-lvds"
    M7: readonly DISPLAY="-m7"

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-iMX8MP will always boot up from SD card. 

Fuse flash.bin to the SD card. 

~/


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

uEnv.txt based bootscript

Copy uEnv.txt to the boot partition:

~/smarc_mx8_debian


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

Install Kernel Image

Copy Image to the boot partition:

~/smarc_mx8_debian


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

Install Kernel Device Tree Binary

$ sudo mkdir -p /media/boot/dtbs

$ sudo cp -v output/<device tree name> /media/boot/dtbs/imx8mp-smarc.dtb

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

All available DTB files are listed in the table below.


DTB File NameDescription
imx8mp-smarc.dtbDevice tree blob for no display configuration.
imx8mp-smarc-hdmi.dtbDevice tree blob for HDMI display configuration.
imx8mp-smarc-lvds.dtbDevice tree blob for LVDS display configuration.
imx8mp-smarc-m7.dtbDevice tree blob for Cortex-M7 co-processor configuration.


The device tree name in your SD card has be to imx8mp-smarc.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_mx8mp_debian/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
imx8mp-smarc.dtbDevice tree blob for no display configuration.
imx8mp-smarc-hdmi.dtbDevice tree blob for HDMI display configuration.
imx8mp-smarc-lvds.dtbDevice tree blob for LVDS display configuration.
imx8mp-smarc-m7.dtbDevice tree blob for Cortex-M7 co-processor configuration.

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.

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

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

Modify the kernel configuration


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

$ cd ~/smarc_mx8mp_debian/src/kernel

$ sudo make arch=arm64 mrproper

$ sudo make arch=arm64 smarcimx8mp_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 make ARCH=arm64 savedefconfig

$ sudo cp arch/arm64/configs/smarcimx8mp_defconfig arch/arm64/configs/smarcimx8mp_defconfig.orig

$ sudo cp .config arch/arm64/configs/smarcimx8mp_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>

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

          gst-launch-1.0 filesrc location=<file name.mp4> typefind=true ! video/quicktime ! qtdemux ! queue max-size-time=0 ! vpudec ! queue max-size-time=0 ! kmssink force-hantrope=true sync=false &

    ( ii ) if video container on .ts format

         # gst-launch-1.0 filesrc location=<file name.ts> typefind=true ! video/mpegts ! tsdemux ! queue max-size-time=0 ! vpudec ! queue max-size-time=0 ! waylandsink


version 1.0a, 12/20/2021

Last updated 2021-12-20

  • No labels