VAR-SOM-MX6p Android M6.0.1 2.1.0: Difference between revisions

From Variscite Wiki
m (Text replacement - "http://variwiki" to "https://variwiki")
 
(11 intermediate revisions by one other user not shown)
Line 191: Line 191:
var_mx6-eng creates an engineering version of the Android Marshmallow. Development mode enable and development tools are available on target.
var_mx6-eng creates an engineering version of the Android Marshmallow. Development mode enable and development tools are available on target.


== Switching from eMMC build to SD card build and vice versa ==
== Build Android for on-SOM eMMC ==
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>
<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>
**The files may not exist**


== Build Android for on-SOM eMMC ==
<pre>
$ rm out/target/product/var_mx6/recovery/root/fstab* out/target/product/var_mx6/root/fstab*
$ 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>
</pre>
== Build for NAND ==
<span style="color:red">Note: </span> Due to android file system size, Android should use SD card or eMMC only


== Images created by the Android build for Variscite MX6 system ==
== Images created by the Android build for Variscite MX6 system ==
Line 214: Line 207:
|-
|-
| system.img
| system.img
| Android system image file.<br/>SOM agnostics.
| Android system image file for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
|-
| u-boot-var-imx6-nand.img
| U-Boot for nand used in eMMC boot.<br/>SOM agnostics.
|-
| u-boot-var-imx6-sd.img
| U-Boot for SD card boot.<br/>SOM agnostics.
|-
|-
| boot-<name>-<touch>.img<br>recovery-<name>-<touch>.img
| u-boot-var-imx6p-nand.imx
|
| U-Boot for nand used in eMMC boot for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
|-
|-
| <name> is one of:
| boot-som-mx6qp-c.img
| som-mx6q - Supports VAR-SOM-MX6Q and VAR-SOM-MX6D<br>som-mx6dl - Supports VAR-SOM-MX6DL and VAR-SOM-MX6S<br>som-solo - Supports VAR-SOM-SOLO and VAR-SOM-DUAL
| Boot image for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
|-
|-
| <touch> - is "r" or "c"
| recovery-som-mx6qp-c.img
| r = resistive touch display<br>c = capacitive touch dispaly
| Recovery image for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
|-
|-
|}
|}


{| class="wikitable"
= Flashing Android from Linux shell (when the primary installation android) =
|-
An example of flashing eMMC, can be found here : https://variwiki.com/index.php?title=VAR-SOM-MX6_Yocto_NAND_Recovery_V60plus <br>
! scope="col" | Setup Name<br/>
! scope="col" | Images Names<br/>
! scope="col" | SOM type<br/>
! scope="col" | Carrier Board type<br/>
! scope="col" | LCD Type<br/>
! scope="col" | Evaluation Kit name<br/>
|-
| style="padding: 5px;"| som-mx6q-c
| style="padding: 5px;"| boot-som-mx6q-c.img,<br>recovery-som-mx6q-c.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (Quad / Dual)
| style="padding: 5px;"| VAR-MX6CustomBoard
| style="padding: 5px;"| Capacitive touch
| style="padding: 5px;"| VAR-DVK-MX6_V2-PRO,<br>VAR-STK-MX6_V2
|-
| style="padding: 5px;"| som-mx6q-r
| style="padding: 5px;"| boot-som-mx6q-r.img,<br>recovery-som-mx6q-r.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (Quad / Dual)
| style="padding: 5px;"| VAR-MX6CustomBoard
| style="padding: 5px;"| Resistive touch
| style="padding: 5px;"| VAR-DVK-MX6_V2,<br>VAR-STK-MX6_V2
|-
| style="padding: 5px;"| som-mx6q-vsc
| style="padding: 5px;"| boot-som-mx6q-vsc.img,<br>recovery-som-mx6q-vsc.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (Quad / Dual)
| style="padding: 5px;"| VAR-SOLOCustomBoard
| style="padding: 5px;"| Capacitive LVDS touch
| style="padding: 5px;"| N/A
|-
| style="padding: 5px;"| som-mx6dl-c
| style="padding: 5px;"| boot-som-mx6dl-c.img,<br>recovery-som-mx6dl-c.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (DualLite/ Solo)
| style="padding: 5px;"| VAR-MX6CustomBoard
| style="padding: 5px;"| Capacitive touch
| style="padding: 5px;"| N/A
|-
| style="padding: 5px;"| som-mx6dl-r
| style="padding: 5px;"| boot-som-mx6dl-r.img,<br>recovery-som-mx6dl-r.img
| style="padding: 5px;"| VAR-SOM-MX6_V2 (DualLite/ Solo)
| style="padding: 5px;"| VAR-MX6CustomBoard
| style="padding: 5px;"| Resistive touch
| style="padding: 5px;"| N/A
|-
| style="padding: 5px;"| som-solo-vsc
| style="padding: 5px;"| boot-som-solo-vsc.img,<br>recovery-som-solo-vsc.img
| style="padding: 5px;"| VAR-SOM-SOLO / VAR-SOM-DUAL
| style="padding: 5px;"| VAR-SOLOCustomBoard
| style="padding: 5px;"| Capacitive LVDS touch
| style="padding: 5px;"| VAR-DVK-SOLO/DUAL,<br>VAR-STK-SOLO/DUAL
|-
| style="padding: 5px;"| som-solo-c
| style="padding: 5px;"| boot-som-solo-c.img,<br>recovery-som-solo-c.img
| style="padding: 5px;"| VAR-SOM-SOLO / VAR-SOM-DUAL
| style="padding: 5px;"| VAR-MX6CustomBoard
| style="padding: 5px;"| Capacitive touch
| style="padding: 5px;"| N/A
|-
| style="padding: 5px;"| imx6q-var-dart
| style="padding: 5px;"| boot-imx6q-var-dart.img,<br>recovery-imx6q-var-dart.img
| style="padding: 5px;"| DART-MX6
| style="padding: 5px;"| VAR-DT6CustomBoard
| style="padding: 5px;"| Capacitive touch
| style="padding: 5px;"| VAR-STK-DT6,<br>VAR-DVK-DT6
|-
|}
 
