DART-SD410 Android LL 1 1: Difference between revisions

From Variscite Wiki
Line 164: Line 164:
Contact [mailto:support@variscite.com Variscite support] for FTP credentials.
Contact [mailto:support@variscite.com Variscite support] for FTP credentials.


== <span style="line-height: 1.5em;"><span style="line-height: 1.5em;">Unpack Freescale's Android Release Package</span></span> ==
== <span style="line-height: 1.5em;"><span style="line-height: 1.5em;">Unpack Variscite's Android Release Package</span></span> ==
<pre><span style="line-height: 1.5em;">$ mkdir ~/var_ll_500_100
<pre><span style="line-height: 1.5em;">
$ cd ~/var_ll_500_100
$ mkdir ~/dart-sd410
$ tar xvf ~/Downloads/android_L5.0.0_1.0.0-ga_core_source.gz
$ cd ~/dart-sd410
$ cd android_L5.0.0_1.0.0-ga_core_source/code/
$ unzip ~/Downloads/variscite_bsp_vla.br_.1.2.4-01810-8x16.0-3.zip
$ tar xvf l5.0.0_1.0.0-ga.tar.gz</span></pre>
$ cd source/
 
== <span style="line-height: 1.5em;">Download Google Android LL5.0.0</span> ==
== <span style="line-height: 1.5em;">Download Google Android LL5.0.0</span> ==



Revision as of 13:08, 17 January 2016

DART-SD410 Android-LL-5.1.1 Developers Guide

Introduction

This WIKI describes how to build and deploy Android Lollipop Lollipop-5-1-1 on the DART-SD410. It is based on Qualcomm Android-LL-5.1.1.

Overview

The objective of this document is to guide DART-SD410 Android developers to obtain Android Lollipop sources, setting up host environment, compilation and deployment.

This document contains instructions for:

  • Hardware and software requirements.
  • Setup the hardware.
  • Setup the toolchain.
  • Download & build the sources.
  • Install the binaries on the DART-SD410 SOM.

Document Reference

This release is based on Qualcomm APQ8016_410C_LA.BR.1.2.4-01810-8x16.0_5.1.1_Lollipop_P2 release. Please refer to Qualcomm Developer Network before you start building.

Supported hardware and features

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

i.MX6 Dual

Software platform

Freescale Android-LL-5.0.0 100

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

Hardware Requirements

DART-SD410 evaluation kit.

Host (PC) setup requirements

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

At least 60GByte free space.


IMPORTANT

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

For 64-bit Ubuntu 14.04

The complete Android host requirments:  source.android.com/source/initializing.html Also you can refer to Software Build and Installation Guide, Linux Android.

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

First:
$ 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 OpenJDK

The master branch of Android in the Android Open Source Project (AOSP) requires Java 7. On Ubuntu, use OpenJDK. Be aware that you must use OpenJDK opposed to previous versions that used SUN Java.

Java 7: For the latest version of Android

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

Optionally, update the default Java version by running:

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

Additional packages

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

$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo apt-get install lzop
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools
$ sudo apt-get install mtd-utils
NOTE:
The build machine should have at least 60GB 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

Please download Androi Board Support Package file from Variscite's FTP site.
Contact Variscite support for FTP credentials.

Unpack Variscite's Android Release Package

<span style="line-height: 1.5em;">
$ mkdir ~/dart-sd410
$ cd ~/dart-sd410
$ unzip ~/Downloads/variscite_bsp_vla.br_.1.2.4-01810-8x16.0-3.zip
$ cd source/

== <span style="line-height: 1.5em;">Download Google Android LL5.0.0</span> ==

<span style="line-height: 1.5em;">The Android source code is maintained in more than 100 different gits in the Android repository (android.googlesource.com). </span> <span style="line-height: 1.5em;">To get the Android source code from Google repo, follow the steps below:</span>
<pre><span style="line-height: 1.5em;">$ cd ~/var_ll_500_100
$ mkdir ll_500_100_build
$ cd ll_500_100_build
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.2_r1 
$ repo sync
$ cd ~/var_ll_500_100/ll_500_100_build/prebuilts/gcc/linux-x86/arm
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
$ cd arm-eabi-4.6
$ git checkout -b android-4.4.3_r1 android-4.4.3_r1
</span>

