Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Generating SSH Keys


In order to download u-boot and kernel from Embedian. We recommend you use SSH keys to establish a secure connection between your computer and Embedian Gitlab server. 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: 

Code Block
themeConfluence
languagecpp
$ cd ~/.ssh
$ ls
# Lists the files in your .ssh directory

 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.

Code Block
themeConfluence
languagecpp
$ 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 enter]
$ ssh-add id_rsa

 Now you need to enter a passphrase.

Code Block
themeConfluence
languagecpp
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

 Which should give you something like this:

Code Block
themeConfluence
languagecpp
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

Step 3. Add your SSH key to Embedian Gitlab Server


 Copy the key to your clipboard.

Code Block
themeConfluence
languagecpp
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAABDAQABAAABAQDQUEnh8uGpfxaZVU6+uE4bsDrs/tEE5/BPW7jMAxak
6qgOh6nUrQGBWS+VxMM2un3KzwvLRJSj8G4TnTK2CSmlBvR+X8ZeXNTyAdaDxULs/StVhH+QRtFEGy4o
iMIzvIlTyORY89jzhIsgZzwr01nqoSeWWASd+59JWtFjVy0nwVNVtbek7NfuIGGAPaijO5Wnshr2uChB
Pk8ScGjQ3z4VqNXP6CWhCXTqIk7EQl7yX2GKd6FgEFrzae+5Jf63Xm8g6abbE3ytCrMT/jYy5OOj2XSg
6jlxSFnKcONAcfMTWkTXeG/OgeGeG5kZdtqryRtOlGmOeuQe1dd3I+Zz3JyT your_email@example.c
om

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 this document


The objective of this document is to guide SMARC-iMX8MM Android developers to obtain Android P9.0.0_2.0.0-ga Pie sources, setting up host environment, compilation and deployment.

This document contains instructions for:

  • Hardware and software requirements.
  • Setup the hardware.
  • Setup the toolchain.
  • Download & build the sources.
  • Install the binaries on the SMARC-iMX8M SOM.

Hardware Requirement


EVK-STD-CARRIER-S20 and SMARC-iMX8M.iMX8MM 

Host (PC) setup requirements

The host development environment for Android is based on Ubuntu and Debian, please install Ubuntu version 16.04 64bit LTS http://www.ubuntu.com/download/desktop or Debian 9.6 64bit https://www.debian.org/releases

Note

Do not use other Ubuntu or Debian releases, than recommended above.

Install required packages on host PC

Code Block
themeConfluence
languagecpp
$ sudo apt-get -y install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib 	
$ sudo apt-get -y install libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils 
$ sudo apt-get -y install xsltproc unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev android-tools-fsutils

Install the OpenJDK

Code Block
themeConfluence
languagecpp
$ sudo apt-get update 
$ sudo apt-get install openjdk-8-jdk


Update the default Java version by running:

Code Block
themeConfluence
languagecpp
$ sudo update-alternatives --config java 
$ sudo update-alternatives --config javac
Note

The build machine should have at least 50GB of free space to complete the build process.

Obtain Source Code


Get NXP's Android Release Package

Go to NXP's website, download IMX8MQ_ i.MX8M Mini P9.0.0_2.0.0_ANDROID_SOURCE_BSP (filename: imx-p9.0.0_2.0.0-ga.tar.gz and put into your ~/downloads directory.

Code Block
themeConfluence
languagecpp
$ cd ~/downloads
$ tar xvfz imx-p9.0.0_2.0.0-ga.tar.gz

Obtain Google Android Pie P9.0.0_2.0.0-ga source code and Apply NXP's patch

Code Block
themeConfluence
languagecpp
$ mkdir -p ~/android/smarcimx8msmarcimx8mm/p_900_200 
$ cd ~/android/smarcimx8msmarcimx8mm/p_900_200
$ mkdir ~/bin 
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo 
$ chmod a+x ~/bin/repo 
$ export PATH=~/bin:$PATH 
$ mv ~/download/imx-p9.0.0_2.0.0-ga .
$ source imx-p9.0.0_2.0.0-ga/imx_android_setup.sh

After done, it will create an android_build directory. Go to this directory.

Clone Embedian's U-Boot and Linux kernel sources

