VAR-SOM-MX6 Android L5.1.1 2.1.0 R1: Difference between revisions

From Variscite Wiki
m (Text replacement - "http://variwiki" to "https://variwiki")
 
(64 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{PageHeader|VAR-SOM-MX6 Android-LL-5.0.0 100 r3 Developers Guide}} {{DocImage|category1=VAR-SOM-MX6|category2=Android}} __toc__
{{PageHeader|VAR-SOM-MX6_Android L5.1.1_2.1.0 R1 developer guide}} {{DocImage|category1=VAR-SOM-MX6|category2=Android}} __toc__


= Introduction<br/> =
= Introduction<br/> =


This WIKI describes how to build and deploy Android Lollipop [http://www.android.com/versions/lollipop-5-0/ Lollipop-5-0] on the VAR-SOM-MX6. It is based on Freescale Android-LL-5.5.0 100.
This WIKI describes how to build and deploy Android Lollipop on the VAR-SOM-MX6. It is based on NXP's Android-ll_511_210 release


= Overview =
= Overview =
Line 16: Line 16:
*Download & build the sources.
*Download & build the sources.
*Install the binaries on the VAR-SOM-MX6 SOM and SOM-SOLO/SOM-DUAL SOM.
*Install the binaries on the VAR-SOM-MX6 SOM and SOM-SOLO/SOM-DUAL SOM.
== Document Reference ==
This release is based on Freescale Rev L5.0.0_1.0.0-ga, 06/2015 release. Please download and read the below documents inside android_L5.0.0_1.0.0-ga_doc.tar.gz before you start building.
*Android User's Guide
*Android Quick Start Guide
*Android Release Notes
*Android Frequently Asked Questions


= Supported hardware and features =
= Supported hardware and features =
Line 43: Line 34:
[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&fr=g i.MX6 Quad]<br/>[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6D&fr=g i.MX6 Dual]<br/>[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6DL&fr=g i.MX6 Dual lite]<br/>[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6S&nodeId=018rH3ZrDRB24A i.MX6 Solo]
[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&fr=g i.MX6 Quad]<br/>[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6D&fr=g i.MX6 Dual]<br/>[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6DL&fr=g i.MX6 Dual lite]<br/>[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6S&nodeId=018rH3ZrDRB24A i.MX6 Solo]


|-
| Software platform<br/>
|
[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&fpsp=1&tab=Design_Tools_Tab Freescale Android-LL-5.0.0 100]
|-
| Nand Recovery
| nand-recovery SD V39 - can be downloaded from FTP
|-
|-
| NAND Flash size support<br/>
| NAND Flash size support<br/>
| 128MB up to 1GB<br/>
| 128MB and up<br/>
|-
|-
| eMMC<br/>
| eMMC<br/>
Line 119: Line 102:




<span style="color:red">Note: </span>Do not use other Ubuntu releases, other than recommended above.
<span style="color:red">Note: </span>Do not use other Ubuntu releases, than recommended above.


=== Install required packages on host PC ===
=== Install required packages on host PC ===
<pre>
<pre>
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev
$ sudo apt-get -y install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev
</pre>
</pre>


Line 142: Line 125:
= <span style="line-height: 1.5em;">Obtain source code</span> =
= <span style="line-height: 1.5em;">Obtain source code</span> =


<span style="line-height: 1.5em;">Variscite's Linux kernel and U-Boot are available through Github.<br>
<span style="line-height: 1.5em;">Variscite's U-Boot, Linux kernel and Android patches are available through Github.<br>
Required patches for the AFS can be found under: VAR-SOM-MX6/Software/Android_LP_5.1.1 in Variscite's FTP<br/>Files:<br/>
Required NXP patches for the Android file system are under: ftp://customerv:Variscite1@ftp.variscite.com/VAR-SOM-MX6/Software/Android/Android_ll_511_210 in Variscite's FTP<br><br/>File:<br/>
* IMX6_L5.1_2.1.0_AND_SOURCE_BSP.tar.gz - NXP's i.MX6 LL5.1.1 original BSP patch files.<br/>
* IMX6_L5.1_2.1.0_AND_SOURCE_BSP.tar.gz - NXP's i.MX6 LL5.1.1 original BSP patch files.
 


== <span style="line-height: 1.5em;">Unpack NXP's Android Release Package</span> ==
== <span style="line-height: 1.5em;">Unpack NXP's Android Release Package</span> ==
Line 189: Line 171:
<pre>
<pre>
cd ~/var_ll_511_210/ll_511_210_build
cd ~/var_ll_511_210/ll_511_210_build
source ../android_L5.0.0_1.0.0-ga_core_source/code/l5.0.0_1.0.0-ga/and_patch.sh
source ../android_L5.1.1_2.1.0-ga_core_source/code/L5.1.1_2.1.0-ga/and_patch.sh
help
help
You should see that the "c_patch" function is available.
You should see that the "c_patch" function is available.
Line 199: Line 181:
</pre>
</pre>


== Apply Variscite's i.MX6 platforms patches<br/> ==
== Apply Variscite's i.MX6 platforms' patches ==
<pre>
<pre>
cd ~/var_ll_511_210
cd ~/var_ll_511_210/ll_511_210_build/device
tar xvf ~/Downloads/var-L511-v210_20160321.tar.bz2
git clone https://github.com/varigit/MX6x-android.git -b l5.1.1_2.1.0_var01 variscite
variscite/install
variscite/common/tools/install
</pre>
 
== Install Freescale i.MX6 additional codecs support<br/> ==
<pre>$ cd ~/var_ll_500_100/ll_500_100_build
$ tar xvf ~/Downloads/fsl_aacp_dec_L5.0.0_1.0.0-ga.tar.gz
$ cp -r fsl_aacp_dec/ external
$ rm -rf fsl_aacp_dec/
</pre>
</pre>


= Build Android Images =
= Build Android Images =
Change to Android top level directory.
Change to Android top level directory.
<pre>$ cd ~/var_ll_500_100/ll_500_100_build
<pre>
$ source build/envsetup.sh
cd ~/var_ll_511_210/ll_511_210_build
$ lunch var_mx6-user
source build/envsetup.sh
lunch var_mx6-user
or
or
$ lunch var_mx6-eng
lunch var_mx6-eng
</pre>
</pre>
{{note| NOTE:<br/>var_mx6-user creates a production version of the Android Lollipop.
{{note| NOTE:<br/>var_mx6-user creates a production version of the Android Lollipop.
Line 225: Line 201:
|info}}
|info}}


== Switch from eMMC build to SD card build and vice versa ==
== Switching from eMMC build to SD card build and vice versa ==
When you switch your target MMC device you need to remove the fstab file. This will guarantee that the make system will copy the right one into target.
When you switch your target MMC device you need to remove the fstab file. This will guarantee that the make system will copy the right one into target.
<pre>$ rm out/target/product/var_mx6/root/fstab.freescale
<pre>
rm out/target/product/var_mx6/root/fstab.freescale
</pre>
</pre>


== Build Android for SD card ==
== Build Android for SD card ==
<pre>$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log</pre>
<pre>
== Build Android for eMMC ==
make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log</pre>
<pre>$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log</pre>
== Build Android for on-SOM eMMC ==
{{note| NOTE: Set -j4 to a suitable number.  A good practice is to set it to number of threads of you build machine minus 1.
<pre>
|info}}
make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log
== Flash Android SD card ==
</pre>
{{note| NOTE: A newer version of var-mksdcard.sh is available on the FTP site.
|info}}
Format only SD card:
<pre>$ sudo ./var-mksdcard.sh /dev/sdX;sync</pre>
Flash only Android onto SD card:
<pre>$ sudo ./var-mksdcard.sh -np -nf -f som-mx6q-c /dev/sdX;sync</pre>
Format and flash Android onto SD card (SD card was formated before):
<pre>$ sudo ./var-mksdcard.sh -f som-mx6q-c /dev/sdX;sync</pre>
* Replace /dev/sdX with your true device, You can identify it with dmesg.
* Replace som-mx6q-c with you actual configuration. See description in section [http://variwiki.com/index.php?title=VAR-SOM-MX6_Android_LL1_R01#Images_created_by_the_Android_build_for_Variscite_MX6_system Images created by the Android build for Variscite MX6 system]
 
== Flash Android onto eMMC ==
Flashing Android is a complex task that require multiple commands. Variscite provides nand-recovery SDCARD that does that.
It format the eMMC flash the boot device and flash Android. Please use the nand-recovery SDCARD copy your Android product into /media/rootfs/opt/images/Android/Emmc.
Boot from SDCARD and use the GUI to flash Android or type android-emmc.sh on the command line.


== Build for NAND ==
== Build for NAND ==
{{note| NOTE: Due to android file system size This version only support build to SD card and eMMC.
{{note| NOTE: Due to android file system size, Android should use SD-Card or eMMC only.
|info}}
|info}}


Line 276: Line 238:
|  
|  
|-
|-
| <name> is one of:
| '''<name>''' is one of:
| som-mx6q - Support VAR-SOM-MX6Q and VAR-SOM-MX6D<br>som-mx6dl - Support VAR-SOM-MX6DL and VAR-SOM-SOLO<br>som-solo - Support SOM-SOLO and SOM-DUAL
| som-mx6q - Supports VAR-SOM-MX6Q and VAR-SOM-MX6D<br>som-mx6dl - Supports VAR-SOM-MX6DL and VAR-SOM-MX6S<br>som-solo - Supports VAR-SOM-SOLO and VAR-SOM-DUAL
|-
|-
| <touch> - is "r" or "c"
| '''<touch>''' - is "r" or "c"
| r = resistive touch display<br>c = capacitive touch dispaly
| r = resistive touch display<br>c = capacitive touch dispaly
|-
|-
Line 338: Line 300:
|}
|}