NOTE:
The above "$ repo sync" command loads most needed repos. Therefore, it can take several hours to load.

Download Variscite's u-boot and Linux kernel

$ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx $ cd kernel_imx $ git checkout -b l5.0.0_1.0.0-ga-var01 remotes/origin/l5.0.0_1.0.0-ga-var01 

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

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build/bootable/bootloader
$ git clone https://github.com/varigit/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout -b l5.0.0_1.0.0-ga-var01 remotes/origin/l5.0.0_1.0.0-ga-var01
</span>

Apply all the i.MX Android patches 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:

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build
$ source ../android_L5.0.0_1.0.0-ga_core_source/code/l5.0.0_1.0.0-ga/and_patch.sh
$ help
You should see that the "c_patch" function is available.
$  c_patch  ../android_L5.0.0_1.0.0-ga_core_source/code/l5.0.0_1.0.0-ga imx_l5.0.0_1.0.0-ga
If everything is OK, "c_patch" generates the following output to indicate the successful patch:
**************************************************************
Success: Now you can build the Android code for FSL i.MX platform
**************************************************************
</span>

NOTE: The patch script (and_patch.sh) requires some basic utilities like awk/sed. If they are not available on the computer running Linux OS, install them first.

Install Freescale i.MX6 omxplayer support

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

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build
$ cp ~/Downloads/android_L5.0.0_1.0.0-ga_omxplayer_source.tar.gz ./
$ tar xzvf android_L5.0.0_1.0.0-ga_omxplayer_source.tar.gz
$ rm android_L5.0.0_1.0.0-ga_omxplayer_source.tar.gz
</span>

Apply VAR-SOM-MX6 patches

    After you setup your build machine,unpack Variscite's release Package:    
<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100
$ tar xvf ~/Downloads/var_L5.0.0_1.0.0_r3.tar.bz2
$ variscite/install
</span>

Install Freescale i.MX6 additional codecs support

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build
$ tar xvf ~/Downloads/fsl_aacp_dec_L5.0.0_1.0.0-ga.tar.gz
$ cp -r fsl_aacp_dec/ external
$ rm -rf fsl_aacp_dec/
</span>

Build Android Images

Change to Android top level directory.

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build
$ source build/envsetup.sh
$ lunch var_mx6-user
or
$ lunch var_mx6-eng
</span>

NOTE:
var_mx6-user creates a production version of the Android Lollipop.

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

Switch 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.

<span style="line-height: 1.5em;">$ rm out/target/product/var_mx6/root/fstab.freescale
</span>

Build Android for SD card

<span style="line-height: 1.5em;">$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log</span>

Build Android for eMMC

<span style="line-height: 1.5em;">$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log</span>

NOTE: Set -j4 to a suitable number. A good practice is to set it to number of threads of you build machine minus 1.

Flash Android SD card

NOTE: A newer version of var-mksdcard.sh is available on the FTP site.

Format only SD card:

<span style="line-height: 1.5em;">$ sudo ./var-mksdcard.sh /dev/sdX;sync</span>

Flash only Android onto SD card:

<span style="line-height: 1.5em;">$ sudo ./var-mksdcard.sh -np -nf -f som-mx6q-c /dev/sdX;sync</span>

Format and flash Android onto SD card (SD card was formated before):

<span style="line-height: 1.5em;">$ sudo ./var-mksdcard.sh -f som-mx6q-c /dev/sdX;sync</span>

Flash Android onto eMMC

Flashing Android is a complex task that require multiple commands. Variscite provides nand-recovery SDCARD that does that. It format the eMMC flash the boot device and flash Android. Please use the nand-recovery SDCARD copy your Android product into /media/rootfs/opt/images/Android/Emmc. Boot from SDCARD and use the GUI to flash Android or type android-emmc.sh on the command line.

Build for NAND

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

Images created by the Android build for Variscite MX6 system

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


Image

Description



system.img Android system image file.


SOM agnostics.


