Message-ID: <26223946.5259.1711709761583.JavaMail.root@dns3> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_5258_1173470342.1711709761583" ------=_Part_5258_1173470342.1711709761583 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html SMARC-iMX8MM-ANDROID-Q10.0.0_1.0.0

SMARC-iMX8MM-ANDROID-Q10.0.0_1.0.0

=20 =20
=20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
=20 =20
=20
=20
=20

Building Freescale/Embedian=E2=80=99s Android Q10.0.0_1.0.0 BSP Dist= ribution

Eric Lee

version 1.0a, 7/23/2020

Introduction


This document describes how to build and deploy Android Oreo on the= SMARC-iMX8MM. It is based on NXP's IMX8M_Q10.0.0_1.0.0-GA ANDROID release.=

 

Generating SSH Keys


In order to download u-boot and kerne= l from Embedian. We recommend you use SSH keys to establish a s= ecure connection between your computer and Embedian Gitlab server. The step= s below will walk you through generating an SSH key and then adding the pub= lic 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&= nbsp;Git Bash and run: 

=20
$ cd ~/.ssh
$ ls
# Lists the files in your .ssh directory
=20

 Check the directory list= ing to see if you have a file named either id_rsa.pub&nbs= p;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 ke= y, enter the code below. We want the default settings so when asked to ente= r a file in which to save the key, just press enter.

=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 so= mething 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 Embedian Gitlab Server


 Copy the key to your cli= pboard.

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

Overview of this document


The objective of this document is to guide SMARC-iMX8MM Android develope= rs to obtain Android Q10.0.0_1.0.0-ga Pie sources, setting up host environm= ent, 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-iMX8MM SOM.

Hardware Requirement


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

Host (PC) setup re= quirements

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

=20
=20 Icon=20
=20

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

= =20
=20
=20

Install requ= ired packages on host PC

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

Install the OpenJDK=

=20
$ sudo apt-get update=20
$ sudo apt-get install openjdk-8-jdk
=20


Update the default Java version by running:

=20
$ sudo update-alternatives --config java=20
$ sudo update-alternatives --config javac
=20
=20
=20 Icon=20
=20

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

=20
=20
=20

Obtain Source Code


Get NXP's Andr= oid Release Package

Go to NXP's website, download Q10.0.0_1.0.0_ANDROID_SOURCE = ;(filename: imx-android-10= .0.0_1.0.0.tar.gz and put into your ~/downloads director= y.

=20
$ cd ~/downloads
$ tar xvfz imx-android-10.0.0_1.0.0.tar.gz
=20

Obtain Google Android Pie Q10.0.0_1.0.0-ga so= urce code and Apply NXP's patch

=20
$ mkdir -p ~/android/smarcimx8mm/q_1000_100=20
$ cd ~/android/smarcimx8mm/q_1000_100
$ mkdir ~/bin=20
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo >=
 ~/bin/repo=20
$ chmod a+x ~/bin/repo=20
$ export PATH=3D~/bin:$PATH=20
$ mv ~/download/imx-android-10.0.0_1.0.0 .
$ source imx-android-10.0.0_1.0.0/imx_android_setup.sh
=20

After done, it will create an android= _build directory. Go to this directory.

C= lone Embedian's U-Boot and Linux kernel sources

=20
$ cd ~/android/smarcimx8mm/q_1000_100/android_build
$ mkdir -p vendor/embedian
$ cd vendor/embedian
$ git clone git@git.embedian.com:developer/smarc-t335x-uboot.git uboot-imx =
-b smarc-8mm-q10.0.0_1.0.0_ga
$ git clone git@git.embedian.com:developer/smarc-fsl-linux-kernel.git kerne=
l_imx -b smarc-8mm-q10.0.0_1.0.0_ga
=20

Apply Embedian's patches for  i.MX8M Mini platforms

=20
$ cd ~/android/smarcimx8mm/q_1000_100/android_build/device
$ git clone git@git.embedian.com:developer/smarc-imx8m-android.git embedian=
 -b smarc-8mm-q10.0.0_1.0.0_ga
$ embedian/scripts/install.sh
=20

ARM Cross Compiler: GCC 


To build Embedian=E2=80=99s SMARC-iMX8MM Android 10= .0, you will need to install the following ARM GNU aarch64 compiler first:&= nbsp; 

=20
=20
=20

$ wget -c https://developer.arm.co= m/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_= 64-aarch64-linux-gnu.tar.xz&nbs= p;

$ sudo tar -C /opt -xJf gcc-= arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz

$ export AARCH64_GCC_CROSS_C= OMPILE=3D/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linu= x-gnu-

=20
=20
=20

Build Android Images


