Difference between revisions of "DART Android RN"

From Variscite Wiki
Line 187: Line 187:
'''Create img files:'''
'''Create img files:'''
<pre>$&nbsp;cd ${MYDROID}
$&nbsp;find out/target/product/${BOARD_TYPE} -name *.img -exec rm -f {} \; 
$ cd ${YOUR_PATH}/omap4_emmc_files_omap4dart
$ cd ${YOUR_PATH}/omap4_emmc_files_omap4dart
$&nbsp;cp -f ${MYDROID}/out/target/product/${BOARD_TYPE}/*.img .
$&nbsp;cp -f ${MYDROID}/out/target/product/${BOARD_TYPE}/*.img .
Line 207: Line 205:
$&nbsp;mkfs.ext4 -F cache.img -L cache
$&nbsp;mkfs.ext4 -F cache.img -L cache
= Flashing the Android binaries on eMMC =
= Flashing the Android binaries on eMMC =

Latest revision as of 15:57, 29 September 2015

AJ.2.2.VAR.DART.R9 Release Notes

1 Introduction

This software release has been developed and verified in the following software and hardware environment.

OS Kernel: Linux® 3.0
Android: Android JellyBean 4.1.2
Kernel: 3.0.31
Toolchain: Andriod linux-x86 toolchain arm-eabi-4.4.3
Reference hardware platforms: Variscite OMAP4 DART board
Build Host OS: Ubuntu 10.04 64-bit
Daily Build Blaze_Tablet Version: JB DEV Daily Build 96

2 Tools & Dependency packages

Pre-requisite packages for building the Android Filesystem (Note: This is with reference to Ubuntu 10.04 64-bit). Ubuntu 64-bit is required for the cross-compilation of Android Jelly Bean Filesystem.

If you are behind a firewall, you will have to set-up firewall using the instructions.
The following commands will install the correct packages to your server:

$ sudo apt-get install git-core flex bison gperf libesd0-dev zip gawk ant libwxgtk2.6-dev zlib1g-dev build-essential tofrodos uboot-mkimage libxml2-utils
$ sudo apt-get install lib32readline5-dev libstdc++6 lib32z1 lib32z1-dev ia32-libs g++-multilib libx11-dev libncurses5-dev uboot-mkimage

Install Oracle JDK 6

  1. Download the latest JDK 6 installer from Oracle http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html
  2. Accept the license agreement and click on the Linux x64 bin installer. The downloaded file will be named jdk-6uXX-linux-x64.bin where XX is the JDK 6 update version.
  3. Follow the following steps to install JDK 6
$ chmod a+x jdk-6uXX-linux-x64.bin
$ ./jdk-6uXX-linux-x64.bin
$ sudo mkdir -p /usr/lib/jvm
$ sudo mv jdk1.6.0_XX /usr/lib/jvm/
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_XX/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_XX/bin/javac" 1
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
Android Jelly Bean (4.1.2) needs Oracle JDK 6.
The Hard Disk should have at least 30 GigaBytes of free space to complete the building of sources.
Please refer to the AOSP documentation for latest information and instructions for setting up other Ubuntu versions http://source.android.com/source/initializing.html

Install repo tool:

$ mkdir ~/bin -p
$ sudo apt-get install curl
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH

If you do not have sudo rights to your machine, contact your System Administrator for assistance. Tool Chain for building Kernel and Drivers

The Kernel and Driver sources are built using the Android linux-x86 toolchain for ARM GNU/Linux version.

This tool chain can be obtained when you pull the Android code based on the released manifest that will be given.

3 Downloading Release Software

To obtain Android Filesystem Sources follow:

$ cd <your work directory>
$ mkdir -p 4AJ.2.2; cd 4AJ.2.2
$ export YOUR_PATH=`pwd`
$ mkdir -p mydroid; cd mydroid
$ export MYDROID=`pwd`
$ repo init -u git://git.omapzoom.org/platform/omapmanifest.git -b 27.x -m RLS4AJ.2.2_JellyBean.xml
$ repo sync

Download AFS patch from Variscite's FTP (/Software/Android/4AJ.2.2.VAR.DART.R9/4AJ.2.2.VAR.DART.R9.AFS.patch) and apply it:

$ cat 4AJ.2.2.VAR.DART.R9.AFS.patch | patch -p1 -d device/ti/blaze/
$ cat DART_Amic_Route.patch | patch -p1 -d device/ti/common-open/

Download Ducati binaries package from Variscite's FTP (/Software/Android/4AJ.2.2.VAR.DART.R9/ducati_full_blaze.tgz) and integrate it:

$ cp ducati_full_blaze.tgz device/ti/proprietary-open/omap4/ducati_full_blaze.tgz

Download WiLink6 binaries package from Variscite's FTP (/Software/Android/4AJ.2.2.VAR.DART.R9/wlan.tgz) and integrate it:

$ cp wlan.tgz device/ti/proprietary-open/wl12xx/wlan/wlan.tgz

To obtain Kernel & Driver Sourcesfollow:

To clone kernel source from scratch do:

$ cd ${YOUR_PATH}
$ git clone git://git.omapzoom.org/kernel/omap.git kernel/android-3.0
$ cd kernel/android-3.0
$ git checkout 1f21f8ed30c1d6abd029b67d17106042930a93d2

Download kernel patch from Variscite's FTP (/Software/Android/4AJ.2.2.VAR.DART.R9/4AJ.2.2.VAR.DART.R9.kernel.patch) and apply it:

$ cat 4AJ.2.2.VAR.DART.R9.kernel.patch | patch -p1

To obtain U-Boot Sourcesfollow:

$ cd ${YOUR_PATH}
$ git clone git://git.omapzoom.org/repo/u-boot.git u-boot
$ cd u-boot
$ git checkout 622fcfe5ae67e10598bdba8173c68717809518fc

Download U-Boot patch from Variscite's FTP (/Software/Android/4AJ.2.2.VAR.DART.R9/4AJ.2.2.VAR.DART.R9.uboot.patch) and apply it:

$ cat 4AJ.2.2.VAR.DART.R9.uboot.patch | patch -p1 

To obtain X-loader Sourcesfollow:

$ cd ${YOUR_PATH}
$ git clone git://git.omapzoom.org/repo/x-loader.git x-loader
$ cd x-loader
$ git checkout dd88047040dce4a926a6ab80e207bc757f44d648

Download X-loader patch from Variscite's FTP (/Software/Android/4AJ.2.2.VAR.DART.R9/4AJ.2.2.VAR.DART.R9.xloader.patch) and apply it:

$ cat 4AJ.2.2.VAR.DART.R9.xloader.patch | patch -p1 

4 Release Content

This release has the below content - Kernel and Drivers tested with VAR-SOM-OM44 and verified with Jelly Bean UI - A9 source code for accelerating Video

5 Build Instructions

5.1 Setting up build environment

From your work directory (where your 4AJ.2.2 directory resides):

$ export YOUR_PATH=`pwd`
$ export MYDROID=${YOUR_PATH}/mydroid
$ export PATH=$PATH:${MYDROID}/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/
$ mkdir ${MYDROID}/logs
$ export CROSS_COMPILE=arm-eabi-
$ export PATH=${YOUR_PATH}/u-boot/tools:$PATH

5.2 Building U-BOOT

$ cd ${YOUR_PATH}/u-boot
$ make ARCH=arm distclean
$ make ARCH=arm omap4460dart_evm_config      # To build u-boot for DART EVM
$ make ARCH=arm omap4460dart_board_config    # To build u-boot for DART Board
$ make ARCH=arm 2>&1 |tee ${MYDROID}/logs/u-boot_make.out

5.3 Building X-LOADER

$ cd ${YOUR_PATH}/x-loader
$ make distclean	
$ make ARCH=arm omap4460dart_config
$ make ARCH=arm ift 2>&1 |tee ${MYDROID}/logs/x-loader_make.out

5.4 Building Kernel

Note: If you are building for a GP device it is recommended not to build the SMC kernel driver.
To create kernel uImage you need to add "mkimage" directory path to your "PATH" environment variable:

$ cd ${YOUR_PATH}/kernel/android-3.0
$ make ARCH=arm distclean
$ make ARCH=arm dart_defconfig
$ make ARCH=arm uImage 2>&1 |tee ${MYDROID}/logs/kernel_make.out

5.5 Building Kernel modules

$ make ARCH=arm modules 2>&1 |tee ${MYDROID}/logs/kernel_modules.out

5.6 Building WLAN driver

$ cd ${MYDROID}/hardware/ti/wlan/mac80211/compat_wl12xx
$ export KERNEL_DIR=${YOUR_PATH}/kernel/android-3.0
$ export KLIB=${KERNEL_DIR}
$ make ARCH=arm 2>&1 |tee ${MYDROID}/logs/wlan_modules.out

The above step will produce the following kernel WLAN modules: compat.ko, cfg80211.ko, mac80211.ko, wl18xx.ko and wl18xx_sdio.ko. These modules are pushed into the /system/lib/modules directory on the flashed image.

5.7 Building BTFM driver

$ cd ${MYDROID}/hardware/ti/wpan/bluetooth-compat
$ export KERNEL_DIR=${YOUR_PATH}/kernel/android-3.0
$ export KLIB=${KERNEL_DIR}
$ make ARCH=arm 2>&1 |tee ${MYDROID}/logs/wlan_modules.out

The above step will produce the following kernel BTFM modules: compat.ko, btwilink.ko, bnep.ko, hidp.ko, rfcomm.ko, bluetooth.ko. These modules are pushed into the /system/lib/modules directory on the flashed image.

5.8 Building Android Filesystem (AFS) with TI Codecs enabled

In the make step below use the number of cores you have available; i.e. -j4 (for 4 cores) or -j12 (for 12 cores)

$ source build/envsetup.sh

Now setup platform:

$ lunch full_blaze-userdebug

And build Android AFS:

$ make clean  #(required for clean rebuild only)
$ make 2>&1 | tee ${MYDROID}/logs/android_make.out

5.9 Preparing Android binaries

Install external kernel modules that are required by the DART-4460 board.

$ export BOARD_TYPE="blaze"

$ cd ${MYDROID}/out/target/product/${BOARD_TYPE}
$ mkdir -p system/lib/modules
$ find ${MYDROID}/hardware/ti/wlan/mac80211/compat_wl12xx -name \*.ko |while read f; do cp $f system/lib/modules/; done
$ find ${MYDROID}/hardware/ti/wpan/bluetooth-compat -name \*.ko |while read f; do cp $f system/lib/modules/; done

5.10 Preparing eMMC images

$ cd ${YOUR_PATH}
$ mkdir -p omap4_emmc_files_omap4dart ; cd omap4_emmc_files_omap4dart
$ cp -f ${MYDROID}/out/host/linux-x86/bin/fastboot .
$ cp -f ${MYDROID}/out/host/linux-x86/bin/mkbootimg .
$ cp -f ${MYDROID}/out/host/linux-x86/bin/simg2img .
$ cp -f ${MYDROID}/out/host/linux-x86/bin/make_ext4fs .
$ cp -f ${YOUR_PATH}/kernel/android-3.0/arch/arm/boot/zImage .

  <<  For OMAP4 Dart Board >>
$ cp -f ${YOUR_PATH}/x-loader/MLO Dart_Board_OMAP4460_GP_ES1.1_MLO
$ cp -f ${YOUR_PATH}/u-boot/u-boot.bin Dart_Board_u-boot.bin

  <<  For OMAP4 Dart EVM >>
$ cp -f ${YOUR_PATH}/x-loader/MLO Dart_EVM_OMAP4460_GP_ES1.1_MLO
$ cp -f ${YOUR_PATH}/u-boot/u-boot.bin Dart_EVM_u-boot.bin

Create img files:

$ cd ${YOUR_PATH}/omap4_emmc_files_omap4dart
$ cp -f ${MYDROID}/out/target/product/${BOARD_TYPE}/*.img .

This build should not take too much time and will re-generate a new *.img files with the modified init.rc file in it

Now from this new directory we will create the eMMC images which will be flashed using fastboot protocol (described later).

First create boot.img image using kernel image we copied previously:

$ ./mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x80000000 --board omap4 --cmdline "<extra_bootargs>" -o boot.img

For example to create boot.img with HDMI resolution of 1920x1080:

$ ./mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x80000000 --board omap4 --cmdline "omapdss.def_disp=hdmi omapdss.hdmi_options=1920x1080" -o boot.img

Create cache partition:

$ dd if=/dev/zero of=./cache.img bs=1048510 count=128
$ mkfs.ext4 -F cache.img -L cache

6 Flashing the Android binaries on eMMC

6.1 Flash Android binaries using Fastboot

After the eMMC files are available you then can use the fastboot.sh script to upload binaries to your Dart Board or Dart EVM. You will need to copy the fastboot.sh script to the location of the eMMC files.

$ cd ${YOUR_PATH}/omap4_emmc_files_omap4dart
$ cp ${MYDROID}/device/ti/${BOARD_TYPE}/boot/fastboot.sh .

Connect the Dart Board or Dart EVM USB OTG port to your Linux machine and go to where the eMMC files are. Previous partitions created will be deleted and eMMC will be flashed with new u-boot and MLO. You need to boot the board and start fastboot server on the target (OMAP4 board).

   # fastboot

You should see a message such as:

    "Fastboot started..." or "Fastboot entered..."

When running the fastboot script the command should be issued as super user then run:

$ sudo ./fastboot.sh --pwd

Dart will boot up on its own with the new image in a few minutes. Until the user interface is ready for use, please avoid interrupting it by pressing any keys etc. This will detect your board and flash the images to the board.

6.1.1 First time flashing on eMMC

If there is no u-boot on your board's eMMC you have two options to boot Dard, using external SD card or using usbboot utility which boot Dart over USB OTG port.

Boot using external SD card:

To boot using external SD card copy u-boot.bin and MLO files to an SD card (boot partition) and then boot the target board from this external SD card by press and hold the bootselect button.

Boot using usbboot utility:

usbboot is a small utility that boot Dart over USB OTG port, it has embedded 1ndstage bootloader (MLO) and it takes u-boot.bin image file as parameter.

(pre-built binary and source code of usbboot utility can be obtained from Variscite's FTP)

To boot using usbboot,  press and hold the bootselect button, power on the board and then connect the Dart USB OTG port to Linux machine.

Then from Linux shell type:

$ sudo ./usbboot u-boot.bin

Flash eMMC

Once you boot the board, start fastboot server on the target (Dart board).

# fastboot

You should see a message such as:

    "Fastboot started..." or "Fastboot entered..."

Now from the PC execute following commands to flash MLO and u-boot to eMMC

$ sudo ./fastboot oem format
$ sudo ./fastboot flash xloader ./MLO
$ sudo ./fastboot flash bootloader ./u-boot.bin

6.2 Flash Android binaries using Ubuntu SD image

As an easy and fast way to flash Android binaries on OMAP4 DART, Variscite provides a Ubuntu core SD card image with pre-built Android binaries.
This SD card image includes a script (emmc-flasher.sh) that installs the boot images and root file-system.

Preparing rescue SD-Card

  • Plug your SD card to your Linux machine, run dmesg and see what device is added (i.e. /dev/sdX)
  • gunzip Ubuntu_12.04_core-DART-BOARD.VAR10_2.img.gz
  • dd if=Ubuntu_12.04_core-DART-BOARD.VAR10_2.img of=/dev/sdX bs=128k

Recover Nand Flash

  • Insert the SD card into the SD/MMC slot of the custom board.
  • Boot from SD card.
  • Login as root (password:password)
  • From Linux command line, type:
$ cd eMMC/Android/
$ ./emmc-flasher.sh Dart_Board