= Boot =
= Boot options=
 
Boot options of the Android:<br>
1. Directly from SD-Card<br>
2. Uboot boots from NAND flash, and the rest of the Android images from on-SOM eMMC (when available)
 
== Flash and boot Android from SD card ==
=== Create a bootable SD card ===
<pre>
cd ~/var_ll_511_210/ll_511_210_build
cp device/variscite/common/tools/var-mksdcard.sh .
</pre>
Partition, format and copy all images to an SD card:
<pre>
sudo ./var-mksdcard.sh -f <name>-<touch> /dev/sdX; sync
</pre>
* See the possible <name> and <touch> values at the [[#Images created by the Android build for Variscite MX6 system|above table]]
* Replace /dev/sdX with your true device, You can identify it with dmesg
 
=== Boot From SD card ===
After following the above steps for creating a bootable SD card:
 
* Power-off board
* Insert the newly created SD card into the SD card socket of the evaluation kit.
* Press and hold the boot-select button, and power-on the kit.


The Android can be booted from MMC/SD device on sdcard and MMC/SD device on eMMC.&nbsp;
== Flash and boot Android from eMMC ==
nand-recovery version 37 support the nand and eMMC flash.
eMMC based system consist of:<br>
#SPL and U-boot on NAND-Flash<br>
#Rest of Android images in eMMC<br>


== Boot From MMC/SD Card<br/> ==
=== Preparing images ===
All Android built images but system.img are ready for flashing out of the default build.<br>
system.img must be modified: <br>
<pre>
cd out/target/product/var_mx6
simg2img system.img system_raw.img
rm system.img
mv system_raw.img system.img
</pre>


This section will guide you through the process of installing and boot VAR-SOM-MX6 from SD/MMC device.
{{note| NOTE:<br>
Step is required only for eMMC binaries. |info}}


Create bootable SD card
=== Flashing Android from Linux shell ===
Variscite provides a script that can be used to partition an SD card and install the required images on it.
An example of flashing the various images into NAND flash and eMMC, can be found here : https://variwiki.com/index.php?title=VAR-SOM-MX6_Yocto_NAND_Recovery_V50plus <br>
* Insert a micro SD into your Linux PC
You can use this pre-built recovery SD-Card, replace your newly created images with the ones in the /media/rootfs/opt/images/Android/Emmc directory, and run the android-emmc.sh script <br>
* Determine the block device name of your micro SD (for instance /dev/sdc). Use "dmesg" after you inserted the SD card.
also refer to https://github.com/varigit/meta-variscite-mx6/blob/imx_3.14.38_6qp-var02/scripts/var_mk_yocto_sdcard/variscite_scripts_android/android-emmc.sh for details
* Make sure all partitions of your micro SD are unmounted. Use "sudo umount /media/<uname>" to unmount it.
 
* cd ~/var_ll_500_100/ll_500_100_build
=== Flashing Android with USB Fastboot ===
* sudo ./var-mksdcard.sh /dev/sdX (replace /dev/sdX with your SD card block device)
{{note| NOTE:<br>
Use the created SD card and:
Make sure you built Android for emmc |info}}
* Insert the SD card you just created into the MMC/SD slot on the custom board.
<br>
* Press and hold the boot-select button and power-on the SOM.
'''Connect the target with host PC at fastboot mode:'''
#Connect a USB OTG cable from the target board OTG port to a your host machine USB HOST port.
#Power up the board and hit return/space to stop the boot at u-boot
#type fastboot in the u-boot prompt.


== Boot From eMMC ==


Flashing the U-Boot, boot image and Android root file system into NAND/eMMC can be done from target Linux shell.
In case you already have partitions on the eMMC you can skip the next step.
The images &nbsp;can be found at Android build machine under: "'''out/target/product/var_mx6'''".
<pre>$ sudo `which fastboot` flash mbr  emmc_mbr.img
Boot the target device using Variscite's pre-build NAND recovery SD image version 37or greater, then follow the instructions below:
</pre>
<pre>$ android_emmc.sh
The mbr need to be collected once of an eMMC formatted target. You can install the eMMC for the fisrt time by using our nand-recovery utility.
<pre>$ dd if=/dev/mmcblk1 of=emmc_mbr.img bs=512 count=1
</pre>
</pre>
{{note| NOTE:<br>
If you write the MBR reset the board and enter again to fastboot before you try to flash the other images.|info}}
<br>
'''On the Host PC:'''
<pre>$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6q-c.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` reboot
</pre>
boot-som-mx6q-c.img and recovery-som-mx6q-c.img are for VAR-SOM-MX6 with a capacitive display. You should pick and choose the right file for you see the table above.


= Manual operations =
= Manual operations =


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


We use boot.img and booti as default commands to boot rather than the uramdisk and uImage.<br/>You can use this command to generate boot.img under android environment:
<pre>
<pre>$  cd ~/var_ll_500_100/ll_500_100_build
cd ~/var_ll_511_210/ll_511_210_build
$ source build/envsetup.sh
source build/envsetup.sh
$ lunch var_mx6-user
lunch var_mx6-user
$ make bootimage
make bootimage
</pre>
</pre>


Line 381: Line 394:
Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
<pre>
<pre>
$ export ARCH=arm
export ARCH=arm
$ export PATH=~/var_ll_500_100/ll_500_100_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
export PATH=~/var_ll_511_210/ll_511_210_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
$ export CROSS_COMPILE=arm-eabi-
export CROSS_COMPILE=arm-eabi-
</pre>
</pre>


Line 389: Line 402:


Change directory to u-boot
Change directory to u-boot
<pre>$ cd ~/var_ll_500_100/ll_500_100_build/bootable/bootloader/uboot-imx </pre>
<pre>
cd ~/var_ll_511_210/ll_511_210_build/bootable/bootloader/uboot-imx
</pre>
Execute following commands:
Execute following commands:
<pre>
<pre>
Line 407: Line 422:
== Manual build Android Linux Kernel and modules ==
== Manual build Android Linux Kernel and modules ==


Change directory to kernel
<pre>$ cd ~/var_ll_500_100/ll_500_100_build/kernel_imx </pre>
Execute following commands
<pre>
<pre>
$ make distclean
cd ~/var_ll_511_210/ll_511_210_build/kernel_imx
$ make imx_v7_var_android_defconfig
make distclean
$ make -j4 uImage LOADADDR=0x10008000
make imx_v7_var_android_defconfig
$ make -j4 modules
make -j4 uImage LOADADDR=0x10008000
make -j4 modules
</pre>
</pre>
This will generate uImage(kernel image) in kernel/arch/arm/boot folder
This will generate uImage(kernel image) in kernel/arch/arm/boot folder
= Flashing Android with Fastboot =
#Connect a USB OTG cable from the target board OTG port to a your host machine USB HOST port.
#Power up the board and hit return to stop the boot
#type fastboot in the u-boot prompt.
On the target:
<pre>$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6q-c.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` reboot
</pre>
boot-som-mx6q-c.img and recovery-som-mx6q-c.img is for VAR-SOM-MX6 with capacitive display. You should pick and choose the right file for you see the table above.
The emmc-recovery utility select the right combination automatically by scanning the system it is running on.
Detail information [http://variwiki.com/index.php?title=VAR-SOM-MX6_Android_Unit_Testing_KK_443_200#FASTBOOT Fastboot]


= Display Options =
= Display Options =
Line 436: Line 435:
Selecting the display type is done by setting the bootcmd with the required display type.
Selecting the display type is done by setting the bootcmd with the required display type.


The bootcmd is embedded into [[VAR-SOM-MX6 Android GS#Build boot.img#Build boot.img|boot.img]]. To set the bootargs edit the file ''''~/var_ll_500_100/ll_500_100_build/device/variscite/var_som_mx6/BoardConfig.mk'''' as follows:
The bootcmd is embedded into [[VAR-SOM-MX6 Android GS#Build boot.img#Build boot.img|boot.img]]. To set the bootargs edit the file ~/var_ll_511_210/ll_511_210_build/device/variscite/var_som_mx6/BoardConfig.mk as follows:


*HDMI
*HDMI
<pre>BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=400M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M androidboot.selinux=disabled androidboot.dm_verity=disabled
<pre>BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=400M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M androidboot.selinux=disabled androidboot.dm_verity=disabled
</pre>
</pre>

Latest revision as of 11:54, 10 June 2020

VAR-SOM-MX6_Android L5.1.1_2.1.0 R1 developer guide

Introduction

This WIKI describes how to build and deploy Android Lollipop on the VAR-SOM-MX6. It is based on NXP's Android-ll_511_210 release

Overview

The objective of this document is to guide VAR-SOM-MX6 Android developers to obtain Android Lollipop 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 VAR-SOM-MX6 SOM and SOM-SOLO/SOM-DUAL SOM.

Supported hardware and features

Feature
Description
SOM support
VAR-SOM-MX6 V2
VAR-SOM-SOLO
VAR-SOM-DUAL
DART-MX6
Carrier Board support
VAR-MX6CustomBoard
VAR-SOLOCustomBoard
VAR-DVK-DT6
CPU

i.MX6 Quad
i.MX6 Dual
i.MX6 Dual lite
i.MX6 Solo

NAND Flash size support
128MB and up
eMMC
up to 64GB
DDR size support configuration
Solo:up to 1GB. DualLite, Dual, Quad: up to 4GB
SD-Card
+
Wired Network
10/100/1000 Mbps Ethernet
Wireless Network
Support for Wilink8, 802.11abgn STA, AP, & Wi-Fi Direct Mode SmartConfig Wilink8 page
Bluetooth
+
SPI
+
I2C
+
Canbus
+
USB host
+
USB OTG
Host and Device
Uarts
x3, up to 3.6 Mbps.
RTC
+
Display HDMI: 720P,1080P
LVDS0 (On board LVDS-to-RGB bridge, 800x480 resolution), LVDS1 external display
Audio Line IN/ Line out and Audio over HDMI
Camera ov5640 camera sensor. CB402 board can be ordered separately at : sales@variscite.com
PCIE +
SATA +

Hardware Requirements

VAR-SOM-MX6 evaluation kit.

Host (PC) setup requirements

The host development environment for Android is based on Ubuntu, please install Ubuntu version 14.04 64bit LTS http://www.ubuntu.com/download/desktop


Note: Do not use other Ubuntu releases, than recommended above.

Install required packages on host PC

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

Install the OpenJDK

sudo apt-get update
sudo apt-get install openjdk-7-jdk

Update the default Java version by running:

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

Variscite's U-Boot, Linux kernel and Android patches are available through Github.
Required NXP patches for the Android file system are under: ftp://customerv:Variscite1@ftp.variscite.com/VAR-SOM-MX6/Software/Android/Android_ll_511_210 in Variscite's FTP

File:

  • IMX6_L5.1_2.1.0_AND_SOURCE_BSP.tar.gz - NXP's i.MX6 LL5.1.1 original BSP patch files.

Unpack NXP's Android Release Package

mkdir ~/var_ll_511_210
cd ~/var_ll_511_210
tar xvf ~/Downloads/IMX6_L5.1_2.1.0_AND_SOURCE_BSP.tar.gz
cd android_L5.1.1_2.1.0-ga_core_source/code/
tar xvf L5.1.1_2.1.0-ga.tar.gz

Download Google Android LL5.1.1

cd ~/var_ll_511_210
mkdir ll_511_210_build
cd ll_511_210_build
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=~/bin:$PATH
repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r1 
repo sync
cd ~/var_ll_511_210/ll_511_210_build/prebuilts/gcc/linux-x86/arm
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
cd arm-eabi-4.6
git checkout -b android-4.4.3_r1 android-4.4.3_r1

Clone Variscite's U-Boot and Linux kernel sources

cd ~/var_ll_511_210/ll_511_210_build/bootable/bootloader
git clone https://github.com/varigit/uboot-imx.git uboot-imx
cd uboot-imx
git checkout -b imx_v2015.04_3.14.52_1.1.0_ga_var01 remotes/origin/imx_v2015.04_3.14.52_1.1.0_ga_var01
cd ~/var_ll_511_210/ll_511_210_build
git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx
cd kernel_imx
git checkout -b l5.1.1_2.1.0-ga_var01 remotes/origin/l5.1.1_2.1.0-ga_var01

Apply all the i.MX Android patches with Freescale i.MX6 support

cd ~/var_ll_511_210/ll_511_210_build
source  ../android_L5.1.1_2.1.0-ga_core_source/code/L5.1.1_2.1.0-ga/and_patch.sh
help
You should see that the "c_patch" function is available.
c_patch  ../android_L5.1.1_2.1.0-ga_core_source/code/L5.1.1_2.1.0-ga imx_L5.1.1_2.1.0-ga
If everything is OK, "c_patch" generates the following output to indicate the successful patch:
**************************************************************
Success: Now you can build the Android code for FSL i.MX platform
**************************************************************

Apply Variscite's i.MX6 platforms' patches

cd ~/var_ll_511_210/ll_511_210_build/device
git clone https://github.com/varigit/MX6x-android.git -b l5.1.1_2.1.0_var01 variscite
variscite/common/tools/install

Build Android Images

Change to Android top level directory.

cd ~/var_ll_511_210/ll_511_210_build
source build/envsetup.sh
lunch var_mx6-user
or
lunch var_mx6-eng
NOTE:
var_mx6-user creates a production version of the Android Lollipop.

var_mx6-eng creates an engineering version of the Android Lollipop. Development mode enable and development tools are available on target.

Switching from eMMC build to SD card build and vice versa

When you switch your target MMC device you need to remove the fstab file. This will guarantee that the make system will copy the right one into target.

rm out/target/product/var_mx6/root/fstab.freescale

Build Android for SD card

make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log

Build Android for on-SOM eMMC

make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log

Build for NAND

NOTE: Due to android file system size, Android should use SD-Card or eMMC only.

Images created by the Android build for Variscite MX6 system

If you do ls out/target/product/var_mx6/

Image
Description
system.img Android system image file.
SOM agnostics.
u-boot-var-imx6-nand.img u-boot for nand used in eMMC boot.
SOM agnostics.
u-boot-var-imx6-sd.img u-boot for SD card boot.
SOM agnostics.
boot-<name>-<touch>.img
recovery-<name>-<touch>.img
<name> is one of: som-mx6q - Supports VAR-SOM-MX6Q and VAR-SOM-MX6D
som-mx6dl - Supports VAR-SOM-MX6DL and VAR-SOM-MX6S
som-solo - Supports VAR-SOM-SOLO and VAR-SOM-DUAL
<touch> - is "r" or "c" r = resistive touch display
c = capacitive touch dispaly
Image Name
SOM type
Carrier Board type
LCD Type
Evaluation Kit name
boot-som-mx6q-c.img, recovery-som-mx6q-c.img VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Capacitive touch VAR-DVK-MX6_V2-PRO
VAR-STK-MX6_V2
boot-som-mx6q-r.img, recovery-som-mx6q-r.img VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Resistive touch VAR-DVK-MX6_V2
VAR-STK-MX6_V2
boot-som-mx6q-vsc.img, recovery-som-mx6q-vsc.img VAR-SOM-MX6_V2 (Quad / Dual) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
boot-som-mx6dl-c.img, recovery-som-mx6dl-c.img VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Capacitive touch N/A
boot-som-mx6dl-r.img, recovery-som-mx6dl-r.img VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Resistive touch N/A
boot-som-solo-vsc.img, recovery-som-solo-vsc.img VAR-SOM-SOLO / VAR-SOM-DUAL VAR-SOLOCustomBoard Capacitive LVDS touch VAR-DVK-SOLO/DUAL
VAR-STK-SOLO/DUAL
boot-som-solo-c.img, recovery-som-solo-c.img VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Capacitive touch N/A
boot-imx6q-var-dart.img, recovery-imx6q-var-dart.img DART-MX6 VAR-DT6CustomBoard Capacitive touch VAR-STK-DT6
VAR-DVK-DT6

Boot options

Boot options of the Android:
1. Directly from SD-Card
2. Uboot boots from NAND flash, and the rest of the Android images from on-SOM eMMC (when available)

Flash and boot Android from SD card

Create a bootable SD card

cd ~/var_ll_511_210/ll_511_210_build
cp device/variscite/common/tools/var-mksdcard.sh .

Partition, format and copy all images to an SD card:

sudo ./var-mksdcard.sh -f <name>-<touch> /dev/sdX; sync
  • See the possible <name> and <touch> values at the above table
  • Replace /dev/sdX with your true device, You can identify it with dmesg

Boot From SD card

After following the above steps for creating a bootable SD card:

  • Power-off board
  • Insert the newly created SD card into the SD card socket of the evaluation kit.
  • Press and hold the boot-select button, and power-on the kit.

Flash and boot Android from eMMC

eMMC based system consist of:

  1. SPL and U-boot on NAND-Flash
  2. Rest of Android images in eMMC

Preparing images

All Android built images but system.img are ready for flashing out of the default build.
system.img must be modified:

cd out/target/product/var_mx6
simg2img system.img system_raw.img
rm system.img
mv system_raw.img system.img


NOTE:
Step is required only for eMMC binaries.

Flashing Android from Linux shell

An example of flashing the various images into NAND flash and eMMC, can be found here : https://variwiki.com/index.php?title=VAR-SOM-MX6_Yocto_NAND_Recovery_V50plus
You can use this pre-built recovery SD-Card, replace your newly created images with the ones in the /media/rootfs/opt/images/Android/Emmc directory, and run the android-emmc.sh script
also refer to https://github.com/varigit/meta-variscite-mx6/blob/imx_3.14.38_6qp-var02/scripts/var_mk_yocto_sdcard/variscite_scripts_android/android-emmc.sh for details

Flashing Android with USB Fastboot

NOTE:
Make sure you built Android for emmc


Connect the target with host PC at fastboot mode:

  1. Connect a USB OTG cable from the target board OTG port to a your host machine USB HOST port.
  2. Power up the board and hit return/space to stop the boot at u-boot
  3. type fastboot in the u-boot prompt.


In case you already have partitions on the eMMC you can skip the next step.

$ sudo `which fastboot` flash mbr  emmc_mbr.img

The mbr need to be collected once of an eMMC formatted target. You can install the eMMC for the fisrt time by using our nand-recovery utility.

$ dd if=/dev/mmcblk1 of=emmc_mbr.img bs=512 count=1
NOTE:
If you write the MBR reset the board and enter again to fastboot before you try to flash the other images.



On the Host PC:

$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6q-c.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` reboot

boot-som-mx6q-c.img and recovery-som-mx6q-c.img are for VAR-SOM-MX6 with a capacitive display. You should pick and choose the right file for you see the table above.

Manual operations

Build boot.img

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

cd ~/var_ll_511_210/ll_511_210_build
source build/envsetup.sh
lunch var_mx6-user
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.6/bin

export ARCH=arm
export PATH=~/var_ll_511_210/ll_511_210_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
export CROSS_COMPILE=arm-eabi-

Manual build Bootloader 

Change directory to u-boot

cd ~/var_ll_511_210/ll_511_210_build/bootable/bootloader/uboot-imx

Execute following commands:

clean tree:
$ make mrproper

Choose build for SD card or NAND Flash:
$ make mx6var_som_sd_android_defconfig
or
$ make mx6var_som_nand_android_defconfig

Build U-Boot:
$ make -j4


This command will generate the U-Boot images 'SPL' and 'u-boot.img'.

Manual build Android Linux Kernel and modules

cd ~/var_ll_511_210/ll_511_210_build/kernel_imx 
make distclean
make imx_v7_var_android_defconfig
make -j4 uImage LOADADDR=0x10008000
make -j4 modules

This will generate uImage(kernel image) in kernel/arch/arm/boot folder

Display Options

Selecting the display type is done by setting the bootcmd with the required display type.

The bootcmd is embedded into boot.img. To set the bootargs edit the file ~/var_ll_511_210/ll_511_210_build/device/variscite/var_som_mx6/BoardConfig.mk as follows:

  • HDMI
BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=400M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M androidboot.selinux=disabled androidboot.dm_verity=disabled