Code Block
themeConfluence
languagecpp
$ cd ~/android/smarcimx8msmarcimx8mm/p_900_200/android_build
$ mkdir -p vendor/embedian
$ cd vendor/embedian
$ git clone git@git.embedian.com:developer/smarc-t335x-uboot.git uboot-imx -b smarc-8m8mm-p9.0.0_2.0.0_ga
$ git clone git@git.embedian.com:developer/smarc-fsl-linux-kernel.git kernel_imx -b smarc-8m8mm-p9.0.0_2.0.0_ga

Apply Embedian's patches for  i.

MX8M

MX8M Mini platforms

Code Block
themeConfluence
languagecpp
$ cd ~/android/smarcimx8msmarcimx8mm/p_900_200/android_build/device
$ git clone git@git.embedian.com:developer/smarc-imx8m-android.git embedian -b smarc-8m8mm-p9.0.0_2.0.0_ga
$ embedian/scripts/install.sh

Build Android Images


Change to Android top level directory.
Code Block
themeConfluence
languagecpp
$ export MY_ANDROID=~/android/smarcimx8msmarcimx8mm/p_900_200/android_build
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
$ export PATH=$JAVA_HOME/bin/:$PATH
$ lunch smarc_mx8mqmx8mm-eng
or
$ lunch smarc_mx8mqmx8mm-userdebug
$ make -j4 2>&1 | tee build1-1.log
Note

userdebug build creates a debuggable version of Android. eng build creates an engineering version of Android. Development mode enable and development tools are available on target.

Images created by the Android build for SMARC-

iMX8M

iMX8MM system

The images created are located at out/target/product/smarc_mx8mmx8mm/ directory.

ImageDescription
u-boot-smarcim8mqimx8mm-smarcim8mm_2g.imx

Bootloader for eMMC/SD card boot for SMARC-iMX8M-D/Q-2G(-I)iMX8MM with 2GB LPDDR4

Other SMARC variants could be defined at device/embedian/smarc_mx8mmx8mm/BoardConfig.mk

u-boot-smarcim8mqimx8mm-smarcim8mm_2g_uuu.imx

Bootloader used by uuu for eMMC/SD card boot for SMARC-iMX8M-D/Q-2G(-I)iMX8MM with 2GB LPDDR4

Other SMARC variants could be defined at device/embedian/smarc_mx8mmx8mm/BoardConfig.mk

boot-<name>.imgBoot image for SMARC-iMX8MiMX8MM
partition-table.imgGPT table image for 16GB SD card and eMMC.
partition-table-7GB.imgGPT table image for 8GB SD card and eMMC.
partition-table-28GB.imgGPT table image for 28GB SD card and eMMC.
system.imgSystem Boot image
vbmeta-<name>smarcimx8mm.imgAndroid Verified Boot metadata Image for SMARC-iMX8M iMX8MM to support different display output
vendor.imgVendor image
dtbo-<name>smarcimx8mm.imgDevice Tree image for SMARC-iMX8M iMX8MM to support different display output<name>

 

smarcimx8mq Support no display configuration.

smarcimx8mq-hdmi Support HDMI display configuration (DCSS).

smarcimx8mq-dp Support Display Port (DP) display configuration (DCSS).

smarcimx8mq-edp Support Embedded Display Port (eDP) display configuration (DCSS).

smarcimx8mq-lcdif-lvds Support LCDIF LVDS display configuration.

smarcimx8mq-dcss-lvds Support DCSS LVDS display configuration.

smarcimx8mq-dual-display Support dual LVDS+HDMI display configuration.

Note
iconfalse

DCSS vs LCDIF

i.MX8M comes with 2 display controllers: 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.

The default configuration for SMARC-iMX8M iMX8MM variant is SMARC-iMX8M-D-2G2GB LPDDR4. If users used other variant, make changes at device/embedian/smarc_mx8mmx8mm/BoardConfig.mk. Find "TARGET_BOOTLOADER_CONFIG" and change the u-boot defconfig file. 

Note
iconfalse

U-Boot defconfig file

If your LPDDR4 is 2GB commercial or industrial temperature, use smarcima8mqsmarcima8mm_2g:smarcimx8mqsmarcimx8mm_2g_ser3_android_defconfig

If youtLPDDR4 is 4GB commercial or industrial temperature, use smarcima8mqsmarcima8mm_4g:smarcimx8mqsmarcimx8mm_4g_ser3_android_defconfig.

