VAR-SOM-MX6 Android: Difference between revisions

From Variscite Wiki
(Created page with "<!-- Set release according to "release" parameter in URL and use RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6 as default --> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- --> {{#l...")
 
No edit summary
 
(148 intermediate revisions by 4 users not shown)
Line 2: Line 2:
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Android {{#var:ANDROID_NAME}} {{#var:ANDROID_VERSION}} developer guide}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Android}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Android {{#var:ANDROID_NAME}} {{#var:ANDROID_VERSION}} Developer Guide}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Android}} __toc__


= Introduction<br/> =
= Introduction<br/> =
Line 21: Line 21:


= Supported hardware and features =
= Supported hardware and features =
{{#lst:Android_Platform_Customization|{{#var:ANDROID_SUPPORTED_HARDWARE_SECTION}}}}


{| class="wikitable"
= Hardware Requirements =
|-
! scope="col" | Feature<br/>
! scope="col" | Description<br/>
|-
| SOM support<br/>
| [http://www.variscite.com/products/system-on-module-som/cortex-a9/var-som-mx6-cpu-freescale-imx6 VAR-SOM-MX6 V2]<br>[http://www.variscite.com/products/system-on-module-som/cortex-a9/var-som-solo-cpu-freescale-imx6 VAR-SOM-SOLO]<br>[http://www.variscite.com/products/system-on-module-som/cortex-a9/var-som-solo-cpu-freescale-imx6 VAR-SOM-DUAL]<br>[http://www.variscite.com/products/system-on-module-som/cortex-a9/dart-mx6-cpu-freescale-imx6 DART-MX6]
|-
| Carrier Board support<br/>
| [http://www.variscite.com/products/single-board-computers/var-mx6customboard VAR-MX6CustomBoard]<br>[http://www.variscite.com/products/single-board-computers/var-solocustomboard VAR-SOLOCustomBoard]<br/>[http://www.variscite.com/products/evaluation-kits/dart-mx6-kits VAR-DVK-DT6]
|-
| CPU<br/>
|
[http://www.nxp.com/iMX6QP i.MX6 Quad Plus]<br/>
[http://www.nxp.com/iMX6Q i.MX6 Quad]<br/>
[http://www.nxp.com/iMX6D i.MX6 Dual]<br/>
[http://www.nxp.com/iMX6DL i.MX6 Dual lite]<br/>
[http://www.nxp.com/iMX6S i.MX6 Solo]


|-
* You will need the Variscite {{#var:HARDWARE_NAME}} based evaluation kit.
| NAND flash size support<br/>
* Debug UART cable - For serial Debugging
| 128MB and up<br/>
|-
| eMMC<br/>
| up to 64GB<br/>
|-
| DDR size support configuration<br/>
| Solo:up to 1GB. DualLite, Dual, Quad: up to 4GB<br/>
|-
| SD card<br/>
| +<br/>
|-
| Wired Network<br/>
| 10/100/1000 Mbps Ethernet<br/>
|-
| Wireless Network<br/>
| Support for Wilink8, 802.11abgn STA, AP, & Wi-Fi Direct Mode SmartConfig [http://www.ti.com/lsds/ti/wireless_connectivity/wilink/products.page Wilink8 page]<br/>
|-
| Bluetooth<br/>
| +
|-
| SPI<br/>
| +
|-
| I2C<br/>
| +
|-
| Canbus<br/>
| +
|-
| USB host<br/>
| +<br/>
|-
| USB OTG<br/>
| Host and Device<br/>
|-
| Uarts<br/>
| x3, up to 3.6 Mbps.<br/>
|-
| RTC<br/>
| +<br/>
|-
| Display
| HDMI: 720P,1080P<br/> 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 =
*  OTG {{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 | Micro B |  (Type C) }} to A - For adb and fastboot
 
VAR-SOM-MX6 evaluation kit.


== Host (PC) setup requirements ==
== Host (PC) setup requirements ==


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


<span style="color:red">Note: </span>Do not use other Ubuntu or Debian releases, than recommended above.
We recommend to have Physical Build machine, but if you are running Linux in a virtual machine, please make sure you allocate at least 16GB of RAM and 32 GB swap to virtual machine.
 
<span style="color:red">Note: </span>Do not use other Ubuntu or Debian releases, than the ones recommended above.


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


=== Install the OpenJDK ===
If you are using Ubuntu 16.04 LTS latest repo tool  requires Python 3.0
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get install python3.6
$ sudo apt-get install python-is-python2
 
If you are using Ubuntu 20.04 LTS requires below package
$ sudo apt-get install python-is-python2
 
=== Configure GIT account ===
<pre>
<pre>
$ sudo apt-get update
$ git config --global user.name "Your Name"
$ sudo apt-get install openjdk-7-jdk
$ git config --global user.email "Your Email"
</pre>
</pre>
=== Install the OpenJDK ===
Android Nougat requires OpenJDK 8.
To install it:
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk
If your Ubuntu version is missing the package (which shouldn't happen), add the PPA repository and run the previous commands again:
$ sudo add-apt-repository ppa:openjdk-r/ppa
Update the default Java version by running:
Update the default Java version by running:
<pre>
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
</pre>


<span style="color:red">Note: </span>The build machine should have at least 50GB of free space to complete the build process.
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
 
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
By default Ubuntu 16.04 LTS - OpenJDK has the java security algorithms blacklisted. The jack server generates warning.
Run below command to fix it
sudo sed  -i -e "s/ TLSv1,//g" -e "s/ TLSv1.1,//g" /etc/java-8-openjdk/security/java.security
|}}
 
 
<span style="color:red">Note: </span>The build process requires about 135GB of free space.


= <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 Linux kernel and U-Boot are available through Github.<br>
Required patches for the Android file system are under: ftp://customerv:Variscite1@ftp.variscite.com/VAR-SOM-MX6/Software/Android/Android_IMX6_M711_100 in Variscite's FTP<br>
Required patches for the Android file system are under: {{#var:ANDROID_VARFTP_PATCH_DIR}} in Variscite's FTP<br>
<br>
<br>
Files:<br>
Files:<br>
* android_N7.1.1_1.0.0_source.tar.gz - NXP's i.MX6 N7.1.1_1.0.0 original BSP patch files.<br>
* {{#var:ANDROID_VARFTP_BASE_PATCH_FILE}} - NXP's i.MX6 {{#var:ANDROID_NXP_VERSION}} original BSP patch files.<br>




== <span style="line-height: 1.5em;">Get NXP's Android Release Package</span> ==
== <span style="line-height: 1.5em;">Get NXP's Android Release Package</span> ==
<pre>
$ mkdir {{#var:BUILD_FOLDER}}
$ mkdir ~/var_m_711_100
$ cd {{#var:BUILD_FOLDER}}
$ cd ~/var_m_711_100
$ curl -o ~/Downloads/{{#var:ANDROID_VARFTP_BASE_PATCH_FILE}} {{#var:ANDROID_VARFTP_PATCH_DIR}}{{#var:ANDROID_VARFTP_BASE_PATCH_FILE}}
$ tar xvf ~/Downloads/android_N7.1.1_1.0.0_source.tar.gz
$ tar xvf ~/Downloads/{{#var:ANDROID_VARFTP_BASE_PATCH_FILE}}
</pre>


== Download Google Android N7.1.1 ==
== Download Google Android {{#var:ANDROID_VERSION}} ==
 
$ mkdir -p ~/bin
<pre>
  $ curl -o ~/bin/repo http://commondatastorage.googleapis.com/git-repo-downloads/repo
$ mkdir ~/var_m_711_100/m_711_100_build
$ chmod a+x ~/bin/repo
$ cd ~/var_m_711_100/m_711_100_build
$ export PATH=~/bin:$PATH
$ mkdir ~/bin
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ cd {{#var:BUILD_FOLDER}}
$ chmod a+x ~/bin/repo
$ sed -i '/repo sync/ised -i "s+git.freescale.com/proprietary/+github.com/NXP+g" .repo/manifests/*' imx-o8.0.0_1.0.0_ga/imx_android_setup.sh
$ export PATH=~/bin:$PATH
$ WORKSPACE=`pwd` android_builddir=`pwd`/imx-o8.0.0_1.0.0_ga/android_build/ imx-o8.0.0_1.0.0_ga/imx_android_setup.sh
$ repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r22
* Note: Since Oreo the distribution of Android Source code is partially hosted on Linux Foundation https://source.codeaurora.org/
$ repo sync -j4
Let the script finish and it should create "android_build" folder
</pre>
$ cd imx-o8.0.0_1.0.0_ga/android_build; mkdir -p vendor/variscite/
|
$ mkdir {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ cd  {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ repo init -u https://android.googlesource.com/platform/manifest -b {{#var:ANDROID_MANIFEST_BRANCH}}
$ repo sync -j4
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | N7.1.2_2.0.0 |
$ cd system/tools
$ git clone https://android.googlesource.com/platform/system/tools/bpt
$ cd bpt
$ git checkout -b n7.1.2_2.0.0-ga b7c3059e5d8c408f60222edc898ef1c229d8fc2d
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
||}}
|}}


== Clone Variscite's U-Boot and Linux kernel sources ==
== Clone Variscite's U-Boot and Linux kernel sources ==
<pre>
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ mkdir -p ~/var_m_711_100/m_711_100_build/bootable/bootloader
$ cd vendor/variscite/
$ cd ~/var_m_711_100/m_711_100_build/bootable/bootloader
$ git clone {{#var:U-BOOT_GIT}} -b {{#var:U-BOOT_BRANCH}}
$ git clone https://github.com/varigit/uboot-imx.git -b n7.1.1_1.0.0_ga_var01
$ git clone {{#var:KERNEL_GIT}} kernel_imx -b {{#var:KERNEL_BRANCH}}
$ cd ~/var_m_711_100/m_711_100_build
|
$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx -b n7.1.1_1.0.0-ga-var01
$ mkdir -p {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/bootable/bootloader
</pre>
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/bootable/bootloader
$ git clone {{#var:U-BOOT_GIT}} -b {{#var:U-BOOT_BRANCH}}
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ git clone {{#var:KERNEL_GIT}} kernel_imx -b {{#var:KERNEL_BRANCH}}
}}


{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 ||
== <span style="line-height: 1.5em;">Apply all the i.MX Android patches with Freescale i.MX6 support</span> ==
== <span style="line-height: 1.5em;">Apply all the i.MX Android patches with Freescale i.MX6 support</span> ==
<pre>
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ cd ~/var_m_711_100/m_711_100_build
$ source ../{{#var:ANDROID_BASE_SRC_DIR}}/code/{{#var:ANDROID_NXP_VERSION}}/and_patch.sh
$ source ../android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0/and_patch.sh
**** Invoke ". and_patch.sh" from your shell to add following functions to your environment:
**** Invoke ". and_patch.sh" from your shell to add following functions to your environment:
****-- c_gotop:    Changes directory to the top of the tree  
****-- c_gotop:    Changes directory to the top of the tree  
****-- c_patch:    Recover working tree to base version and then applying FSL android patch
****-- c_patch:    Recover working tree to base version and then applying FSL android patch
 
$ c_patch  ../{{#var:ANDROID_BASE_SRC_DIR}}/code/{{#var:ANDROID_NXP_VERSION}} {{#var:ANDROID_NXP_LOCAL_BRANCH}}
$ c_patch  ../android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0 imx_N7.1.1_1.0.0
If everything is OK, "c_patch" generates the following output to indicate the successful patch:
If everything is OK, "c_patch" generates the following output to indicate the successful patch:
*************************************************************
*************************************************************
Success: Now you can build android code for FSL i.MX platform
Success: Now you can build android code for FSL i.MX platform
*************************************************************
*************************************************************
}}
</pre>


== <span style="line-height: 1.5em;">Apply Variscite's i.MX6 platforms' patches</span> ==
== <span style="line-height: 1.5em;">Apply Variscite's i.MX6 platforms' patches</span> ==
<pre>
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ cd ~/var_m_711_100/m_711_100_build/devices
$ cd {{#var:BUILD_FOLDER_ANDROID}}/device
$ git clone https://github.com/varigit/MX6x-android.git -b n7.1.1_1.0.0-ga-var01 variscite
|
$ variscite/scripts/install
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/device
</pre>
|}}
$ git clone {{#var:ANDROID_VARISCITE_GIT}} -b {{#var:ANDROID_VARISCITE_BRANCH}} variscite
$ variscite/scripts/install.sh


= Build Android Images =
= Build Android Images =
Change to Android top level directory.
Change to Android top level directory.
<pre>
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ cd ~/var_m_711_100/m_711_100_build
$ cd {{#var:BUILD_FOLDER_ANDROID}}
$ source build/envsetup.sh
|
$ lunch var_mx6-eng
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
or
|}}
$ lunch var_mx6-user
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
</pre>
$ source build/envsetup.sh
<span style="color:red">Note: </span> var_mx6-user creates a production version of the Android Marshmallow.
$ lunch var_mx6-eng
var_mx6-eng creates an engineering version of the Android Marshmallow. Development mode enable and development tools are available on target.
or
$ lunch var_mx6-userdebug
<span style="color:red">Note: </span> var_mx6-userdebug creates a debuggable version of Android.
var_mx6-eng creates an engineering version of Android. Development mode enable and development tools are available on target.
|
$ source build/envsetup.sh
$ lunch var_mx6-eng
or
$ lunch var_mx6-user
<span style="color:red">Note: </span> var_mx6-user creates a production version of Android.
var_mx6-eng creates an engineering version of Android. Development mode enable and development tools are available on target.
|}}


$ export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
== Switching 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/recovery/root/fstab* out/target/product/var_mx6/root/fstab*
$ rm out/target/product/var_mx6/recovery/root/fstab* out/target/product/var_mx6/root/fstab*
</pre>


== Build Android for SD card ==
== Build Android for SD card ==
<pre>
$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log
$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log
</pre>


*Note: When running Android from an SD card, the eMMC will be detected and presented as an SD card storage.
*Note: When running Android from an SD card, the eMMC will be detected and presented as an SD card storage.


== Build Android for on-SOM eMMC ==
== Build Android for on-SOM eMMC ==
<pre>
$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log
$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log
 
</pre>
=== Special notes for DART-MX6: user builds for eMMC ===
Due to HW specific features, dm-verity feature has been disabled on user builds for eMMC on DART-MX6.
 
To enable this feature, follow next steps:
 
* correctly set PRODUCT_SYSTEM_VERITY_PARTITION in device/variscite/imx6/var_mx6.mk
* enable verify in device/variscite/var_mx6/fstab_emmc_dart.freescale
 
The comments in the files will suggest the detailed actions.


== Build for NAND ==
== Build for NAND ==
Line 275: Line 267:
| style="padding: 5px;"| Resistive touch
| style="padding: 5px;"| Resistive touch
| style="padding: 5px;"| VAR-DVK-MX6_V2,<br>VAR-STK-MX6_V2
| style="padding: 5px;"| VAR-DVK-MX6_V2,<br>VAR-STK-MX6_V2
|-
| style="padding: 5px;"| som-mx6qp-vsc
| style="padding: 5px;"| boot-som-mx6qp-vsc.img,<br>recovery-som-mx6qp-vsc.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (Quad Plus)
| style="padding: 5px;"| VAR-SOLOCustomBoard
| style="padding: 5px;"| Capacitive LVDS touch
| style="padding: 5px;"| N/A
|-
|-
| style="padding: 5px;"| som-mx6q-c
| style="padding: 5px;"| som-mx6q-c
Line 289: Line 288:
| style="padding: 5px;"| Resistive touch
| style="padding: 5px;"| Resistive touch
| style="padding: 5px;"| VAR-DVK-MX6_V2,<br>VAR-STK-MX6_V2
| style="padding: 5px;"| VAR-DVK-MX6_V2,<br>VAR-STK-MX6_V2
|-
| style="padding: 5px;"| som-mx6qp-vsc
| style="padding: 5px;"| boot-som-mx6qp-vsc.img,<br>recovery-som-mx6qp-vsc.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (Quad Plus)
| style="padding: 5px;"| VAR-SOLOCustomBoard
| style="padding: 5px;"| Capacitive LVDS touch
| style="padding: 5px;"| N/A
|-
|-
| style="padding: 5px;"| som-mx6q-vsc
| style="padding: 5px;"| som-mx6q-vsc
Line 343: Line 335:
= Boot options=
= Boot options=


Boot options of the Android:<br>
The Android boot options are:<br>
1. Directly from SD card<br>
1. Directly from an SD card<br>
2. U-Boot boots from NAND flash, and the rest of the Android images from on-SOM eMMC (when available)
2. U-Boot boots from NAND flash, and the rest of the Android images from the on-SOM eMMC (when available)


== Flash and boot Android from SD card ==
== Flash and boot Android from SD card ==
Line 357: Line 349:


=== Boot From SD card ===
=== Boot From SD card ===
After following the above steps for creating a bootable SD card:
{{#lst:Android_Recovery_SD_card|BOOT_FROM_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 or menu buttom (for VAR-SOLOCustomBoard), and power-on the kit.


== Flash and boot Android from eMMC ==
== Flash and boot Android from eMMC ==
Line 370: Line 358:
=== Preparing images ===
=== Preparing images ===


All Android built images but system.img are ready for flashing out of the default build.
All Android built images but system.img are ready for flashing out of the default build.<br>
system.img must be modified:
 
The default system.img {{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 | and vendor.img |}} format is suitable for flashing using fastboot, and must be modified for flashing using 'dd'.


$ cd out/target/product/var_mx6
$ simg2img system.img system_raw.img
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
<pre>
<pre>
$ cd out/target/product/var_mx6
$ simg2img vendor.img vendor_raw.img
$ simg2img system.img system_raw.img
$ mv system_raw.img system.img
</pre>
</pre>
 
|}}
<span style="color:red">Note: </span> Make sure you built Android for eMMC
{{Note| Make sure you built Android for eMMC}}


=== Flashing Android from Linux shell (when the primary installation android) ===
=== Flashing Android from Linux shell (when the primary installation android) ===
An example of flashing eMMC, can be found here : http://variwiki.com/index.php?title=VAR-SOM-MX6_Yocto_NAND_Recovery_V60plus <br>
An example of flashing eMMC, can be found {{Varlink|Android Recovery SD card|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6|here}}.


Follow the following steps instructions above:
Follow the following steps instructions above:
Line 391: Line 381:




Further follow the steps described in paragraph "'''Flashing Android with USB Fastboot'''"
Further, follow the steps described in paragraph "'''Flashing Android with USB Fastboot'''"


=== Flashing Android with USB Fastboot ===
=== Flashing Android with USB Fastboot ===
Line 404: Line 394:
#Connect a USB OTG cable from the target board OTG port to a your 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/space to stop the boot at U-Boot.
#Power up the board and hit return/space to stop the boot at U-Boot.
#type '''fastboot''' in the U-Boot command line.
#type '''fastboot usb0''' in the U-Boot command line.


'''On the Host PC:'''
'''On the Host PC:'''
<pre>$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6q-c.img
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-''SETUP_NAME''.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-''SETUP_NAME''.img
$ sudo `which fastboot` reboot
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
</pre>
$ sudo `which fastboot` flash vendor out/target/product/var_mx6/vendor.img
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.
|
$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-''SETUP_NAME''.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-''SETUP_NAME''.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
}}
$ sudo `which fastboot` reboot
Replace ''SETUP_NAME'' with the actual desired setup name accrding to the second table in the [[#Images_created_by_the_Android_build_for_Variscite_MX6_system|"images created" section]].


=== Android recovery mode ===
=== Android recovery mode ===
Line 429: Line 425:
'''Generate OTA packages'''
'''Generate OTA packages'''
For generating "OTA" packages, use the following commands:
For generating "OTA" packages, use the following commands:
<pre>
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ cd ~/var_m_711_100/m_711_100_build
$ cd {{#var:BUILD_FOLDER_ANDROID}}/device
# if Android for SD card
|
$ make -j4 BUILD_TARGET_DEVICE=sd otapackage 2>&1 | tee build1-1.log
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
# if Android for eMMC
|}}
$ make -j4 BUILD_TARGET_DEVICE=emmc otapackage 2>&1 | tee build1-1.log
 
</pre>
# if Android for SD card
$ make -j4 BUILD_TARGET_DEVICE=sd otapackage 2>&1 | tee build1-1.log
# if Android for eMMC
$ make -j4 BUILD_TARGET_DEVICE=emmc otapackage 2>&1 | tee build1-1.log


'''Install OTA package to device'''
'''Install OTA package to device'''
#Enter to Android Recovery mode
#Enter to Android Recovery mode
#Select menu item "apply update from ADB"
#Select menu item "apply update from ADB"
#To the host system, perform the following command: <pre>$ out/host/linux-x86/bin/adb sideload out/target/product/var_mx6/var_mx6-ota-<data>-<image-id>.zip</pre>
#To the host system, perform the following command:<pre>$ out/host/linux-x86/bin/adb sideload out/target/product/var_mx6/var_mx6-ota-<data>-<image-id>.zip</pre>
#reboot this device
#reboot this device
<span style="color:red">Note: </span>Real example name for OTA package: ''out/target/product/var_mx6/var_mx6-ota-20160331-som-mx6q-c.zip''
<span style="color:red">Note: </span>Real example name for OTA package: ''out/target/product/var_mx6/var_mx6-ota-20160331-som-mx6q-c.zip''
Line 448: Line 447:
== 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.
When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android.
 
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
<pre>
$ cd {{#var:BUILD_FOLDER_ANDROID}}
$ cd ~/var_m_711_100/m_711_100_build
$ source build/envsetup.sh
$ source build/envsetup.sh
$ lunch var_mx6-eng
$ lunch var_mx6-user
or
$ make bootimage
$ lunch var_mx6-userdebug
</pre>
|
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ source build/envsetup.sh
$ lunch var_mx6-eng
or
$ lunch var_mx6-user
}}
$ make bootimage


== Toolchain setup for manual build kernel and U-Boot ==
== Toolchain setup for manual build kernel and U-Boot ==
 
$ export ARCH=arm
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ export CROSS_COMPILE={{#var:BUILD_FOLDER_ANDROID}}/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-
|
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | N7.1.2_2.0.0 |
Setup the toolchain path to point to arm-linux-androideabi- tools in prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin
|
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>
$ export CROSS_COMPILE={{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-
$ export ARCH=arm
| }}
$ export CROSS_COMPILE=~/var_m_711_100/m_711_100_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-
||}}
</pre>


== Manual build Bootloader&nbsp; ==
== Manual build Bootloader&nbsp; ==


Change directory to U-Boot
Change directory to U-Boot
<pre>
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ cd ~/var_m_711_100/m_711_100_build/bootable/bootloader/uboot-imx
$ cd {{#var:BUILD_FOLDER_ANDROID}}/vendor/variscite/uboot-imx
</pre>
|
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/bootable/bootloader/uboot-imx
||}}
Execute following commands:
Execute following commands:
<pre>
<pre>
Line 486: Line 499:


== Manual build Android Linux Kernel and modules ==
== Manual build Android Linux Kernel and modules ==
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 |
$ cd {{#var:BUILD_FOLDER_ANDROID}}/vendor/variscite/kernel_imx
|
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/kernel_imx
||}}
$ make mrproper
$ make imx_v7_var_android_defconfig
$ make -j4
$ make -j4 uImage LOADADDR=0x10008000
This will generate the uImage (kernel image) in the kernel/arch/arm/boot folder


<pre>
{{#ifeq: {{#var:ANDROID_PARTITION_TYPE}} | image |
$ cd ~/var_m_711_100/m_711_100_build/kernel_imx
== Changing Partition structure of Android eMMC / SD card ==
$ make distclean
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ make imx_v7_var_android_defconfig
Open device/fsl/common/partition/device-partitions.bpt
$ make -j4 uImage LOADADDR=0x10008000
<br/>
$ make -j4 modules
Modify the partition size as you want, compile the image partition-table.img
</pre>
<br/>
This will generate the uImage (kernel image) in the kernel/arch/arm/boot folder
If you change partition order don't forget to change mount options in following files
<br/>
For eMMC :
device/variscite/var_mx6/fstab_emmc_dart-f2fs.freescale
device/variscite/var_mx6/fstab_emmc_dart.freescale
device/variscite/var_mx6/fstab_emmc-f2fs.freescale
device/variscite/var_mx6/fstab_emmc.freescale
For SD :
device/variscite/var_mx6/fstab_sd_dart-f2fs.freescale
device/variscite/var_mx6/fstab_sd_dart.freescale
device/variscite/var_mx6/fstab_sd-f2fs.freescale
device/variscite/var_mx6/fstab_sd.freescale
 
By default below partition scheme is used.
Number  Start (sector)    End (sector)  Size      Code  Name
    1            2048          67583  32.0 MiB    FFFF  boot
    2          67584          133119  32.0 MiB    8300  recovery
    3          133120        3278847  1.5 GiB    FFFF  system
    4        3278848        4327423  512.0 MiB  FFFF  cache
    5        4327424        4343807  8.0 MiB    FFFF  device
    6        4343808        4351999  4.0 MiB    FFFF  misc
    7        4352000        4356095  2.0 MiB    FFFF  datafooter
    8        4356096        4360191  2.0 MiB    FFFF  metadata
    9        4360192        4362239  1024.0 KiB  FFFF  presistdata
  10        4362240        14675967  4.9 GiB    FFFF  userdata
  11        14675968        14678015  1024.0 KiB  0700  fbmisc
||}}

Latest revision as of 23:29, 27 March 2022

VAR-SOM-MX6 - Android Nougat N7.1.1 Developer Guide

Introduction

This Wiki describes how to build and deploy Android Nougat on the VAR-SOM-MX6. It is based on NXP's IMX6_N7.1.1_1.0.0_ANDROID release

Overview

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

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 Plus
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 (VAR-EXT-CB402 camera board can be ordered separately)
PCIE +
SATA +


Hardware Requirements

  • You will need the Variscite VAR-SOM-MX6 based evaluation kit.
  • Debug UART cable - For serial Debugging
  • OTG Micro B to A - For adb and fastboot

Host (PC) setup requirements

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

We recommend to have Physical Build machine, but if you are running Linux in a virtual machine, please make sure you allocate at least 16GB of RAM and 32 GB swap to virtual machine.

Note: Do not use other Ubuntu or Debian releases, than the ones 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 android-tools-fsutils bc

If you are using Ubuntu 16.04 LTS latest repo tool requires Python 3.0

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get install python3.6
$ sudo apt-get install python-is-python2

If you are using Ubuntu 20.04 LTS requires below package

$ sudo apt-get install python-is-python2

Configure GIT account

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"

Install the OpenJDK

Android Nougat requires OpenJDK 8.

To install it:

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


If your Ubuntu version is missing the package (which shouldn't happen), add the PPA repository and run the previous commands again:

$ sudo add-apt-repository ppa:openjdk-r/ppa


Update the default Java version by running:

$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac



Note: The build process requires about 135GB of free space.

Obtain source code

Variscite's Linux kernel and U-Boot are available through Github.
Required patches for the Android file system are under: https://variscite-public.nyc3.cdn.digitaloceanspaces.com/VAR-SOM-MX6/Software/Android/Android_IMX6_N711_100/ in Variscite's FTP

Files:

  • android_N7.1.1_1.0.0_source.tar.gz - NXP's i.MX6 N7.1.1_1.0.0 original BSP patch files.


Get NXP's Android Release Package

$ mkdir ~/var_n_711_100
$ cd ~/var_n_711_100
$ curl -o ~/Downloads/android_N7.1.1_1.0.0_source.tar.gz https://variscite-public.nyc3.cdn.digitaloceanspaces.com/VAR-SOM-MX6/Software/Android/Android_IMX6_N711_100/android_N7.1.1_1.0.0_source.tar.gz
$ tar xvf ~/Downloads/android_N7.1.1_1.0.0_source.tar.gz

Download Google Android N7.1.1

$ mkdir -p ~/bin
$ curl -o ~/bin/repo http://commondatastorage.googleapis.com/git-repo-downloads/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ mkdir ~/var_n_711_100/n_711_100_build
$ cd  ~/var_n_711_100/n_711_100_build
$ repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r13
$ repo sync -j4

Clone Variscite's U-Boot and Linux kernel sources

$ mkdir -p ~/var_n_711_100/n_711_100_build/bootable/bootloader
$ cd ~/var_n_711_100/n_711_100_build/bootable/bootloader
$ git clone https://github.com/varigit/uboot-imx.git -b n7.1.1_1.0.0_ga_var01
$ cd ~/var_n_711_100/n_711_100_build
$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx -b n7.1.1_1.0.0-ga-var01

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

$ cd ~/var_n_711_100/n_711_100_build
$ source ../android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0/and_patch.sh
**** Invoke ". and_patch.sh" from your shell to add following functions to your environment:
****-- c_gotop:     Changes directory to the top of the tree 
****-- c_patch:     Recover working tree to base version and then applying FSL android patch

$ c_patch  ../android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0 imx_N7.1.1_1.0.0
If everything is OK, "c_patch" generates the following output to indicate the successful patch:
*************************************************************
Success: Now you can build android code for FSL i.MX platform
*************************************************************

Apply Variscite's i.MX6 platforms' patches

$ cd ~/var_n_711_100/n_711_100_build/device
$ git clone https://github.com/varigit/MX6x-android.git -b n7.1.1_1.0.0-ga-var01 variscite
$ variscite/scripts/install.sh

Build Android Images

Change to Android top level directory.

$ cd ~/var_n_711_100/n_711_100_build
$ source build/envsetup.sh
$ lunch var_mx6-eng
or
$ lunch var_mx6-user

Note: var_mx6-user creates a production version of Android. var_mx6-eng creates an engineering version of Android. Development mode enable and development tools are available on target.

$ export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH

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/recovery/root/fstab* out/target/product/var_mx6/root/fstab*

Build Android for SD card

$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log
  • Note: When running Android from an SD card, the eMMC will be detected and presented as an SD card storage.

Build Android for on-SOM eMMC

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

Special notes for DART-MX6: user builds for eMMC

Due to HW specific features, dm-verity feature has been disabled on user builds for eMMC on DART-MX6.

To enable this feature, follow next steps:

  • correctly set PRODUCT_SYSTEM_VERITY_PARTITION in device/variscite/imx6/var_mx6.mk
  • enable verify in device/variscite/var_mx6/fstab_emmc_dart.freescale

The comments in the files will suggest the detailed actions.

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
Setup Name
Images Names
SOM type
Carrier Board type
LCD Type
Evaluation Kit name
som-mx6qp-c boot-som-mx6qp-c.img,
recovery-som-mx6qp-c.img
VAR-SOM-MX6_V2 (Quad Plus) VAR-MX6CustomBoard Capacitive touch VAR-DVK-MX6_V2-PRO,
VAR-STK-MX6_V2
som-mx6qp-r boot-som-mx6qp-r.img,
recovery-som-mx6qp-r.img
VAR-SOM-MX6_V2 (Quad Plus) VAR-MX6CustomBoard Resistive touch VAR-DVK-MX6_V2,
VAR-STK-MX6_V2
som-mx6qp-vsc boot-som-mx6qp-vsc.img,
recovery-som-mx6qp-vsc.img
VAR-SOM-MX6_V2 (Quad Plus) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
som-mx6q-c 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
som-mx6q-r 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
som-mx6q-vsc boot-som-mx6q-vsc.img,
recovery-som-mx6q-vsc.img
VAR-SOM-MX6_V2 (Quad / Dual) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
som-mx6dl-c boot-som-mx6dl-c.img,
recovery-som-mx6dl-c.img
VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Capacitive touch N/A
som-mx6dl-r boot-som-mx6dl-r.img,
recovery-som-mx6dl-r.img
VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Resistive touch N/A
som-solo-vsc 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
som-solo-c boot-som-solo-c.img,
recovery-som-solo-c.img
VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Capacitive touch N/A
imx6q-var-dart boot-imx6q-var-dart.img,
recovery-imx6q-var-dart.img
DART-MX6 VAR-DT6CustomBoard Capacitive touch VAR-STK-DT6,
VAR-DVK-DT6

Boot options

The Android boot options are:
1. Directly from an SD card
2. U-Boot boots from NAND flash, and the rest of the Android images from the on-SOM eMMC (when available)

Flash and boot Android from SD card

Create a bootable SD card

Partition and format SD card, and copy all images

$ sudo ./var-mksdcard.sh -f SETUP_NAME /dev/sdX;sync
  • Replace SETUP_NAME with the actual desired setup name accrding to the second table in the "images created" section.
  • Replace /dev/sdX with your true device, You can identify it with dmesg.

Boot From SD card

  • Power-off the board.
  • Insert the SD card into the SD card slot of the carrier board (DVK)
  • Make sure the Boot Mode is set to SD card: see Setting the Boot Mode section
  • Power up the board - it will boot into Linux from the SD card


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.

The default system.img format is suitable for flashing using fastboot, and must be modified for flashing using 'dd'.

$ cd out/target/product/var_mx6
$ simg2img system.img system_raw.img


Make sure you built Android for eMMC

Flashing Android from Linux shell (when the primary installation android)

An example of flashing eMMC, can be found here.

Follow the following steps instructions above:

1. Preparing a rescue SD card;

2. Flash from command line (use the install_android.sh script)


Further, follow the steps described in paragraph "Flashing Android with USB Fastboot"

Flashing Android with USB Fastboot

Install tools on host

$ sudo apt-get install android-tools-adb android-tools-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 usb0 in the U-Boot command line.

On the Host PC:

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

Replace SETUP_NAME with the actual desired setup name accrding to the second table in the "images created" section.

Android recovery mode

Enter board in Android Recovery mode

Turn on the device by holding down the "back" button must be held until the end of the boot and logged in "Android Recovery" mode.

Control menu in Android Recovery Mode

  1. To switch between menu items, use a short press of any button (except RESET) or a short touch touchscreen;
  2. To select an item, use long press any button (except RESET) or long touch the touchscreen;

Update Android firmware

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

$ cd ~/var_n_711_100/n_711_100_build
# if Android for SD card
$ make -j4 BUILD_TARGET_DEVICE=sd otapackage 2>&1 | tee build1-1.log
# if Android for eMMC
$ make -j4 BUILD_TARGET_DEVICE=emmc otapackage 2>&1 | tee build1-1.log

Install OTA package to device

  1. Enter to Android Recovery mode
  2. Select menu item "apply update from ADB"
  3. To the host system, perform the following command:
    $ out/host/linux-x86/bin/adb sideload out/target/product/var_mx6/var_mx6-ota-<data>-<image-id>.zip
  4. reboot this device

Note: Real example name for OTA package: out/target/product/var_mx6/var_mx6-ota-20160331-som-mx6q-c.zip

Manual operations

Build boot.img

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

$ cd ~/var_n_711_100/n_711_100_build 
$ source build/envsetup.sh
$ lunch var_mx6-eng
or
$ lunch var_mx6-user
$ make bootimage

Toolchain setup for manual build kernel and U-Boot

$ export ARCH=arm
Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
$ export CROSS_COMPILE=~/var_n_711_100/n_711_100_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-

Manual build Bootloader 

Change directory to U-Boot

$ cd ~/var_n_711_100/n_711_100_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_n_711_100/n_711_100_build/kernel_imx
$ make mrproper
$ make imx_v7_var_android_defconfig
$ make -j4
$ make -j4 uImage LOADADDR=0x10008000

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