= Boot options=
 
Boot options of the Android:<br>
1. Directly from SD card<br>
2. U-Boot boots from NAND flash, and the rest of the Android images from on-SOM eMMC (when available)
 
== Flash and boot Android from SD card ==
=== Create a bootable SD card ===
Partition and format SD card, and copy all images
<pre>
$ sudo ./var-mksdcard.sh -f SETUP_NAME /dev/sdX;sync
</pre>
* 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]].
* Replace /dev/sdX with your true device, You can identify it with dmesg.
 
=== Boot From SD card ===
After following the above steps for creating a bootable SD card:
 
* Power-off board
* Insert the newly created SD card into the SD card socket of the evaluation kit.
* Press and hold the boot-select button or menu buttom (for VAR-SOLOCustomBoard), and power-on the kit.
 
== Flash and boot Android from eMMC ==
eMMC based system consist of:<br>
#SPL and U-Boot on NAND flash<br>
#Rest of Android images in eMMC<br>
 
=== Preparing images ===
 
All Android built images but system.img are ready for flashing out of the default build.
system.img must be modified:
 
<pre>
$ cd out/target/product/var_mx6
$ simg2img system.img system_raw.img
$ mv system_raw.img system.img
</pre>
 
<span style="color:red">Note: </span> 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 : http://variwiki.com/index.php?title=VAR-SOM-MX6_Yocto_NAND_Recovery_V60plus <br>


Follow the following steps instructions above:
Follow the following steps instructions above:
Line 352: Line 232:
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 =
==== Install tools on host ====
== Install tools on host ==
<pre>
<pre>
$ sudo apt-get install android-tools-adb android-tools-fastboot
$ sudo apt-get install android-tools-adb android-tools-fastboot
</pre>
</pre>


<span style="color:red">Note: </span> Make sure you built Android for eMMC
<br>
<br>
'''Connect the target with host PC at fastboot mode:'''
'''Connect the target with host PC at fastboot mode:'''
Line 366: Line 245:


'''On the Host PC:'''
'''On the Host PC:'''
<pre>$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6q-c.img
<pre>$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6qp-c.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6qp-c.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.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 are for VAR-SOM-MX6 with a capacitive display. You should pick and choose the right file for you see the table above.


=== Android recovery mode ===
= Android recovery mode =


==== Enter board in 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.
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 ====
== Control menu in Android Recovery Mode ==


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


==== Update Android firmware ====
== Update Android firmware ==


'''Generate OTA packages'''
'''Generate OTA packages'''
Line 399: Line 277:
#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-<date>-<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 431: Line 309:
Execute following commands:
Execute following commands:
<pre>
<pre>
clean tree:
Clean tree:
$ make mrproper
$ make mrproper


Choose build for SD card or NAND flash:
Select configuration
$ make mx6var_som_sd_android_defconfig
$ make mx6p_var_som_android_nand_defconfig
or
$ make mx6var_som_nand_android_defconfig