"ser3" stands for the debug output port that is defined in SMARC specification.

UUU Scripts

 

The table below describes the UUU scripts in android_p9.0.0_2.0.0-ga. They are used with the UUU binary file to download the images above into SMARC-iMX8M iMX8MM SMARC modules.

UUU Script nameFunction
uuu-android-smarc-mx8mqmx8mm-emmc.lst

Used with the UUU binary file to download image files into
eMMC.

uuu-android-smarc-mx8mqmx8mm-sd.lstUsed with the UUU binary file to download image files into
SD card.

Setup SD card


 Prepare for an SD card and insert into your Linux host PC

Code Block
themeConfluence
languagecpp
$ cp smarc-mksdcard.sh out/target/product/smarc_mx8mqmx8mm/ 
$ cd out/target/product/smarc_mx8mqmx8mm/ 
$ chmod a+x smarc-mksdcard.sh 
$ sudo ./smarc-mksdcard.sh -f <name>smarcimx8mm /dev/sdX; sync

 

 

<name>

smarcimx8mq Support no display configuration.

smarcimx8mq-hdmi Support HDMI display configuration (DCSS).

smarcimx8mq-dp Support Display Port (DP) display configuration (DCSS).

smarcimx8mq-edp Support Embedded Display Port (eDP) display configuration (DCSS).

smarcimx8mq-lcdif-lvds Support LCDIF LVDS display configuration.

smarcimx8mq-dcss-lvds Support DCSS LVDS display configuration.

smarcimx8mq-dual-display Support dual LVDS+HDMI display configuration.

Note
  1. The minimum size of the SD card is 8 GB.
  2. /dev/sdX, the X is the disk index from 'a' to 'z'. That may be different on each computer running Linux OS.

  3. If the SD card is 16 GB, use "sudo ./smarc-mksdcard.sh -f <name> /dev/sdX" to flash images.

  4. If the SD card is 8 GB, use "sudo ./smarc-mksdcard.sh -f <name> -c 7 /dev/sdX" to flash images.
  5. If the SD card is 32 GB, use "sudo ./smarc-mksdcard.sh -f <name> -c 28 /dev/sdX" to flash images.
  6. The default SMARC variant is SMARC-iMX8M-2G2GB LPDDR4. If using other SMARC variants, make sure to change bootloader_file in smarc-mksdcard.sh before setting up SD card.

Insert the SD card into your device, set the BOOT_SEL to "ON OFF OFF" and shut cross the TEST# pin to Ground. You will be able to see Android booting up. For eMMC boot, leave the TEST# floating and the BOOT_SEL should be set as "OFF ON ON". The next section will instruct you to flash eMMC.

Setup eMMC


Setup eMMC for Android is a bit complex, but trivial. There are a couple of ways to achieve it. 

Use UUU


UUU can be used to download all images into a target device. It is a quick and easy tool for downloading images. See the AndroidTM Quick Start Guide (AQSUG) for detailed description of UUU.

Make sure that the FORCE_RECOV# pin has to be shunt to Ground to enter into CPU serial download mode when using this tool. Connect USB0 min-B port of the device to your host computer.

Copy uuu.exe, u-boot-smarcimx8mqimx8mm-smarcimx8mm-2g.imx, u-boot-smarcimx8mqimx8mm-smarcimx8mm-2g_uuu.imx, partition-table.img, boot.img, vbmeta-<name>smarcimx8mm.img, system.img, vendor.img, dtbo-<name> smarcimx8mm.img and uuu-android-smarc-mx8mqmx8mm-emmc.lst into the same folder.

Code Block
themeConfluence
languagecpp
$ uuu uuu-android-smarc-mx8mqmx8mm-emmc.lst

After done, make sure that FORCE_RECOV# and TEST# pins are floating. Change the BOOT_SEL to OFF ON ON and the module will boot up from eMMC. 

Use a Ubuntu 18.04 Bootable SD card


The second way that we also recommend is to make a bootable Ubuntu 16.04 SD card for SMARC-iMX8MiMX8MM. User go to our   Linux Development Site  to learn how to make a bootable Ubuntu 16.04 SD card. An pre-built images can be downloaded from our ftp site. Users can download those images and follow the "Setup SD card" section from our Linux development site. Once it done, you can copy the smarc-mksdcard.sh script and all Android images (u-boot-smarcimx8mqimx8mm-smarcimx8mm-2g.imx, partition-table.img, boot.img, vbmeta-<name>smarcimx8mm.img, system_raw.img, vendor_raw.img, dtbo-<name>smarcimx8mm.img, smarc-mkemmccard.sh) into your home directory. Follow exactly what you did for SD card, but now, eMMC device will be emulated as /dev/mmcblk0.  

