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

From Variscite Wiki
m (Text replacement - "http://variwiki" to "https://variwiki")
 
(36 intermediate revisions by 2 users not shown)
Line 3: Line 3:
= Introduction<br/> =
= Introduction<br/> =


This is the first release for VAR-SOM-MX6 Android-KK-4.4.2 100. This version only support VAR-SOM-MX6Q.
This is the first Android KK release for VAR-SOM-MX6, Android-KK-4.4.2 100. This version only supports VAR-SOM-MX6 Quad/Dual. Solo and Dualite support will be added in the coming few weeks.


The defintion is splited into 3 platforms&nbsp;: Q, DL and Solo to enable better tuning&nbsp; for som based parameters.
The explanations are is splitted into 3 platforms&nbsp;: Q, DL and Solo to enable better tuning&nbsp; for som based parameters.
<br>We change the build system to make it straight forward.  
<br>We have changed the build procedure to be more automatic, for simplicity.
In case needed the previous wiki is available :
*[[VAR-SOM-MX6 Android GS R21|Developers Guide]]


= Overview =
= Overview =


The objective of this document is to guide Android developers to get access to Android KitKat release sources for VAR-SOM-MX6, setting up host environment for compilation and deployment.
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 to:
This document contains instructions for:


*Hardware and software requirement.
*Hardware and software requirements.
*Setup the hardware.
*Setup the hardware.
*Setup the toolchain.
*Setup the toolchain.
Line 22: Line 20:
*Install the binaries on the VAR-SOM-MX6 SOM.
*Install the binaries on the VAR-SOM-MX6 SOM.


== Document Reference<br/> ==
== Document Reference ==


This release is based on Freescale Rev android_kk4.4.2_1.0.0-ga, 07/2014 release. Please download and read the documents android_kk4.4.2_1.0.0-ga_docs.tar.
This release is based on Freescale Rev android_kk4.4.2_1.0.0-ga, 07/2014 release. Please download and read the documents android_kk4.4.2_1.0.0-ga_docs.tar.
Line 43: Line 41:
| CPU (Only Quad supported)<br/>
| CPU (Only Quad supported)<br/>
|  
|  
[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]
Solo and dual lite will be supported within 2 weeks


|-
|-
Line 52: Line 51:
|-
|-
| Nand Recovery
| Nand Recovery
| NAND-recovery SD V23 - can be downloaded from FTP
| Will be available in next release, once all SOMs version are supported.
|-
|-
| NAND Flash size support<br/>
| NAND Flash size support<br/>
Line 102: Line 101:
| +
| +
|}
|}
Variscite Android release for Freescale i.MX6 version Android-JB-4.2.2 110.


