VAR-SOM-MX6 Android KK2 R01: Difference between revisions

From Variscite Wiki
m (Text replacement - "http://variwiki" to "https://variwiki")
 
(63 intermediate revisions by 2 users not shown)
Line 15: Line 15:
*Setup the toolchain.
*Setup the toolchain.
*Download & build the sources.
*Download & build the sources.
*Install the binaries on the VAR-SOM-MX6 SOM.
*Install the binaries on the VAR-SOM-MX6 SOM and SOM-SOLO/SOM-DUAL SOM.


== Document Reference ==
== Document Reference ==


This release is based on Freescale Rev android_kk4.4.3_2.0.0-ga, 07/2014 release. Please download and read the below documents inside android_kk4.4.2_1.0.0-ga_docs.tar.
This release is based on Freescale Rev android_kk4.4.3_2.0.0-ga, 07/2014 release. Please download and read the below documents inside android_kk4.4.3_2.0.0-ga_doc.tar.gz.


*Android User's Guide
*Android User's Guide
Line 34: Line 34:
|-
|-
| Board support<br/>
| Board support<br/>
| [http://www.variscite.com/products/evaluation-kits/var-dvk-mx6 VAR-DVK-MX6],[http://www.variscite.com/products/system-on-module-som/cortex-a9/var-som-mx6-cpu-freescale-imx6 VAR-SOM-MX6]<br/>
| [http://www.variscite.com/products/evaluation-kits/var-som-mx6-kits VAR-DVK-MX6]<br>[http://www.variscite.com/products/evaluation-kits/var-som-solo-kits VAR-SOLOCustomBoard]<br>[http://www.variscite.com/products/system-on-module-som/cortex-a9/var-som-mx6-cpu-freescale-imx6 VAR-SOM-MX6]<br>[http://www.variscite.com/products/system-on-module-som/cortex-a9/var-som-solo-cpu-freescale-imx6 SOM-SOLO]<br/>
|-
|-
| CPU<br/>
| CPU<br/>
Line 43: Line 43:
| Software platform<br/>
| Software platform<br/>
|  
|  
[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&fpsp=1&tab=Design_Tools_Tab Freescale Android-KK-4.4.2 100]
[http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&fpsp=1&tab=Design_Tools_Tab Freescale Android-KK-4.4.3 200]


|-
|-
| Nand Recovery
| Nand Recovery
| eMMC-recovery SD V01 - can be downloaded from FTP
| nand-recovery SD V37 - can be downloaded from FTP
|-
|-
| NAND Flash size support<br/>
| NAND Flash size support<br/>
Line 99: Line 99:
| Camera
| Camera
| ov5640 camera sensor. CB402 board can be ordered separately at : sales@variscite.com
| ov5640 camera sensor. CB402 board can be ordered separately at : sales@variscite.com
|-
| PCIE
| +
|-
|-
| SATA
| SATA
Line 138: Line 141:
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate which JDK should be used.
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate which JDK should be used.


Please follow the link for the java install:&nbsp; [http://variwiki.com/index.php?title=VAR-SOM-MX6_Android_GS-java http://variwiki.com/index.php?title=VAR-SOM-MX6_Android_GS-java]
Please follow the link for the java install:&nbsp; [https://variwiki.com/index.php?title=VAR-SOM-MX6_Android_GS-java https://variwiki.com/index.php?title=VAR-SOM-MX6_Android_GS-java]


=== Additional packages ===
=== Additional packages ===
Line 161: Line 164:
* android_kk4.4.3_2.0.0-ga_doc.tar.gz - Freescale i.MX6 KK4.4.3_200 documents<br/>
* android_kk4.4.3_2.0.0-ga_doc.tar.gz - Freescale i.MX6 KK4.4.3_200 documents<br/>
* android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz  - Freescale i.MX6 KK4.4.3_200 omxplayer<br/>
* android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz  - Freescale i.MX6 KK4.4.3_200 omxplayer<br/>
* var_kk443_200_r1.tar.bz2 - Variscite's VAR-SOM-MX6 SOM patch files<br/>
* var_kk443_200_r2.tar.bz2 - Variscite's VAR-SOM-MX6 SOM patch files<br/>


== <span style="line-height: 1.5em;">Unpack Freescale's Android Release Package</span> ==
== <span style="line-height: 1.5em;">Unpack Freescale's Android Release Package</span> ==
Line 170: Line 173:
$ tar xvf kk4.4.3_2.0.0-ga.tar.gz</pre>
$ tar xvf kk4.4.3_2.0.0-ga.tar.gz</pre>


== Download Google Android KK4.4.2 <br/> ==
== Download Google Android KK4.4.3 <br/> ==
The Android source code is maintained in more than 100 different gits in the Android repository (android.googlesource.com).<br/>To get the Android source code from Google repo, follow the steps below:
The Android source code is maintained in more than 100 different gits in the Android repository (android.googlesource.com).<br/>To get the Android source code from Google repo, follow the steps below:
<pre>$ cd ~/var_kk_443_200
<pre>$ cd ~/var_kk_443_200
$ mkdir var_kk_443_200_build
$ mkdir kk_443_200_build
$ cd var_kk_443_200_build
$ cd kk_443_200_build
$ mkdir ~/bin
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Line 184: Line 187:


== Download Variscite's u-boot and Linux kernel <br/> ==
== Download Variscite's u-boot and Linux kernel <br/> ==
clone kk4.4.2_1.0.0-ga kernel source code from Variscite's open source git:
clone kk4.4.3_2.0.0-ga kernel source code from Variscite's open source git:
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx
$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx
Line 194: Line 197:
$ git clone https://github.com/varigit/uboot-imx.git uboot-imx
$ git clone https://github.com/varigit/uboot-imx.git uboot-imx
$ cd uboot-imx
$ cd uboot-imx
$ git checkout -b kk4.4.2_1.0.0-ga-var02 remotes/origin/kk4.4.2_1.0.0-ga-var02
$ git checkout -b kk4.4.3_2.0.0-ga-var02 remotes/origin/kk4.4.3_2.0.0-ga-var02
</pre>
</pre>


Line 201: Line 204:
The patch script (and_patch.sh) requires some basic utilities like awk/sed.<br/>Apply all Android patches by using the following steps:<br/>
The patch script (and_patch.sh) requires some basic utilities like awk/sed.<br/>Apply all Android patches by using the following steps:<br/>
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
$ source ../android_kk4.4.2_1.0.0-ga_core_source/code/kk4.4.2_1.0.0-ga/and_patch.sh
$ source ../android_KK4.4.3_2.0.0-ga_core_source/code/KK4.4.3_2.0.0-ga/and_patch.sh
$ c_patch ../android_kk4.4.2_1.0.0-ga_core_source/code/kk4.4.2_1.0.0-ga imx_kk4.4.2_1.0.0-ga
$ c_patch ../android_KK4.4.3_2.0.0-ga_core_source/code/KK4.4.3_2.0.0-ga/ imx_KK4.4.3_2.0.0-ga
</pre>
 
== <span style="line-height: 1.5em;">Install Freescale i.MX6 omxplayer support</span> ==
 
The patch script (and_patch.sh) requires some basic utilities like awk/sed.<br/>Apply all Android patches by using the following steps:<br/>
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
$ cp ~/Download/android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz ./
$ tar xzvf android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz
$ rm android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz
</pre>
</pre>


Line 209: Line 221:
After you setup your build machine,unpack Variscite's release Package:
After you setup your build machine,unpack Variscite's release Package:
<pre>$&nbsp;cd ~/var_kk_443_200
<pre>$&nbsp;cd ~/var_kk_443_200
$ tar xvf ~/Downloads/var_kk443_200_r1.tar.bz2
$ tar xvf ~/Downloads/var_kk443_200_r2.tar.bz2
$ variscite/install
$ variscite/install
</pre>
</pre>
Line 216: Line 228:


= Build Android Images =
= Build Android Images =
== Build the Android Filesystem ==
Change to Android top level directory.
Change to Android top level directory.
<pre>$ cd ~/var_kk_443_200/kk_443_200_build</pre>
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
{{note| NOTE: edit build.sh and set -j4 to a suitable number.  A good practice is to set it to number of threads of you build machine minus 1.
$ source build/envsetup.sh
$ lunch var_mx6-eng
</pre>
== Build Android  for SD card ==
<pre>$ rm out/target/product/var_mx6/root/fstab.freescale
$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log</pre>
== Build Android  for eMMC ==
<pre>$ rm out/target/product/var_mx6/root/fstab.freescale
$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log</pre>
{{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.
|info}}
{{note| NOTE: rm out/target/product/var_mx6/root/fstab.freescale is only required when you switch from eMMC build to SD card build and vice versa.
|info}}
|info}}
* SD card build
<pre>$ ./build.sh mx6 sdcard</pre>
* UBIFS build
<pre>$ ./build.sh mx6 ubifs</pre>


== Build for 4GB NAND ==
== Build for NAND ==
Edit your BoardConfig.mk located at device/variscite/var_som_mx6q.
{{note| NOTE: Due to android file system size This version only support build to SD card and eMMC.
At the end comment out the UBIFS parameters and
|info}}
add: "
 
<br/>#Micron 4096MB MT29F32G08AFACAWP NAND
== Images created by the Android build for Variscite MX6 system ==
<br/>TARGET_MKUBIFS_ARGS := -m 4096 -e 516096 -c 7855 -x none
If you do ls out/target/product/var_mx6/<br>
<br/>TARGET_UBIRAW_ARGS := -m 4096 -p 512KiB -s 4096 -O 4096 $(UBI_ROOT_INI)
{| class="wikitable"
<br/>"
|-
<br/>Rebuild your ubi system and you will get new ubifs for 4GB nand flash.
! scope="col" | Image<br/>
nand-recovery.sh on the recovery sd card need to be updated with
! scope="col" | Description<br/>
if [ `dmesg |grep MT29F32G08AFACAWP | wc -l` = 1 ] ; then
|-
# this is 4GB NAND (MT29F32G08AFACAWP)
| system.img
echo "4GB nand selected ..."
| Android system image file. SOM agnostics.
ROOTFS_IMAGE=rootfs_4G_NAND.ubi.img
|-
ANDROID_SYSTEM=android_root_4G_NAND.img
| u-boot-var-imx6-nand.img
UBI_SUB_PAGE_SIZE=4096
| u-boot for nand used in eMMC boot. SOM agnostics.
UBI_VID_HDR_OFFSET=4096
|-
fi
| u-boot-var-imx6-sd.img
| u-boot for SD card boot. SOM agnostics.
|-
| boot-<name>-<touch>.img<br>recovery-<name>-<touch>.img
|
|-
| <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
|-
| <touch> - is "r" or "c"
| r = resistive touch display<br>c = capacitive touch dispaly
|-
! scope="col" | Full Image Name<br/>
! scope="col" | Description<br/>
|-
| boot-som-mx6q-c.img, recovery-som-mx6q-c.img
| Boot and Recovery images for VAR-DVK-MX6 with Quad or DUAL SOM with Capacitive display.
|-
| boot-som-mx6q-r.img, recovery-som-mx6q-r.img
| Boot and Recovery images for VAR-DVK-MX6 with Quad or DUAL SOM with Resistive display.
|-
| boot-som-mx6dl-c.img, recovery-som-mx6dl-c.img
| Boot and Recovery images for VAR-DVK-MX6 with DL or SOLO SOM with Capacitive display.
|-
| boot-som-mx6dl-r.img, recovery-som-mx6dl-r.img
| Boot and Recovery images for VAR-DVK-MX6 with DL or SOLO SOM with Capacitive display.
|-
| boot-som-solo-c.img,  recovery-som-solo-c.img
| Boot and Recovery images for VAR-DVK-MX6 with SOM-SOLO or SOM-DUAL with Capacitive display.
|-
| boot-som-solo-r.img,  recovery-som-solo-r.img
| Boot and Recovery images for VAR-DVK-MX6 with SOM-SOLO or SOM-DUAL with Resistive display.
|-
| boot-som-solo-vsc.img,  recovery-som-solo-vsc.img
| Boot and Recovery images for VAR-DVK-SOLO with SOM-SOLO or SOM-DUAL with Capacitive LVDS display .
|-
|}


= Boot =
= Boot =


The Android can be booted from MMC/SD device on sdcard, UBIFS on NAND and MMC/SD device on eMMC.&nbsp;
The Android can be booted from MMC/SD device on sdcard and MMC/SD device on eMMC.&nbsp;
nand-recovery version 33 support the nand and eMMC flash.
nand-recovery version 37 support the nand and eMMC flash.


== Boot From MMC/SD Card<br/> ==
== Boot From MMC/SD Card<br/> ==


{{note| NOTE: VAR-SOM-MX6 can be configured with or without eMMC. eMMC device number is 0 while  SD Card is 1.
u-boot will always number the SD Card as 1.
<br>$ booti mmc0 will boot from eMMC.
<br>$ booti mmc1 will boot from SD Card
<br>In case of SOM with eMMC the default partition table is to boot from eMMC. One should change the partition table if boot from SD Card required.
|info}}
This section will guide you through the process of installing and boot VAR-SOM-MX6 from SD/MMC device.
This section will guide you through the process of installing and boot VAR-SOM-MX6 from SD/MMC device.


<span style="font-size: 17.600000381469727px; font-weight: bold; line-height: 1.5em;">Create bootable SD card</span>
Create bootable SD card
 
Variscite provides a script that can be used to partition an SD card and install the required images on it.
Variscite provides a script that can be used to partition an SD card and install the required images on it.
* Insert a micro SD into your Linux PC
* Insert a micro SD into your Linux PC
* Determine the block device name of your micro SD (for instance /dev/sdc). Use "dmesg" after you inserted theSD card.
* Determine the block device name of your micro SD (for instance /dev/sdc). Use "dmesg" after you inserted the SD card.
* Make sure all partitions of your micro SD are unmounted. Use "sudo umount /media/<uname>" to unmount it.
* Make sure all partitions of your micro SD are unmounted. Use "sudo umount /media/<uname>" to unmount it.
* cd ~/var_kk_443_200/kk_443_200_build
* cd ~/var_kk_443_200/kk_443_200_build
* sudo ./mksdcard.sh /dev/sdX mx6 (replace /dev/sdX with your SD card block device)
* sudo ./var-mksdcard.sh /dev/sdX (replace /dev/sdX with your SD card block device)
Use the created SD card and:
Use the created SD card and:
* Insert the SD card you just created into the MMC/SD slot on the custom board.
* Insert the SD card you just created into the MMC/SD slot on the custom board.
* Press and hold the boot-select button and power-on the SOM.
* Press and hold the boot-select button and power-on the SOM.


== Boot From NAND Flash or eMMC ==
== Boot From eMMC ==
 
Flashing the U-Boot, boot image and Android UBI root file system into NAND can be done from target Linux shell.
 
The images &nbsp;can be found at Android build machine under: "'''out/target/product/var_som_mx6'''".


Boot the target device using Variscite's pre-build NAND recovery SD image version 33 or greater, then follow the instructions below:
Flashing the U-Boot, boot image and Android root file system into NAND/eMMC can be done from target Linux shell.
=== Boot From NAND Flash ===
The images &nbsp;can be found at Android build machine under: "'''out/target/product/var_mx6'''".
<pre>$ nand-recovery.sh -o Android
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
You can also push the Flash Android on the GUI.
 
=== Boot From eMMC Flash ===
<pre>$ nand-recovery.sh -o Android -m Emmc
</pre>
</pre>


Line 296: Line 334:
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
<pre>$ cd ~/var_kk_443_200/kk_443_200_build
$ source build/envsetup.sh
$ source build/envsetup.sh
$ lunch var_som_mx6-user
$ lunch var_mx6-eng
$ make bootimage
$ make bootimage
</pre>
</pre>
Line 314: Line 352:
Execute following commands:
Execute following commands:
<pre>$ make ARCH=arm distclean
<pre>$ make ARCH=arm distclean
$ make mx6_var_som_android_config      # VAR-SOM-MXQ/D/DL/S, boot from MMC
$ make mx6_var_som_sd_android_config    # VAR-SOM-MXQ/D/DL/S, boot from MMC
$ make mx6_var_som_nand_android_config # VAR-SOM-MXQ/D/DL/S, boot from NAND
$ make mx6_var_som_nand_android_config   # VAR-SOM-MXQ/D/DL/S, boot from NAND
$ make -j4 </pre>
$ make -j4 </pre>
<br/>This command will generate the u-boot Image 'u-boot.img'
<br/>This command will generate the u-boot Image 'u-boot.img'
Line 325: Line 363:
Execute following commands
Execute following commands
<pre>$ make distclean
<pre>$ make distclean
$ make var_som_mx6_android_defconfig
$ make imx_v7_var_android_defconfig
$ make -j4 uImage
$ make -j4 uImage
$ make -j4 modules
$ make -j4 modules
Line 332: Line 370:


= Flashing Android with Fastboot =
= Flashing Android with Fastboot =
#Connect a USB OTG cable from the target board OTG port to a you host machine USB HOST port.
#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
#Power up the board and hit return to stop the boot
#type fastboot in the u-boot prompt.
#type fastboot in the u-boot prompt.
On the target:
On the target:
<pre>$ sudo `which fastboot` flash boot out/target/product/var_som_mx6/boot.img
<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_som_mx6/recovery.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash android_root out/target/product/var_som_mx6/android_root.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` reboot
$ sudo `which fastboot` reboot
</pre>
</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 [https://variwiki.com/index.php?title=VAR-SOM-MX6_Android_Unit_Testing_KK_443_200#FASTBOOT Fastboot]


= Display Options =
= Display Options =
Line 354: Line 395:
<pre>BOARD_KERNEL_CMDLINE&nbsp;:= console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off arm_freq=1000 fbmem=24M vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale
<pre>BOARD_KERNEL_CMDLINE&nbsp;:= console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off arm_freq=1000 fbmem=24M vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale
</pre>
</pre>
= Android ADB Setup =
Android Debug Bridge (adb) is a versatile tool that let you manage the state of the Android-powered device.
For more information about how to setup ADB adb, see TI ADB Setup page at [http://processors.wiki.ti.com/index.php/Android_ADB_Setup http://processors.wiki.ti.com/index.php/Android_ADB_Setup].
'''NOTE''': When using adb over USB on Windows Machine, edit '''android_winusb.inf''' to match VAR-SOM-MX6 vendor and product ids, under [Google.NTx86] section add:
;VAR-SOM-MX6
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_0D02
%CompositeAdbInterface%    = USB_Install, USB\VID_18D1&PID_0D02&MI_00

Latest revision as of 11:56, 10 June 2020

VAR-SOM-MX6 Android-KK-4.4.3 200 r1 Developers Guide

Introduction

This WIKI describes how to build and deploy Android KitKat KitKat-4-4 on the VAR-SOM-MX6. It is based on Freescale Android-KK-4.4.3 200.

Overview

The objective of this document is to guide VAR-SOM-MX6 Android developers to obtain Android KitKat 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.

Document Reference

This release is based on Freescale Rev android_kk4.4.3_2.0.0-ga, 07/2014 release. Please download and read the below documents inside android_kk4.4.3_2.0.0-ga_doc.tar.gz.

  • Android User's Guide
  • Android Quick Start Guide
  • Android Release Notes
  • Android Frequently Asked Questions

Supported hardware and features

Feature
Description
Board support
VAR-DVK-MX6
VAR-SOLOCustomBoard
VAR-SOM-MX6
SOM-SOLO
CPU

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

Software platform

Freescale Android-KK-4.4.3 200

Nand Recovery nand-recovery SD V37 - can be downloaded from FTP
NAND Flash size support
128MB up to 1GB
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, Dual band 5.0ghz + MIMO b/g/n
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 12.04 64bit LTS http://www.ubuntu.com/download/desktop


IMPORTANT

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

For 64-bit Ubuntu 12.04

The complete Android host requirments:  source.android.com/source/initializing.html Also the instruction are in Freescale "Android User's Guide" manual.

The following command installs the required packages for setting up the android build host:

First:
$ sudo apt-get install libgl1-mesa-dri
Then:
$ sudo apt-get install git gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

In addition to the packages requested on the Android website, the following packages are also needed:

Installing the JDK

The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate which JDK should be used.

Please follow the link for the java install:  https://variwiki.com/index.php?title=VAR-SOM-MX6_Android_GS-java

Additional packages

In addition to the packages requested on the Android website, the following packages are also required:

$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git-core curl
$ sudo apt-get install uboot-mkimage
NOTE:
The build machine should have at least 30GB of free space to complete the build process.
Please refer to the AOSP documentation for latest information and instructions for setting up other Ubuntu versions http://source.android.com/source/initializing.html

Comment for build error: If this is the first time you build on a 64bit machine you may encounter some error releated to lzo library and other. https://community.freescale.com/thread/303536 has detail information how to fix this.

Obtain source code

The Linux kernel and U-Boot are available through Github. Required patches can be found under: VAR-SOM-MX6/Software/Android_KK/Android-KK4.4.3_Release_200/
Files:

  • android_KK4.4.3_2.0.0-ga_core_source.tar.gz - Freescale's i.MX6 KK4.4.3_200 original patch files.
  • android_kk4.4.3_2.0.0-ga_doc.tar.gz - Freescale i.MX6 KK4.4.3_200 documents
  • android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz - Freescale i.MX6 KK4.4.3_200 omxplayer
  • var_kk443_200_r2.tar.bz2 - Variscite's VAR-SOM-MX6 SOM patch files

Unpack Freescale's Android Release Package

$ mkdir ~/var_kk_443_200
$ cd ~/var_kk_443_200
$ tar xvf ~/Downloads/android_android_KK4.4.3_2.0.0-ga_core_source.tar.gz
$ cd android_android_KK4.4.3_2.0.0-ga_core_source.tar.gz/code/
$ tar xvf kk4.4.3_2.0.0-ga.tar.gz

Download Google Android KK4.4.3

The Android source code is maintained in more than 100 different gits in the Android repository (android.googlesource.com).
To get the Android source code from Google repo, follow the steps below:

$ cd ~/var_kk_443_200
$ mkdir kk_443_200_build
$ cd kk_443_200_build
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.3_r1
$ repo sync
NOTE:
The repo tool which was used by Variscite is available on FTP site.

Download Variscite's u-boot and Linux kernel

clone kk4.4.3_2.0.0-ga kernel source code from Variscite's open source git:

$ cd ~/var_kk_443_200/kk_443_200_build
$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx
$ cd kernel_imx
$ git checkout -b kk4.4.3_2.0.0-ga-var02 remotes/origin/kk4.4.3_2.0.0-ga-var02

clone the U-Boot git repository from Varicite's open source git:

$ cd ~/var_kk_443_200/kk_443_200_build/bootable/bootloader
$ git clone https://github.com/varigit/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout -b kk4.4.3_2.0.0-ga-var02 remotes/origin/kk4.4.3_2.0.0-ga-var02

Patching the AFS sources with Freescale i.MX6 support

The patch script (and_patch.sh) requires some basic utilities like awk/sed.
Apply all Android patches by using the following steps:

$ cd ~/var_kk_443_200/kk_443_200_build
$ source ../android_KK4.4.3_2.0.0-ga_core_source/code/KK4.4.3_2.0.0-ga/and_patch.sh
$  c_patch  ../android_KK4.4.3_2.0.0-ga_core_source/code/KK4.4.3_2.0.0-ga/ imx_KK4.4.3_2.0.0-ga

Install Freescale i.MX6 omxplayer support

The patch script (and_patch.sh) requires some basic utilities like awk/sed.
Apply all Android patches by using the following steps:

$ cd ~/var_kk_443_200/kk_443_200_build
$ cp ~/Download/android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz ./
$ tar xzvf android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz
$ rm android_KK4.4.3_2.0.0-ga_omxplayer_source.tar.gz

Apply VAR-SOM-MX6 patches

After you setup your build machine,unpack Variscite's release Package:

$ cd ~/var_kk_443_200
$ tar xvf ~/Downloads/var_kk443_200_r2.tar.bz2
$ variscite/install
NOTE: The SPL files have been updated. This is a very critical fix. Please download u-boot-spl.tar.bz2 and replace the files in ~/var_kk_443_200/kk_442_100_build/device/variscite/common/firmware/

Build Android Images

Change to Android top level directory.

$ cd ~/var_kk_443_200/kk_443_200_build
$ source build/envsetup.sh
$ lunch var_mx6-eng

Build Android for SD card

$ rm out/target/product/var_mx6/root/fstab.freescale
$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log

Build Android for eMMC

$ rm out/target/product/var_mx6/root/fstab.freescale
$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log
NOTE: Set -j4 to a suitable number. A good practice is to set it to number of threads of you build machine minus 1.
NOTE: rm out/target/product/var_mx6/root/fstab.freescale is only required when you switch from eMMC build to SD card build and vice versa.

Build for NAND

NOTE: Due to android file system size This version only support build to SD card and eMMC.

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 - Support VAR-SOM-MX6Q and VAR-SOM-MX6D
som-mx6dl - Support VAR-SOM-MX6DL and VAR-SOM-SOLO
som-solo - Support SOM-SOLO and SOM-DUAL
<touch> - is "r" or "c" r = resistive touch display
c = capacitive touch dispaly
Full Image Name
Description
boot-som-mx6q-c.img, recovery-som-mx6q-c.img Boot and Recovery images for VAR-DVK-MX6 with Quad or DUAL SOM with Capacitive display.
boot-som-mx6q-r.img, recovery-som-mx6q-r.img Boot and Recovery images for VAR-DVK-MX6 with Quad or DUAL SOM with Resistive display.
boot-som-mx6dl-c.img, recovery-som-mx6dl-c.img Boot and Recovery images for VAR-DVK-MX6 with DL or SOLO SOM with Capacitive display.
boot-som-mx6dl-r.img, recovery-som-mx6dl-r.img Boot and Recovery images for VAR-DVK-MX6 with DL or SOLO SOM with Capacitive display.
boot-som-solo-c.img, recovery-som-solo-c.img Boot and Recovery images for VAR-DVK-MX6 with SOM-SOLO or SOM-DUAL with Capacitive display.
boot-som-solo-r.img, recovery-som-solo-r.img Boot and Recovery images for VAR-DVK-MX6 with SOM-SOLO or SOM-DUAL with Resistive display.
boot-som-solo-vsc.img, recovery-som-solo-vsc.img Boot and Recovery images for VAR-DVK-SOLO with SOM-SOLO or SOM-DUAL with Capacitive LVDS display .

Boot

The Android can be booted from MMC/SD device on sdcard and MMC/SD device on eMMC.  nand-recovery version 37 support the nand and eMMC flash.

Boot From MMC/SD Card

This section will guide you through the process of installing and boot VAR-SOM-MX6 from SD/MMC device.

Create bootable SD card Variscite provides a script that can be used to partition an SD card and install the required images on it.

  • Insert a micro SD into your Linux PC
  • Determine the block device name of your micro SD (for instance /dev/sdc). Use "dmesg" after you inserted the SD card.
  • Make sure all partitions of your micro SD are unmounted. Use "sudo umount /media/<uname>" to unmount it.
  • cd ~/var_kk_443_200/kk_443_200_build
  • sudo ./var-mksdcard.sh /dev/sdX (replace /dev/sdX with your SD card block device)

Use the created SD card and:

  • Insert the SD card you just created into the MMC/SD slot on the custom board.
  • Press and hold the boot-select button and power-on the SOM.

Boot From eMMC

Flashing the U-Boot, boot image and Android root file system into NAND/eMMC can be done from target Linux shell. The images  can be found at Android build machine under: "out/target/product/var_mx6". Boot the target device using Variscite's pre-build NAND recovery SD image version 37or greater, then follow the instructions below:

$ android_emmc.sh

Manual operations

Build boot.img

We use boot.img and booti as default commands to boot rather than the uramdisk and uImage.
You can use this command to generate boot.img under android environment:

$ cd ~/var_kk_443_200/kk_443_200_build
$ source build/envsetup.sh
$ lunch var_mx6-eng
$ 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_kk_443_200/kk_443_200_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_kk_443_200/kk_443_200_build/bootable/bootloader/uboot-imx 

Execute following commands:

$ make ARCH=arm distclean
$ make mx6_var_som_sd_android_config     # VAR-SOM-MXQ/D/DL/S, boot from MMC
$ make mx6_var_som_nand_android_config   # VAR-SOM-MXQ/D/DL/S, boot from NAND
$ make -j4 


This command will generate the u-boot Image 'u-boot.img'

Manual build Android Linux Kernel and modules

Change directory to kernel

$ cd ~/var_kk_443_200/kk_443_200_build/kernel_imx 

Execute following commands

$ make distclean
$ make imx_v7_var_android_defconfig
$ make -j4 uImage
$ make -j4 modules

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

Flashing Android with Fastboot

  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 to stop the boot
  3. type fastboot in the u-boot prompt.

On the target:

$ 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 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 Fastboot

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_kk_443_200/kk_443_200_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 arm_freq=1000 fbmem=48M vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale
  • Variscite's LCD (Capacitive and resistive)
BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off arm_freq=1000 fbmem=24M vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale