====== ODROID-A4, A, PC, X, X2, U2, U3 and Q, Q2 Android(Ice Cream Sandwich & JellyBean) System ======
===== Preface =====
This page will explain how to compile Android for ODROID-A4 & A, PC, X, X2, Q, Q2, U2, U3. Current version is android 4.x based on Samsung rtm1.0
===== Build environment =====
Tested with Ubuntu 10.04/10.10/11.04 64bit version. ubuntu 11.10 in particular is troublesome because it uses gcc-4.6 by default and has no sun-java6-jdk in its repositories. heres's what you'll need to do to get AOSP 4.x to compile on ubuntu 11.10.
===== Source code download =====
Source code is stored in bundled micro SD card or you can get the latest source from here.
http://com.odroid.com/sigong/nf_file_board/nfile_board.php
Please note,
To follow below instructions, you need to update your ODROID to latest JB release.
===== Download and Install essential packages =====
Android requires the following system packages:
- flex: This lexical analyzer generator is used to read a given input file for a description of a scanner to generate.
- bison: This is a general-purpose parser generator.
- gperf: This is a perfect hash function generator.
- libesd0-dev: This enlightened sound daemon (dev files) is used to mix digitized audio streams for playback by a single device.
- libwxgtk2.6-dev: This package provides GUI components and other facilities for many different platforms.
- build-essential: This package contains a list of packages considered fundamental to building Debian packages.
- Android source code includes a hard dependency on the Java Developer Kit (JDK) 6.0 or greater.
Please refer to this link first !!!
http://source.android.com/source/download.html
- Install dependencies.
Compilers, parsers, file-manipulation tools, libraries, etc; this is mandatory! The list on the source.android.com Inititalizing a Build Environment page is similar, but a few of those packages donot exist in 11.10. Use these:
#sudo apt-get update
#sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils
- Your system may need a mkimage to make a ramdisk image.
# sudo apt-get install uboot-mkimage
- Android also need Phython 2.4 or higher. But, Ubuntu has Python 2.5 in general.
- You must build on Ubuntu 64bit from Ice Cream.
# sudo apt-get update
# sudo apt-get install sun-java6-jdk
- Download Sun Java 6 JDK for Ubuntu 11.04/10.10/11.10
Android 2.3+ requires Java 6 to build correctly. While OpenJDK did work for 2.3, it doesnot work for Android 4.0; you need Sun Java. Download the JDK 1.6 binary release from Sun oracle Java download site and unzip it somewhere in your system, for example:
#sudo mkdir -p /opt/java/64/
#sudo cp jdk-6u29-linux-x64.bin /opt/java/64
#sudo su -
#cd /opt/java/64
#chmod +x jdk-6u29-linux-x64.bin
#./jdk-6u29-linux-x64.bin
#exit
Add the new Java to your shell environment $PATH so it takes precedent over other Javas you might have installed:
echo 'export PATH=/opt/java/64/jdk1.6.0_29/bin:$PATH' >> ~/.bashrc
To activate new PATH, log out and in again or type "export PATH=/opt/java/64/jdk1.6.0_29/bin:$PATH"
===== Getting source code and extraction =====
Android source code is stored in bundled microSD card.
File name of compressed source code may be different.
# mkdir mydroid
# cd mydroid
# tar xf source.tar
# tar zxf android.tar.gz
# cd android
With this process, you will have a full source code in mydroid directory.
===== Obtain restricted files from ODROID =====
There are some restricted object files which have no source code.
We have no right to release even the objects.
Those files should be extracted from ODROID device.
In the android/device/hardkernel/odroida/AndroidBoard.mk file, confidential library contents have no source code.
Refer to the AndroidBoard.mk file to make a list of restricted ones.
==== Case 1: ADB from android-sdk ====
You need to install ADB driver first and connect your ODROID to your host PC.
===== ODROID-Q & X Exynos-4412 platform =====
You don't need to extract any file from ODROID-Q/X. You can skip this process.
===== ODROID-A =====
== Extract library files ==
# mydroid/android/device/samsung/exynos4/lib/mali_ump$
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libMali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libUMP.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libion.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libEGL_mali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libGLESv1_CM_mali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libGLESv2_mali.so .
== Change access permission ==
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ chmod -R 755 *
== Extract library files ==
# mydroid/android/device/samsung/exynos4/libgralloc_ump$ adb pull /system/lib/hw/gralloc.odroida.so .
== Change access permission ==
# mydroid/android/device/samsung/exynos4/libgralloc_ump$ chmod -R 755 *
== Extract library files ==
# mydroid/android/vendor/invensense_v3$ adb pull /system/lib/hw/sensors.odroida.so .
# mydroid/android/vendor/invensense_v3$ adb pull /system/lib/libmpl.so .
# mydroid/android/vendor/invensense_v3$ adb pull /system/lib/libmlplatform.so .
# mydroid/android/vendor/invensense_v3$ adb pull /system/lib/libmllite.so .
== Change access permission ==
# mydroid/android/vendor/invensense chmod -R 755 *
==== ODROID-A4 ====
== Extract library files ==
# mydroid/android/device/samsung/exynos4/lib/mali_ump$
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libMali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libUMP.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libion.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libEGL_mali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libGLESv1_CM_mali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libGLESv2_mali.so .
== Change access permission ==
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ chmod -R 755 *
== Extract library files ==
# mydroid/android/device/samsung/exynos4/libgralloc_ump$ adb pull /system/lib/hw/gralloc.odroida4.so .
== Change access permission ==
# mydroid/android/device/samsung/exynos4/libgralloc_ump$ chmod -R 755 *
== Extract library files ==
# mydroid/android/vendor/invensense$ adb pull /system/lib/hw/sensors.odroida4.so .
# mydroid/android/vendor/invensense$ adb pull /system/lib/libinvensense_hal.so .
# mydroid/android/vendor/invensense$ adb pull /system/lib/libmplmpu.so .
# mydroid/android/vendor/invensense$ adb pull /system/lib/libmlplatform.so .
# mydroid/android/vendor/invensense$ adb pull /system/lib/libmllite.so .
# mydroid/android/vendor/invensense$ adb pull /system/lib/libakmd.so .
== Change access permission ==
# mydroid/android/vendor/invensense chmod -R 755 *
==== ODROID-PC ====
== Extract library files ==
# mydroid/android/device/samsung/exynos4/lib/mali_ump$
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libMali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libUMP.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/libion.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libEGL_mali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libGLESv1_CM_mali.so .
# mydroid/android/device/samsung/exynos4/lib/mali_ump$ adb pull /system/lib/egl/libGLESv2_mali.so .
== Change access permission ==
# mydroid/android/device/sec/lib/mali_ump$ chmod -R 755 *
== Extract library files ==
# mydroid/android/device/samsung/exynos4/libgralloc_ump$ adb pull /system/lib/hw/gralloc.odroidpc.so .
== Change access permission ==
# mydroid/android/device/samsung/exynos4/libgralloc_ump$ chmod -R 755 *
Turn off ODROID, and eject the T-Flash card and insert it into T-flash memory card reader. Then plug it to your host PC
In the linux host PC, you need to copy all the restricted files as described in Case-1.
===== Building the code =====
You need to install mkimage package
# sudo apt-get install uboot-mkimage
or you need to set a PATH of mkimage of uboot directory.
Optional!! If you meet compile error due to JDK version mismatching, add this items in to Synaptic package source. (sudo vi /etc/apt/sources.list)
deb http://archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
sudo apt-get update
* To build the files, command below in your working directory:
==== odroid - A ====
# cd ~/mydroid/android
# mydroid/android$
# chmod u+x ./build_android.sh
# ./build_android.sh odroida
==== odroid-A4 ====
# cd ~/mydroid/android
# mydroid/android$
# chmod u+x ./build_android.sh
# ./build_android.sh odroida4
===== odroid - PC =====
# cd ~/mydroid/android
# mydroid/android$
===== odroid - X ======
# mydroid/android$
edit device/hardkernel/odroidx/BoardConfig.mk
BOARD_USES_EMMC = true -> Use eMMC
BOARD_USES_EMMC = false -> Use SD Card
# chmod u+x ./build_android.sh
# ./build_android.sh odroidx
===== odroid - X2 =====
# mydroid/android$
edit device/hardkernel/odroidx2/BoardConfig.mk
BOARD_USES_EMMC = true -> Use eMMC
BOARD_USES_EMMC = false -> Use SD Card
# chmod u+x ./build_android.sh
# ./build_android.sh odroidx2
===== odroid - Q =====
# cd ~/mydroid/android
# mydroid/android$
# chmod u+x ./build_android.sh
# ./build_android.sh odroidq
===== odroid - Q2 =====
# cd ~/mydroid/android
# mydroid/android$
# chmod u+x ./build_android.sh
# ./build_android.sh odroidq2
===== odroid - U2/U3 =====
# chmod u+x ./build_android.sh
# ./build_android.sh odroidu
* If there is no issue, you can see below message. rootfs directory is automatically generated and all root file system of Android is located in that directory.(/mydroid/android/xxxxx-img)
ok sucess !!!
===== write MBR =====
In the u-boot prompt.
#fdisk -c 0
===== Format data, cache, fat partitions =====
In the host PC.
#fastboot erase userdata
#fastboot erase cache
#fastboot erase fat
===== Write ramdisk-uboot.img =====
not any more ramdisk-boot.img.
intergrate into system.img.
Need to learn u-boot section of Odroid project. http://dev.odroid.com/projects/odroid-t/wiki/UbootPage UBoot_Compile_HowTo
In the host PC.
#fastboot flash ramdisk out/target/product/odroid[a,a4,pc,x,q]/ramdisk-uboot.img
===== Write system.img =====
In the host PC.
#fastboot flash system out/target/product/odroid[a,a4,pc,x,q]/system.img
===== Reboot system ======
In the host PC.
#fastboot reboot
===== reformat 2 paritions with ext4 fs for ODROID-X , X2 , Q, Q2 & U2, U3 eMMC storage =====
You can't format any system partition with EXT4 file system in the u-boot prompt due to license issue.
So you MUST format the system partition as below in Android prompt in ADB shell or USB-UART console.
Please note the eMMC can't be connected to your Host PC and we need this process.
If you use SD-card for OS, just format the partition with your Linux Host PC via card reader.
root@@android:/ # make_ext4fs /dev/block/mmcblk0p3
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 11/65536 inodes and 8536/262144 blocks
root@@android:/ # make_ext4fs /dev/block/mmcblk0p4
Creating filesystem with parameters:
Size: 134217728
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 32768
Block groups: 1
Reserved block group size: 7
Created filesystem with 11/8192 inodes and 1550/32768 blocks
root@@android:/ # reboot
===== References =====
* http://source.android.com/source/download.html
* http://odroid.foros-phpbb.com/forum.htm
* http://www.hardkernel.com