Change to Android top level directory.
=20
$ export MY_ANDROID=3D~/android/smarcimx8mm/q_1000_100/android_b=
uild
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ export JAVA_HOME=3D/usr/lib/jvm/java-1.8.0-openjdk-amd64
$ export PATH=3D$JAVA_HOME/bin/:$PATH
$ lunch smarc_mx8mm-eng
or
$ lunch smarc_mx8mm-userdebug
$ ./imx-make.sh -j4 2>&1 | tee build1-1.log
=20
=20
=20 Icon=20
=20

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

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

The commands below can achieve the same result as "./imx-make= .sh -j4 2>&1 | tee build1-1.log":

$ ./imx-make.sh bootloader kernel -j4 2>&1 | tee build-log.= txt
# Build U-Boot/kernel with imx-make.sh first, but not to bu= ild Android images.
$ make -j4 2>&1 | tee -a build-log.tx= t
# Start the process of build Android images with "make&q= uot; function.

=20
=20
=20

Images created= by the Android build for SMARC-iMX8MM system

The images created are located at&nbs= p;out/target/product/smarc_mx8mm/ directory.

Image Description
u-bo= ot-imx8mm-smarcim8mm_2g.imx

Bootloader= for eMMC/SD card boot for SMARC-iMX8MM-1/3/5/6-2G(-I)

Other SMARC variants could be defined at device= /embedian/imx8m/smarc_mx8mm/BoardConfig.mk

u-bo= ot-imx8mm-smarcim8mm_2g_uuu.imx

Bootloader= used by uuu for eMMC/SD card boot for SMARC-iMX8MM-1/3/5/6-2G(-I)

Other SMARC variants could be defin= ed at device/embedian/smarc_mx8m/BoardConfig.mk

u-bo= ot-imx8mm-smarcim8mm_4g.imx

Bootloader= for eMMC/SD card boot for SMARC-iMX8MM-5/6-4G(-I)

Other SMARC variants could be defined at device/emb= edian/imx8m/smarc_mx8mm/BoardConfig.mk

u-bo= ot-imx8mm-smarcim8mm_4g_uuu.imx

Bootloader= used by uuu for eMMC/SD card boot for SMARC-iMX8MM-5/6-4G(-I)

Other SMARC variants could be defined a= t device/embedian/imx8m/smarc_mx8mm/BoardConfig.mk

boot= -smarcimx8mm.img Boot image for SMARC-iMX8MM
part= ition-table.img GPT table image for 16GB SD card and eMMC.
part= ition-table-7GB.img GPT table image for 8GB SD card and eMMC.
part= ition-table-28GB.img GPT table image for 28GB SD card and eMMC.
syst= em.img System Boot image
vbme= ta-smarcimx8mm.img Android Verified Boot metadata Image for SMARC-i= MX8MM to support different display output
vend= or.img Vendor image
dtbo= -smarcimx8mm.img Device Tree image for SMARC-iMX8MM to support di= fferent display output

UUU Scripts

 The table below describe= s the UUU scripts in android_q10.0.0_1.0.0-ga. They are used with the UUU b= inary file to download the images above into SMARC-iMX8MM SMARC modules.

UUU Script name Function
uuu-= android-smarc-mx8mm-emmc.lst

Used with the UUU binary file to download ima= ge files into
eMMC.

uuu-= android-smarc-mx8mm-sd.lst Used 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

=20
$ cp smarc-mksdcard.sh out/target/product/smarc_mx8mm/=20
$ cd out/target/product/smarc_mx8mm/=20
$ chmod a+x smarc-mksdcard.sh=20
$ sudo ./smarc-mksdcard.sh -f smarcimx8mm -e <lpddr4_feature> /dev/sd=
X; sync
=20


<= /span>

<lpddr4_feature= >

<= em>2g If the LPDDR4 memory capacity on your module is 2G= B.

 

4g If the LPDDR4 memory capacity on your module is 4GB.

=20
=20 Icon=20
=20
  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 diffe= rent on each computer running Linux OS.

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

  4. If the SD card is 8 GB, use "sudo ./smarc-mksdcard.sh -f <name&= gt; -c 7 /dev/sdX" to flas= h images.
  5. If the SD card is 32 GB, use "sudo ./smarc-mksdcard.sh -f <name= > -c 28 /dev/sdX" to fl= ash images.
=20
=20
=20

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 &q= uot;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 qui= ck and easy tool for downloading images. See the AndroidTM Quick Start Guide (AQSUG) f= or detailed description of UUU.

Make sure that the FORCE_= RECOV# pin has to be shunt to Ground to enter into CPU ser= ial download mode when using this tool. Connect USB0 min-B port of the devi= ce to your host computer.