Code Block
themeConfluence
languagecpp
$ sudo ./smarc-mkemmccard.sh -f <name>smarcimx8mm /dev/mmcblk0; sync

 

 

<name>

smarcimx8mq Support no display configuration.

smarcimx8mq-hdmi Support HDMI display configuration (DCSS).

smarcimx8mq-dp Support Display Port (DP) display configuration (DCSS).

smarcimx8mq-edp Support Embedded Display Port (eDP) display configuration (DCSS).

smarcimx8mq-lcdif-lvds Support LCDIF LVDS display configuration.

smarcimx8mq-dcss-lvds Support DCSS LVDS display configuration.

smarcimx8mq-dual-display Support dual LVDS+HDMI display configuration.

Power off and set BOOT_SEL to "OFF ON ON", leave the TEST# pin floating and you will be able to boot up your Android from on-module eMMC.

 

Android Recovery Mode


Enter board in Android Recovery mode

Shunt LID# pin to ground will enter Android Recovery mode.

Update Android Firmware

Generate OTA Packages

For generating "OTA" packages, use the following commands:

Code Block
themeConfluence
languagecpp
$ cd ${MY_ANDROID}
$ make PRODUCT=smarc_mx8mqmx8mm-eng -j4 otapackage 2>&1 | tee build1-1.log

Install OTA Packages to device 

  1. Enter to Android Recovery mode
  2. Select menu item "apply update from ADB" 
  3. To the host system, perform the following command:
Code Block
themeConfluence
languagecpp
$ out/host/linux-x86/bin/adb sideload out/target/product/smarc_mx8mqmx8mm/smarc_mx8mqmx8mm-ota-<data>-<name>.zip

smarc_mx8mqmx8mm-ota-${date}.zip includes payload.bin and payload_properties.txt . The two files are used for full update.

Reboot the device.

Note

Real example name for OTA package: out/target/product/smarc_mx8mqmx8mm/smarc_mx8mqmx8mm-ota-20180416-smarcimx8mq-hdmismarcimx8mm.zip

Manual Operations


Build boot.img


 When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android.

Code Block
themeConfluence
languagecpp
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
$ export PATH=$JAVA_HOME/bin/:$PATH
$ lunch smarc_mx8mmx8mm-eng
or
$ lunch smarc_mx8mmx8mm-userdebug
$ make bootimage

Toolchain setup for manual build kernel and U-Boot


 Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin

Code Block
themeConfluence
languagecpp
$ export ARCH=arm64
$ export CROSS_COMPILE=${MY_ANDROID}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-

Manual build Bootloader


 Change directory to U-Boot

Code Block
themeConfluence
languagecpp
$ cd ${MY_ANDROID}/vendor/embedian/uboot-imx

Execute following commands:

Code Block
themeConfluence
languagecpp
$ make distclean
$ make smarcimx8mqsmarcimx8mm_2g_ser3_android_defconfig
$ make -j4
Note
iconfalse

U-Boot defconfig file

If your LPDDR4 is 2GB commercial or industrial temperature, use smarcima8mqsmarcima8mm_2g:smarcimx8mqsmarcimx8mm_2g_ser3_android_defconfig

If youtLPDDR4 is 4GB commercial or industrial temperature, use smarcima8mqsmarcima8mm_4g:smarcimx8mqsmarcimx8mm_4g_ser3_android_defconfig.

"ser3" stands for the debug output port that is defined in SMARC specification.

It will generate u-boot.imx file.

Manual build Android Linux Kernel and modules


 

Code Block
themeConfluence
languagecpp
$ cd ${MY_ANDROID}/vendor/embedian/kernel_imx 
$ make distclean
$ make smarcimx8msmarcimx8mm_android_defconfig
$ make KCFLAGS=-mno-android

The kernel images are found in ${MY_ANDROID}/vendor/embedian/kernel_imx/arch/arm64/boot/Image


version 1.0a,503/3120/20192020

Last updated 2020-0203-1620