We're no longer updating This wiki!!

Preface

This page will explain how to compile Android for Odroid. Current version is android 2.1 with modified from Samsung BSP.

Please note, Odroid-S and Odroid-T users must follow this link.

http://dev.odroid.com/projects/odroid-t/#s-6

Build environment

Tested with Ubuntu 8.10/9.04/9.10 There were additional work to build the Android platform with Ubuntu 9.10

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) 5.0 Update 12 or greater.

* Download packages.

# sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl
# sudo apt-get install valgrind

* Android also need Phython 2.4 or higher. But, Ubuntu has Python 2.5 in general. * Install JDK 5.0 Update12 or later. * First, You have to add below in /etc/apt/sources.list

     deb http://ko.archive.ubuntu.com/ubuntu/ jaunty multiverse
     deb http://ko.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

* and then

# sudo apt-get update
# sudo apt-get install sun-java6-jdk

* Add Path in your environment file. Modify your ~/.bashrc file to add a new path with editor (gedit or vi)

export PATH=/home/$USER/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16  ---> Java Home Directory you've installed.
export ANDROID_JAVA_HOME=$JAVA_HOME

* To apply this change login again or restart the .bashrc

source .bashrc

Installing Repo

Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see [http://source.android.com/download/using-repo Using Repo and Git]. To install, initialize, and configure Repo, follow these steps:

Make sure you have a ~/bin directory in your home directory, and check to be sure that this bin directory is in your path:

# cd ~
# mkdir bin 
# echo $PATH

Download the repo script and make sure it is executable:

# curl http://android.git.kernel.org/repo >~/bin/repo
# chmod a+x ~/bin/repo

Initializing a Repo client

Create an empty directory to hold your working files:

# mkdir myandroid
# cd myandroid
# cd myandroid

Run repo init to bring down the latest version of Repo for odroid with all its most recent bug fixes. You must specify a URL for the manifest:

# repo init -u git://git.odroid.com/android-open/platform/manifest.git -b odroid-1.5r3

When prompted, configure Repo with your real name and email address. If you plan to submit code

A successful initialization will end with a message such as

 repo initialized in /myandroid

Your client directory should now contain a .repo directory where files such as the manifest will be kept.

Getting the files

To pull down files to your working directory from the repositories as specified in the default manifest, run

# repo sync

Building the code

* For Ubuntu 9.10 users need additional process as below. Modify myandroid/build/tools/findleaves.sh file's 89th line from

find "${@:0:$nargs}" $findargs -type f -name "$filename" -print |

to

find "${@:1:$nargs-1}" $findargs -type f -name "$filename" -print |

Change the host tool chain(gcc/g++) from 4.4 to 4.3 for compatibility.

# sudo apt-get install g++-4.3 
# cd /usr/bin 
# sudo mv g++ g++.org
# sudo mv gcc gcc.org
# sudo ln -s g++-4.3 g++
# sudo ln -s gcc-4.3 gcc

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

And install old version JDK 5. and choose 1.5.0-sun in update-alternatives menu.

sudo apt-get install sun-java5-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac

Modify your ~/.bashrc file for JAVA_HOME environment variable. And, Apply it.

export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

* To build the files, run make from within your working directory:

# cd ~/myandroid
# ln -s vendor/sec/smdkc100/build_android.sh  .
# ./build_android.sh

* If there is no problem, you can see below message. rootfs directory is automatically generated and all root file system of Android is located in that directory.(/myandroid/rootfs)

ok sucess !!!
#

* Note: Compile takes about 20 minutes with latest multi-core CPU based computer. Some old computer or virtual machine may need about 2 hours.

Write the compiled files to T-Flash under Ubuntu (Must have Linux PC)

* Insert the T-Flash in to Card reader and connect the card reader to Linux PC.

* Insert the T-Flash in to Card reader and connect the card reader to Linux PC. * Copy all files in the odroid_rootfs to EXT3 partition of T-Flash. * Normally when you plug the Card reader into Ubuntu PC, Ubuntu will mount it automatically. You need to remember the mounting point. * To find the mounting points, perform below commands.

# mount
/dev/sdc1 on /media/disk-1 type ext3 (rw,nosuid,nodev,uhelper=hal) ---> Mount T-Flash first partition(Android data)
/dev/sdc2 on /media/disk-2 type ext3 (rw,nosuid,nodev,uhelper=hal) ---> Mount T-Flash second partition(Android system) : remember this!
#
 

If the partition table is NOT correct, you need to make partition as below. You also need this process, if you want to use fresh(new) T-flash card.

==== Partitioning T-Flash card ====
1. Connect T-Flash card to PC via USB card reader.
   # sudo fdisk -l // Check the information of mounted disks.
2. If the T-Flash card is mounted, simply un-mount it.
   # sudo umount /dev/sdc1
3. You can double check whether the disk is un-mounted or not.
   # mount
4. Let's start partitioning with fdisk utility.
   # sudo fdisk /dev/sdc
5. Read current partition information with 'P' command.
6. Delete all partitions with 'D' command.
7. Create new partition with 'N' command.
8. Select primary partition with 'P' command.
9. Select partition number ==> '1'
10. Press Enter for first cylinder with default value.
11. Set partition size (+1G)

12. Create new partition with 'N' command.
13. Select primary partition with 'P' command.
14. Select partition number ==> '2'
15. Press Enter for first cylinder with default value.
16. Set partition size (+256MB)

17. Create new partition with 'N' command.
18. Select primary partition with 'P' command.
19. Select partition number ==> '3'
20. Press Enter for first cylinder with default value.
21. Set partition size (+256MB)

22. Configure disk system type with 'T' command for first partition.
   partition number(1)
   Hex code = 83   (83 is Linux)
23. Configure disk system type with 'T' command for second partition.
   partition number(2)
   Hex code = 83   (83 is Linux)
24. Configure disk system type with 'T' command for third partition.
   partition number(3)
   Hex code = 83   (83 is Linux)
25. Write and exit with 'W' command.
26. Final check the partition table.
   # sudo fdisk -l

Format those 3 partitions with EXT3 file system.
   # sudo mkfs.ext3 /dev/sdc1 
   # sudo mkfs.ext3 /dev/sdc2
   # sudo mkfs.ext3 /dev/sdc3 

Copy rootfs to formatted partition (Overwrite)

* Copy root file system to EXT3 partition of T-Flash.

# sudo cp -a ~/myandroid/rootfs/* /media/disk-2 ---> mounting point (You may have different location)
# sync
 

* Unmount the T-Flash disk and move the card from PC to Odroid for testing.

# sudo umount /media/disk-1 (or) sudo umount /dev/sdc1 ---> Unmount T-Flash first partition(Android data)
# sudo umount /media/disk-2 (or) sudo umount /dev/sdc2 ---> Unmount T-Flash second partition(Android system)
 

Copy rootfs to new partition (Clean & Write)

* Before copying files, format the partition first. All data will be erased. * To format the T-Flash, unmount it first. * This is an example when device node of T-flash is /dev/sdc.

# sudo umount /dev/sdc1 ---> Unmount T-Flash first partition(Android data)
# sudo umount /dev/sdc2 ---> Unmount T-Flash second partition(Android system)
# sudo mkfs.ext3 /dev/sdc2
 

* If you want clean install, erase the Android data partition as below. * WARNING! : You can delete all of data in you Host PC, if you select wrong disk/partition node name.

# sudo mkfs.ext3 /dev/sdc1 ---> T-Flash first partition(Android data)
 

* After formatting, mount the T-flash to /media/disk

# sudo mount /dev/sdc2 /media/disk ---> T-Flash second partition(Android system)
 

* You can copy the root file system to T-Flash.

# sudo cp -a ~/myandroid/rootfs/* /media/disk ---> T-Flash second partition(Android system)
# sync
 

* Unmount the T-Flash disk and move the card from PC to Odroid for testing.

# sudo umount /media/disk (or) sudo umount /dev/sdc2 ---> Unmount T-Flash second partition(Android system)
 

T-flash sector map

Others

References

en/android/android.txt · Last modified: 2014/07/01 17:33 by ruppi
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0