Build U-Boot:
Build U-Boot:
$ make -j4
$ make -j4
</pre>
</pre>
<br/>This command will generate the U-Boot images 'SPL' and 'u-boot.img'.
<br/>This command will generate the U-Boot image 'u-boot.imx'.


== Manual build Android Linux Kernel and modules ==
== Manual build Android Linux Kernel and modules ==

Latest revision as of 11:56, 10 June 2020

VAR-SOM-MX6 Android M6.0.1_2.1.0 developer guide

Introduction

This Wiki describes how to build and deploy Android Marshmallow on the VAR-SOM-MX6. It is based on NXP's IMX6_M6.0.1_2.1.0_ANDROID release

Overview

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

Supported hardware and features

Feature
Description
SOM support
VAR-SOM-MX6 V2
Carrier Board support
VAR-MX6CustomBoard]
CPU

i.MX6 Quad

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

Hardware Requirements

VAR-SOM-MX6 evaluation kit.

Host (PC) setup requirements

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

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

Install required packages on host PC

$ sudo apt-get -y install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib 
$ sudo apt-get -y install libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils 
$ 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

Install the OpenJDK

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

Update the default Java version by running:

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

Note: The build machine should have at least 50GB of free space to complete the build process.

Obtain source code

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

Files:

  • android_M6.0.1_2.1.0_source.tar.gz - NXP's i.MX6 M6.0.1_2.1.0 original BSP patch files.


Get NXP's Android Release Package

$ mkdir ~/var_m_601_210
$ cd ~/var_m_601_210
$ tar xvf ~/Downloads/android_M6.0.1_2.1.0_source.tar.gz

Download Google Android M6.0.1

$ mkdir ~/var_m_601_210/m_601_210_build
$ cd  ~/var_m_601_210/m_601_210_build
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r22
$ repo sync -j4

Clone Variscite's U-Boot and Linux kernel sources

$ mkdir -p ~/var_m_601_210/m_601_210_build/bootable/bootloader
$ cd ~/var_m_601_210/m_601_210_build/bootable/bootloader
$ git clone https://github.com/varigit/uboot-imx.git -b imx6p_v2015.04_4.1.15_1.1.0_ga_var02
$ cd ~/var_m_601_210/m_601_210_build
$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx -b imx6p_m6.0.1_2.1.0-ga-var01

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

$ cd ~/var_m_601_210/m_601_210_build
$ source ../android_M6.0.1_2.1.0_source/code/M6.0.1_2.1.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_M6.0.1_2.1.0_source/code/M6.0.1_2.1.0 imx_M6.0.1_2.1.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_m_601_210
$ git clone https://github.com/varigit/MX6x-android.git -b imx6p_m6.0.1_2.1.0-ga-var01 variscite
$ variscite/install

Build Android Images

Change to Android top level directory.

$ cd ~/var_m_601_210/m_601_210_build
$ source build/envsetup.sh
$ lunch var_mx6-eng
or
$ lunch var_mx6-user

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

Build Android for on-SOM eMMC

$ rm out/target/product/var_mx6/recovery/root/fstab* out/target/product/var_mx6/root/fstab*
**The files may not exist**

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

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 for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
u-boot-var-imx6p-nand.imx U-Boot for nand used in eMMC boot for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
boot-som-mx6qp-c.img Boot image for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard
recovery-som-mx6qp-c.img Recovery image for VAR-SOM-MX6QP with Capacitive touch on MX6CustomBoard

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

An example of flashing eMMC, can be found here : https://variwiki.com/index.php?title=VAR-SOM-MX6_Yocto_NAND_Recovery_V60plus

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


Connect the target with host PC at fastboot mode:

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

On the Host PC:

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

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_m_601_210/m_601_210_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-<date>-<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_m_601_210/m_601_210_build
$ source build/envsetup.sh
$ lunch var_mx6-user
$ make bootimage

Toolchain setup for manual build kernel and U-Boot

Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin

$ export ARCH=arm
$ export CROSS_COMPILE=~/var_m_601_210/m_601_210_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-

Manual build Bootloader 

Change directory to U-Boot

$ cd ~/var_m_601_210/m_601_210_build/bootable/bootloader/uboot-imx

Execute following commands:

Clean tree:
$ make mrproper

Select configuration
$ make mx6p_var_som_android_nand_defconfig

Build U-Boot:
$ make -j4


This command will generate the U-Boot image 'u-boot.imx'.

Manual build Android Linux Kernel and modules

$ cd ~/var_m_601_210/m_601_210_build/kernel_imx 
$ make distclean
$ make imx_v7_var_android_defconfig
$ make -j4 uImage LOADADDR=0x10008000
$ make -j4 modules

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