Copy uuu.exe, = u-boot-imx8mm-smarcimx8mm-2g.imx, u-boot-imx8mm-smarcimx8mm-4g.imx, u-= boot-imx8mm-smarcimx8mm-2g_uuu.imx, u-boot-imx8mm-smarcimx8mm-4g_uuu.i= mx, partition-table.img, boot.img, vbmeta-smarcimx8mm.img, system.img,= vendor.img, dtbo-smarcimx8mm and uuu-android-smarc-mx8mm-emmc.lst into the same folder.

=20
$ uuu uuu-android-smarc-mx8mm-emmc.lst
=20
=20
=20 Icon=20
=20

Make sure the module LPDDR4 memory capacity in the file of uuu-android-smarc-mx8mm-emmc.lst<= /span>

=20
=20
=20

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

Use a Ubuntu 18.04 Bootable SD card<= /span>


The second way that we also recommend is to make a bootable Ubuntu 16.04= SD card for SMARC-iMX8M. 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 "Se= tup SD card" section from our Linux development site. Once it done, yo= u can copy the smarc-mksdcard.sh&n= bsp;script and all Android images (u-boot-imx8mm-smarcimx8mm-2g= .imx, u-boot-imx8mm-smarcimx8mm-4g.imx, partition-t= able.img, boot.img, vbmeta-smarcimx8mm.img, system_raw.img, vendor_raw.img,= dtbo-<name>, smarc-mkemmccard.sh) into your home directory. Follow e= xactly what you did for SD card, but now, eMMC device will be emulated as /= dev/mmcblk0.  

=20
$ sudo ./smarc-mkemmccard.sh -f smarcimx8mm -e <lpddr4_featur=
e> /dev/mmcblk0; sync
=20


<= /span>

<lpddr4_feature= >

<= em>2g If the LPDDR4 memory capacity on your module is 2G= B.

 

4g If the LPDDR4 memory capacity on your module is 4GB.

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 f= rom on-module eMMC.

 

Android Recovery Mode


Enter board in Android Recovery mo= de

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

Update Android Firmware

Generate OTA Packages

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

=20
$ cd ${MY_ANDROID}
$ make PRODUCT=3Dsmarc_mx8mm-userdebug -j4 otapackage 2>&1 | tee bui=
ld1-1.log
=20

In= stall 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:
=20
$ out/host/linux-x86/bin/adb sideload out/target/product/smarc_m=
x8mm/smarc_mx8mm-ota-<data>-<name>.zip
=20

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

Reboot the device.

=20
=20 Icon=20
=20

Real example name for OTA package:&nb= sp;out/target/product/smarc_mx8mm/smarc_mx8mm-ota-20180416-smarc= imx8mm.zip

=20
=20
=20

Manual Operations


Build boot.img


 When you perform chan= ges to the kernel, you may build boot.img solely instead of building the wh= ole Android.

=20
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ export JAVA_HOME=3D/usr/lib/jvm/java-1.8.0-openjdk-amd64
$ export PATH=3D$JAVA_HOME/bin/:$PATH
$ lunch smarc_mx8mm-eng
or
$ lunch smarc_mx8mm-userdebug
$ make bootimage
=20

Manual build Bootloade= r


 

=20
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ export JAVA_HOME=3D/usr/lib/jvm/java-1.8.0-openjdk-amd64
$ export PATH=3D$JAVA_HOME/bin/:$PATH
$ lunch smarc_mx8mm-eng
or
$ lunch smarc_mx8mm-userdebug
$ ./imx-make.sh bootloader -j4
=20

It will generate u-boot.imx, u-boot-imx8mm-smarcimx8mm_2g-dp.= imx,  u-boot-imx8mm-smarcimx8mm_2g.imx, u-boot-imx8mm-smarcimx8mm= _2g_uuu-dp.imx, u-boot-imx8mm-smarcimx8mm_2g_uuu.imx, u-boot-imx8= mm-smarcimx8mm_4g-dp.imx, u-boot-imx8mm-smarcimx8mm_4g.imx, u-boo= t-imx8mm-smarcimx8mm_4g_uuu-dp.imx and u-boot-imx8mm-smarcimx8mm_4g_uu= u.imx file.

Manual build Android Linux= Kernel and modules


 

=20
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ export JAVA_HOME=3D/usr/lib/jvm/java-1.8.0-openjdk-amd64
$ export PATH=3D$JAVA_HOME/bin/:$PATH
$ lunch smarc_mx8mm-eng
or
$ lunch smarc_mx8mm-userdebug
$ ./imx-make.sh kernel -j4
=20

The kernel images are found in $= {MY_ANDROID}/out/target/product/smarc_mx8mm/obj/KERNEL_OBJ/arch/arm64/boot/= Image


version 1.0a,7/23/2020

Last updated 2020-07-23

&n= bsp;

------=_Part_5258_1173470342.1711709761583--