= Hardware Requirements =
= Hardware Requirements =
Line 113: Line 110:
The host development environment for Android is based on Ubuntu, please install Ubuntu version 12.04 64bit LTS [http://www.ubuntu.com/download/desktop http://www.ubuntu.com/download/desktop]
The host development environment for Android is based on Ubuntu, please install Ubuntu version 12.04 64bit LTS [http://www.ubuntu.com/download/desktop http://www.ubuntu.com/download/desktop]


We recommend you to have a Linux "Ubuntu 12.04 64bit LTS" Host machine.
 


=== IMPORTANT ===
=== IMPORTANT ===
 
Do not use other Ubuntu releases, other than recommended above.
This DevKit Release was built with 64-bit Ubuntu 12.04. We highly recomend to use this version as your build system.<br/>The host installation would need few more Android specific dependencies, these can be installed dynamically over network using below commands.


=== For 64-bit Ubuntu 12.04 ===
=== For 64-bit Ubuntu 12.04 ===
Line 138: Line 134:
=== Installing the JDK ===
=== 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 to the system 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 folow 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 153: Line 149:
</pre>
</pre>
{{note| NOTE:<br>The build machine should have at least 30GB of free space to complete the build process.</span><br>Please refer to the AOSP documentation for latest information and instructions for setting up other Ubuntu versions http://source.android.com/source/initializing.html|info}}
{{note| NOTE:<br>The build machine should have at least 30GB of free space to complete the build process.</span><br>Please refer to the AOSP documentation for latest information and instructions for setting up other Ubuntu versions http://source.android.com/source/initializing.html|info}}
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 https://community.freescale.com/thread/303536] has detail information how to fix this.


= <span style="line-height: 1.5em;">Obtain source code</span> =
= <span style="line-height: 1.5em;">Obtain source code</span> =
Line 158: Line 157:
<span style="line-height: 1.5em;">Variscite provides an Android Release Package for the VAR-SOM-MX6. The Linux kernel and U-Boot are available through GITHUB.</span>
<span style="line-height: 1.5em;">Variscite provides an Android Release Package for the VAR-SOM-MX6. The Linux kernel and U-Boot are available through GITHUB.</span>


The Android KK installer Package for the VAR-SOM-MX6&nbsp;can be obtained from Variscite's FTP, under:<br/>/VAR-SOM-MX6/Software/Android_KK/Android-KK4.4.2_Release_100/<br/>Files:<br/>
The Android KK installer Package for the VAR-SOM-MX6&nbsp;can be obtained from Variscite's FTP, under: /VAR-SOM-MX6/Software/Android_KK/Android-KK4.4.2_Release_100/<br/>Files:<br/>
* android_kk4.4.2_1.0.0-ga_core_source.tar.gz - Freescale's i.MX6 KK4.4.2_100 original patch files.<br/>
* android_kk4.4.2_1.0.0-ga_core_source.tar.gz - Freescale's i.MX6 KK4.4.2_100 original patch files.<br/>
* android_kk4.4.2_1.0.0-ga_docs.tar.gz - Freescale i.MX6 KK4.4.2_100 documents<br/>
* android_kk4.4.2_1.0.0-ga_docs.tar.gz - Freescale i.MX6 KK4.4.2_100 documents<br/>
Line 167: Line 166:
$ cd ~/var_kk_442_100
$ cd ~/var_kk_442_100
$ tar xvf ~/Downloads/android_kk4.4.2_1.0.0-ga_core_source.tar.gz
$ tar xvf ~/Downloads/android_kk4.4.2_1.0.0-ga_core_source.tar.gz
$ tar xvf android_kk4.4.2_1.0.0-ga_core_source/code/kk4.4.2_1.0.0-ga.tar.gz</pre>
$ cd android_kk4.4.2_1.0.0-ga_core_source/code/
$ tar xvf kk4.4.2_1.0.0-ga.tar.gz</pre>


=== Download Google Android KK4.4.2 <br/> ===
=== Download Google Android KK4.4.2 <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:
Assuming you have unzipped the Android release package to ~/var_jb_422_110/android_jb4.2.2_1.1.0-ga_source/.
<pre>$ cd ~/var_kk_442_100
<pre>$ cd ~/var_kk_442_100
$ mkdir kk_442_100_build
$ mkdir kk_442_100_build
Line 200: Line 198:
=== <span style="line-height: 1.5em;">Patching the AFS sources with Freescale i.MX6 support</span> ===
=== <span style="line-height: 1.5em;">Patching the AFS sources with Freescale i.MX6 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/>Assuming you have unzipped the Android release package to ~/var_jb_422_110/android_jb4.2.2_1.1.0-ga_source/.
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_442_100/kk_442_100_build
<pre>$ cd ~/var_kk_442_100/kk_442_100_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.2_1.0.0-ga_core_source/code/kk4.4.2_1.0.0-ga/and_patch.sh
Line 221: Line 219:
{{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.
{{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.
|info}}
|info}}
<pre>
* SD card build
SD card build
<pre>$ ./build.sh mx6q sdcard</pre>
$ ./build.sh mx6q sdcard
* UBIFS build
UBIFS build
<pre>$ ./build.sh mx6q ubifs</pre>
$ ./build.sh mx6q ubifs
</pre>
 
{{note| NOTE:<br>
If you exit your system and want to re build your Android you need to run the above commands again.<br>
$ cd ~/var_jb_422_110/jb_422_110_build
$ source build/envsetup.sh
<br>Select:
<br>$ lunch var_som_mx6q-user
<br>or
<br>$ lunch var_som_mx6dl-user
<br>or
<br>$ lunch var_som_mx6solo-user"<br>
|info}}
 
=== Generate UBI images ===
 
<span style="line-height: 1.5em;">To generate UBI images to be installed on the NAND-flash, follow the below steps:</span>
 
<span style="line-height: 1.5em;">For Quad platform:</span>
<pre>$ make -j4 PRODUCT-var_som_mx6q-user BUILD_TARGET_FS=ubifs
</pre>
For Dual Lite platform:
<pre>$ make -j4 PRODUCT-var_som_mx6dl-user BUILD_TARGET_FS=ubifs
</pre>
For Solo platform:
<pre>$ make -j4 PRODUCT-var_som_mx6solo-user BUILD_TARGET_FS=ubifs
</pre>
*The above commands will build the Android file-system, kernel, related modules and U-Boot.
*Android rootfs components (root and system directories) will be located in ''''out/target/product/var_som_mx6''''.
*The UBI build must be run only after the first build.


=== Build for 4GB NAND ===
=== Build for 4GB NAND ===
Update your kernel make sure "git log" that you have
<br/>commit 8472677917e23c6d125554bd51a88a28a169de95
<br/>Add 4GB nand MT29F32G08AFACAWP support. Fixed dual flash bank issue
Edit your BoardConfig.mk located at device/variscite/var_som_mx6q.
Edit your BoardConfig.mk located at device/variscite/var_som_mx6q.
At the end comment out the UBIFS parameters and  
At the end comment out the UBIFS parameters and  
Line 279: Line 242:
UBI_VID_HDR_OFFSET=4096
UBI_VID_HDR_OFFSET=4096
fi
fi
=== Build boot.img ===
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>$ source build/envsetup.sh
$ lunch var_som_mx6q-user
$ make bootimage
</pre>
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 https://community.freescale.com/thread/303536] has detail information how to fix this.
=== 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
<pre>$ export CROSS_COMPILE=~/var_jb_422_110/jb_422_110_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
</pre>
=== Manual build Bootloader&nbsp; ===
Change directory to u-boot
<pre>$ cd ~/var_jb_422_110/jb_422_110_build/bootable/bootloader/uboot-imx </pre>
Execute following commands:
<pre>$ make ARCH=arm distclean
$ make ARCH=arm mx6q_var_som_android_config # VAR-SOM-MXQ/D, boot from MMC
$ make ARCH=arm mx6solo_var_som_android_config # VAR-SOM-MXSolo, boot from MMC
$ make ARCH=arm mx6dl_var_som_android_config # VAR-SOM-MXDL, boot from MMC
$ make ARCH=arm mx6q_var_som_nand_android_config # VAR-SOM-MXQ/D, boot from NAND
$ make ARCH=arm mx6solo_var_som_nand_android_config # VAR-SOM-MXSolo, boot from NAND
$ make ARCH=arm mx6dl_var_som_nand_android_config # VAR-SOM-MXDL, boot from NAND
$ make ARCH=arm </pre>
<br/>This command will generate the u-boot Image 'u-boot.bin'
=== Manual build Android Linux Kernel and modules ===
Change directory to kernel
<pre>$ cd ~/var_jb_422_110/jb_422_110_build/kernel_imx </pre>
Execute following commands
<pre>$ make ARCH=arm distclean
$ make ARCH=arm var_som_mx6_android_defconfig
$ make ARCH=arm uImage
$ make ARCH=arm modules
</pre>
This will generate uImage(kernel image) in kernel/arch/arm/boot folder


= Boot =
= Boot =
Line 336: Line 254:


Variscite provides a script that can be used to partition the SD card and to install the required images on it.
Variscite provides a script that can be used to partition the SD card and to install the required images on it.
 
* Insert a micro SD into your Linux PC
Please download mksdcard.sh from the FTP site.
* Determine the block device name of your micro SD (for instance /dev/sdc)
 
* Make sure all partitions of your micro SD are unmounted.
If you buid an image for UBIFS you need to re run your build:
* cd ~/var_kk_442_100/kk_442_100_build
<pre>$ make clean
* sudo ./mksdcard.sh /dev/sdX mx6q (replace /dev/sdX with your SD card block device)
$ make -j6
Use the created SD card and:
</pre>
Connect the SD-Card(2GB>) to the Linux machine, using a memory card reader to the Linux machine.
 
*Note the name allocated for this device. Type "dmesg". The SD card name should show up near the end, usually something like "SDC" (/dev/sdc) or "SDD" (/dev/sdd) or "MMC" . replace "/dev/mmcblk0" with the right one.
*Run the following command:
 
To create SD card for VAR-SOM-MX6Q device:
<pre>$ cd ~/var_jb_422_110/jb_422_110_build
$ chmod a+x mksdcard.sh
$ sudo ./mksdcard.sh /dev/mmcblk0 mx6q
</pre>
To create SD card for VAR-SOM-MX6DL device:
<pre>$ cd ~/var_jb_422_110/jb_422_110_build
$ chmod a+x mksdcard.sh
$ sudo ./mksdcard.sh /dev/mmcblk0 mx6dl
</pre>
To create SD card for VAR-SOM-MX6Solo device:
<pre>$ cd ~/var_jb_422_110/jb_422_110_build
$ chmod a+x mksdcard.sh
$ sudo  ./mksdcard.sh /dev/mmcblk0 mx6solo
</pre>
=== Boot Android from SD card ===
 
*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.
Line 390: Line 285:
# ubiformat /dev/mtd5 -f <android_root.img> -s 2048 -O 2048
# ubiformat /dev/mtd5 -f <android_root.img> -s 2048 -O 2048
</pre>
</pre>
= Manual operations =
== Build boot.img ==
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>$ cd ~/var_kk_442_100/kk_442_100_build
$ source build/envsetup.sh
$ lunch var_som_mx6q-user
$ make bootimage
</pre>
=== 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
<pre>$ export ARCH=arm
$ export PATH=~/var_kk_442_100/kk_442_100_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
$ export CROSS_COMPILE=arm-eabi-
</pre>
=== Manual build Bootloader&nbsp; ===
Change directory to u-boot
<pre>$ cd ~/var_kk_442_100/kk_442_100_build/bootable/bootloader/uboot-imx </pre>
Execute following commands:
<pre>$ make ARCH=arm distclean
$ make mx6q_var_som_android_config # VAR-SOM-MXQ/D, boot from MMC
$ make mx6solo_var_som_android_config # VAR-SOM-MXSolo, boot from MMC
$ make mx6dl_var_som_android_config # VAR-SOM-MXDL, boot from MMC
$ make mx6q_var_som_nand_android_config # VAR-SOM-MXQ/D, boot from NAND
$ make mx6solo_var_som_nand_android_config # VAR-SOM-MXSolo, boot from NAND
$ make mx6dl_var_som_nand_android_config # VAR-SOM-MXDL, boot from NAND
$ make -j4 </pre>
<br/>This command will generate the u-boot Image 'u-boot.bin'
=== Manual build Android Linux Kernel and modules ===
Change directory to kernel
<pre>$ cd ~/var_kk_442_100/kk_442_100_build/kernel_imx </pre>
Execute following commands
<pre>$ make distclean
$ make var_som_mx6_android_defconfig
$ make -j4 uImage
$ make -j4 modules
</pre>
This will generate uImage(kernel image) in kernel/arch/arm/boot folder


= Flashing Android with Fastboot =
= Flashing Android with Fastboot =
Line 406: Line 347:
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 ''''~/imx-android-jb4.2.2_1.0.0-ga-var11/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_kk_442_100/kk_442_100_build/device/variscite/var_som_mx6/BoardConfig.mk'''' as follows:


*HDMI
*HDMI

Latest revision as of 11:56, 10 June 2020

VAR-SOM-MX6 Android-KK-4.4.2 100 r1 Developers Guide

Introduction

This is the first Android KK release for VAR-SOM-MX6, Android-KK-4.4.2 100. This version only supports VAR-SOM-MX6 Quad/Dual. Solo and Dualite support will be added in the coming few weeks.

The explanations are is splitted into 3 platforms : Q, DL and Solo to enable better tuning  for som based parameters.
We have changed the build procedure to be more automatic, for simplicity.

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.

Document Reference

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

  • 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-SOM-MX6
CPU (Only Quad supported)

i.MX6 Quad Solo and dual lite will be supported within 2 weeks

Software platform

Freescale Android-KK-4.4.2 100

Nand Recovery Will be available in next release, once all SOMs version are supported.
NAND Flash size support
0.5,1.0,2.0 GB
SD-Card
+
Wired Network
10/100/1000 Mbps Ethernet
Wireless Network
802.11 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, EVK supports 800x480 resolution) LVDS1 external display
Audio Line IN/ Line out
Camera ov5640 camera sensor. CB402 board can be ordered seperately at : sales@variscite.com
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

Variscite provides an Android Release Package for the VAR-SOM-MX6. The Linux kernel and U-Boot are available through GITHUB.

The Android KK installer Package for the VAR-SOM-MX6 can be obtained from Variscite's FTP, under: /VAR-SOM-MX6/Software/Android_KK/Android-KK4.4.2_Release_100/
Files:

  • android_kk4.4.2_1.0.0-ga_core_source.tar.gz - Freescale's i.MX6 KK4.4.2_100 original patch files.
  • android_kk4.4.2_1.0.0-ga_docs.tar.gz - Freescale i.MX6 KK4.4.2_100 documents
  • var_kk442_100_r1.tar.bz2 - Variscite's VAR-SOM-MX6 SOM patch files

Unpack Freescale's Android Release Package

$ mkdir ~/var_kk_442_100
$ cd ~/var_kk_442_100
$ tar xvf ~/Downloads/android_kk4.4.2_1.0.0-ga_core_source.tar.gz
$ cd android_kk4.4.2_1.0.0-ga_core_source/code/
$ tar xvf kk4.4.2_1.0.0-ga.tar.gz

Download Google Android KK4.4.2

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_442_100
$ mkdir kk_442_100_build
$ cd kk_442_100_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.2_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.2_1.0.0-ga kernel source code from Variscite's open source git:

$ cd ~/var_kk_442_100/kk_442_100_build
$ git clone git://github.com/varigit/linux-2.6-imx.git kernel_imx
$ cd kernel_imx
$ git checkout -b kk4.4.2_1.0.0-ga-var01 remotes/origin/kk4.4.2_1.0.0-ga-var01

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

$ cd cd ~/var_kk_442_100/kk_442_100_build/bootable/bootloader
$ git clone git://github.com/varigit/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout -b kk4.4.2_1.0.0-ga-var01 remotes/origin/kk4.4.2_1.0.0-ga-var01

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_442_100/kk_442_100_build
$ source ../android_kk4.4.2_1.0.0-ga_core_source/code/kk4.4.2_1.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

Apply VAR-SOM-MX6 patches

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

$ cd ~/var_kk_442_100
$ tar xvf ~/Downloads/var_kk442_100_r1.tar.bz2
$ variscite/install

Build Android Images

Build the Android Filesystem

Change to Android top level directory.

$ cd ~/var_kk_442_100/kk_442_100_build
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.
  • SD card build
$ ./build.sh mx6q sdcard
  • UBIFS build
$ ./build.sh mx6q ubifs

Build for 4GB NAND

Edit your BoardConfig.mk located at device/variscite/var_som_mx6q. At the end comment out the UBIFS parameters and add: "
#Micron 4096MB MT29F32G08AFACAWP NAND
TARGET_MKUBIFS_ARGS := -m 4096 -e 516096 -c 7855 -x none
TARGET_UBIRAW_ARGS := -m 4096 -p 512KiB -s 4096 -O 4096 $(UBI_ROOT_INI)
"
Rebuild your ubi system and you will get new ubifs for 4GB nand flash. nand-recovery.sh on the recovery sd card need to be updated with if [ `dmesg |grep MT29F32G08AFACAWP | wc -l` = 1 ] ; then # this is 4GB NAND (MT29F32G08AFACAWP) echo "4GB nand selected ..." ROOTFS_IMAGE=rootfs_4G_NAND.ubi.img ANDROID_SYSTEM=android_root_4G_NAND.img UBI_SUB_PAGE_SIZE=4096 UBI_VID_HDR_OFFSET=4096 fi

Boot

The Android can either be booted from MMC/SD device or UBIFS on NAND. 

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 the SD card and to 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)
  • Make sure all partitions of your micro SD are unmounted.
  • cd ~/var_kk_442_100/kk_442_100_build
  • sudo ./mksdcard.sh /dev/sdX mx6q (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 NAND Flash

Flashing the U-Boot, boot image and Android UBI root file system into NAND can be done from target Linux shell.

The images  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, then follow the instructions below:

Flashing U-Boot to NAND

We recommend using our nand-recovery utility to flash the Android. You can update the relevant files in /opt/recovery/Android and use it to flash your images.

# flash_eraseall /dev/mtd0 
# kobs-ng init <u-boot-mx6XXX.bin> --search_exponent=1 -v

Flashing the Boot Image to NAND

# flash_eraseall /dev/mtd3 
# nandwrite -p /dev/mtd3 <boot.img>

Flashing the Android UBI Root File-System to NAND

# flash_eraseall /dev/mtd5 2>/dev/null
# ubiformat /dev/mtd5 -f <android_root.img> -s 2048 -O 2048

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_442_100/kk_442_100_build
$ source build/envsetup.sh
$ lunch var_som_mx6q-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_kk_442_100/kk_442_100_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_442_100/kk_442_100_build/bootable/bootloader/uboot-imx 

Execute following commands:

$ make ARCH=arm distclean
$ make mx6q_var_som_android_config # VAR-SOM-MXQ/D, boot from MMC
$ make mx6solo_var_som_android_config # VAR-SOM-MXSolo, boot from MMC
$ make mx6dl_var_som_android_config # VAR-SOM-MXDL, boot from MMC
$ make mx6q_var_som_nand_android_config # VAR-SOM-MXQ/D, boot from NAND
$ make mx6solo_var_som_nand_android_config # VAR-SOM-MXSolo, boot from NAND
$ make mx6dl_var_som_nand_android_config # VAR-SOM-MXDL, boot from NAND
$ make -j4 


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

Manual build Android Linux Kernel and modules

Change directory to kernel

$ cd ~/var_kk_442_100/kk_442_100_build/kernel_imx 

Execute following commands

$ make distclean
$ make var_som_mx6_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 you 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_som_mx6q/boot.img
$ sudo `which fastboot` flash recovery out/target/product/var_som_mx6q/recovery.img
$ sudo `which fastboot` flash android_root out/target/product/var_som_mx6q/android_root.img
$ sudo `which fastboot` reboot

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_442_100/kk_442_100_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

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.

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