u-boot-var-imx6-nand.img u-boot for nand used in eMMC boot.



SOM agnostics.



u-boot-var-imx6-sd.img u-boot for SD card boot.




SOM agnostics.




boot-<name>-<touch>.img
recovery-<name>-<touch>.img
<name> is one of: som-mx6q - Support VAR-SOM-MX6Q and VAR-SOM-MX6D
som-mx6dl - Support VAR-SOM-MX6DL and VAR-SOM-SOLO
som-solo - Support SOM-SOLO and SOM-DUAL
<touch> - is "r" or "c" r = resistive touch display
c = capacitive touch dispaly
Image Name











SOM type













Carrier Board type















LCD Type

















Evaluation Kit name



















boot-som-mx6q-c.img, recovery-som-mx6q-c.img VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Capacitive touch VAR-DVK-MX6_V2-PRO










VAR-STK-MX6_V2










boot-som-mx6q-r.img, recovery-som-mx6q-r.img VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Resistive touch VAR-DVK-MX6_V2











VAR-STK-MX6_V2











boot-som-mx6q-vsc.img, recovery-som-mx6q-vsc.img VAR-SOM-MX6_V2 (Quad / Dual) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
boot-som-mx6dl-c.img, recovery-som-mx6dl-c.img VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Capacitive touch N/A
boot-som-mx6dl-r.img, recovery-som-mx6dl-r.img VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Resistive touch N/A
boot-som-solo-vsc.img, recovery-som-solo-vsc.img VAR-SOM-SOLO / VAR-SOM-DUAL VAR-SOLOCustomBoard Capacitive LVDS touch VAR-DVK-SOLO/DUAL












VAR-STK-SOLO/DUAL












boot-som-solo-c.img, recovery-som-solo-c.img VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Capacitive touch N/A
boot-imx6q-var-dart.img DART-MX6 VAR-DT6CustomBoard Capacitive touch VAR-STK-DT6













VAR-DVK-DT6



























Boot

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

Boot From MMC/SD Card


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

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

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

Use the created SD card and:

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

Boot From eMMC

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

<span style="line-height: 1.5em;">$ android_emmc.sh
</span>

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:


<span style="line-height: 1.5em;">$  cd ~/var_ll_500_100/ll_500_100_build
$ source build/envsetup.sh
$ lunch var_mx6-user
$ make bootimage
</span>

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

<span style="line-height: 1.5em;">$ export ARCH=arm
$ export PATH=export PATH=~/var_ll_500_100/ll_500_100_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
$ export CROSS_COMPILE=arm-eabi-
</span>

Manual build Bootloader 

Change directory to u-boot

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build/bootable/bootloader/uboot-imx </span>

Execute following commands:

<span style="line-height: 1.5em;">$ make ARCH=arm distclean
$ make mx6_var_som_sd_android_config     # VAR-SOM-MXQ/D/DL/S, boot from MMC
$ make mx6_var_som_nand_android_config   # VAR-SOM-MXQ/D/DL/S, boot from NAND
$ make -j4 </span>


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

Manual build Android Linux Kernel and modules

Change directory to kernel

<span style="line-height: 1.5em;">$ cd ~/var_ll_500_100/ll_500_100_build/kernel_imx </span>

Execute following commands

<span style="line-height: 1.5em;">$ make distclean
$ make imx_v7_var_android_defconfig
$ make -j4 uImage
$ make -j4 modules
</span>

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

Flashing Android with Fastboot

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

On the target:

<span style="line-height: 1.5em;">$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-som-mx6q-c.img
$ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-som-mx6q-c.img
$ sudo `which fastboot` flash system out/target/product/var_mx6/system.img
$ sudo `which fastboot` reboot
</span>

boot-som-mx6q-c.img and recovery-som-mx6q-c.img is for VAR-SOM-MX6 with capacitive display. You should pick and choose the right file for you see the table above. The emmc-recovery utility select the right combination automatically by scanning the system it is running on. Detail information Fastboot

Display Options

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

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

  • HDMI
<span style="line-height: 1.5em;">BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=400M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M androidboot.selinux=disabled androidboot.dm_verity=disabled
</span>