Android: Configuring the Host PC

From OMAPpedia

(Difference between revisions)
Jump to: navigation, search
(Ubuntu 10 (32 bit))
m (Installing repo)
 
(29 intermediate revisions not shown)
Line 16: Line 16:
:<big><b>Step 1</b></big>
:<big><b>Step 1</b></big>
-
 
-
Building Android binaries consists of 4 steps:
 
-
# Host PC setup
 
-
# Building bootloader
 
-
# Building kernel
 
-
# Building filesystem
 
-
 
-
This page details step 1 on how to setup a Host PC to build Android binaries.
 
==Linux Distribution==
==Linux Distribution==
Line 45: Line 37:
Quick Link - [http://www.codesourcery.com/sgpp/lite/arm/portal/release644 CodeSourcery G++ Lite 2008q3-72 for ARM GNU/Linux]
Quick Link - [http://www.codesourcery.com/sgpp/lite/arm/portal/release644 CodeSourcery G++ Lite 2008q3-72 for ARM GNU/Linux]
-
Note 2: For L24x, L27x kernel builds, Codesourcery tool chain 2009-q1 release should be used.
+
Note 2: For L24x, L27x kernel builds, Codesourcery tool chain 2010-q1 release should be used.
-
Quick Link - [http://www.codesourcery.com/sgpp/lite/arm/portal/release858 CodeSourcery G++ Lite 2009q1-203 for ARM GNU/Linux]
+
Quick Link - [http://www.codesourcery.com/sgpp/lite/arm/portal/release1293 Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux]
'''Steps'''
'''Steps'''
-
* Download .tar from above link and untar to a host pc directory.
+
* Download .tar from above link and untar to a host pc directory
 +
 
 +
  wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 +
  OR
 +
  wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 +
  mkdir -p ${HOME}/opt
 +
  tar -C ${HOME}/opt -jxf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 +
 
* Add Compiler directory to PATH, and cross compiler prefix before build
* Add Compiler directory to PATH, and cross compiler prefix before build
  export PATH=/<toolchain_folder>/bin:$PATH
  export PATH=/<toolchain_folder>/bin:$PATH
  export CROSS_COMPILE=arm-none-linux-gnueabi-
  export CROSS_COMPILE=arm-none-linux-gnueabi-
-
==Additional packages required for building==
+
==Eclair and Froyo Release==
 +
 
 +
===Additional packages required for building===
<pre>
<pre>
sudo apt-get install git-core flex bison gperf libesd0-dev zip
sudo apt-get install git-core flex bison gperf libesd0-dev zip
Line 108: Line 109:
Try to change the default java version with the following command:
Try to change the default java version with the following command:
<pre>
<pre>
-
sudo update-alternatives -config java
+
sudo update-alternatives --config java
</pre>
</pre>
-
This will show you the options you have for selecting which java version you want by default. You will have to do this for all java binaries that come with the java jdk (javac, javadoc, javah, etc).
+
This will show you the options you have for selecting which java version you want by default. '''You will have to do this for all java binaries that come with the java jdk''' (javac, javadoc, javah, etc).
* Libiconv
* Libiconv
Line 132: Line 133:
for further information refer to the link http://www.gnu.org/software/libiconv/
for further information refer to the link http://www.gnu.org/software/libiconv/
-
64-bit Host
+
* Gettext
 +
This can be downloaded from http://www.gnu.org/software/gettext/
 +
Follow the instructions and install to the standard location. like:
 +
<pre>
 +
wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
 +
tar xzvf gettext-0.18.1.1.tar.gz
 +
cd gettext-0.18.1.1/
 +
./configure
 +
make
 +
sudo make install
 +
</pre>
-
On a 64-bit host, you need to force creation of 32-bit code and use the 32-bit version of libiconv. You can do the native 64-bit build and install as described above first. Then to build a 32-bit version:  
+
for further information refer to the link http://www.gnu.org/software/gettext/
 +
 
 +
'''64-bit Host'''
 +
 
 +
On a 64-bit host, you need to force creation of 32-bit code and use the 32-bit version of libiconv and gettext. You can do the native 64-bit build and install as described above first. Then to build a 32-bit version:  
<pre>
<pre>
-
./configure CFLAGS=-m32
+
./configure CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32
make
make
sudo make install-lib libdir=/usr/local/lib32
sudo make install-lib libdir=/usr/local/lib32
</pre>
</pre>
-
Note:  You may also need to install ia32-libs.
+
Note:  You may also need to install ia32-libs and gcc-multilib if they are not installed. Additional 32-bit compatibility libraries that may be required: lib32readline5-dev lib32z1-dev lib32stdc++6 lib32ncurses5-dev g++-multilib
-
===Ubuntu 10 (32 bit)===
+
===Ubuntu 10.x (32 bit)===
From a stock default install. openjdk is not supported, but you can try it by uncommenting the requirement in build/core/main.mk:111
From a stock default install. openjdk is not supported, but you can try it by uncommenting the requirement in build/core/main.mk:111
Otherwise, you have to [http://www.oracle.com/technetwork/java/javase/downloads/index.html download binary-only java].
Otherwise, you have to [http://www.oracle.com/technetwork/java/javase/downloads/index.html download binary-only java].
 +
<pre>
<pre>
apt-get install git-core uboot-mkimage openjdk-6-jdk bison flex g++-4.4 zlib1g-dev libncurses5-dev libreadline5-dev gperf
apt-get install git-core uboot-mkimage openjdk-6-jdk bison flex g++-4.4 zlib1g-dev libncurses5-dev libreadline5-dev gperf
</pre>
</pre>
 +
 +
 +
Or you can follow these [http://zebardast.ir/en/installing-sun-jdk-5-on-ubuntu-9-10-and-10-04/ instructions].  After installation, be sure to run the following commands and select the 1.5 version of the JDK.
 +
 +
<pre>
 +
sudo update-alternatives --config java
 +
 +
sudo update-alternatives --config javac
 +
</pre>
 +
 +
==Gingerbread Support==
 +
'''64-bit Ubuntu/Linux Distribution (kernel 2.6.35) is required by Gingerbread.'''
 +
 +
(The procedure to pull the Linux source code is given in Step 3, you are currently on the Step 1 page.)
 +
 +
===Additional packages required for building===
 +
 +
<pre>
 +
sudo apt-get install git-core flex bison gperf libesd0-dev zip libwxgtk2.6-dev zlib1g-dev build-essential tofrodos x-dev
 +
sudo apt-get install lib32readline5-dev libstdc++6 lib32z1 lib32z1-dev ia32-libs g++-multilib libx11-dev libncurses5-dev
 +
</pre>
 +
 +
Add the partner repositories and install the JDK:
 +
 +
<pre>
 +
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
 +
sudo apt-get update
 +
sudo apt-get install sun-java6-jdk
 +
</pre>
 +
 +
; Libiconv
 +
 +
This can be downloaded from http://www.gnu.org/software/libiconv/
 +
Follow the instructions and install to the standard location. like:
 +
 +
<pre>
 +
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
 +
tar xzvf libiconv-1.13.1.tar.gz
 +
cd libiconv-1.13.1/
 +
./configure
 +
make
 +
sudo make install
 +
</pre>
 +
After installing GNU libiconv for the first time, it is recommended to recompile and reinstall GNU gettext, so that it can take advantage of libiconv.
 +
On systems other than GNU/Linux, the iconv program will be internationalized only if GNU gettext has been built and installed before GNU libiconv. This means that the first time GNU libiconv is installed, we have a circular dependency between the GNU libiconv and GNU gettext packages, which can be resolved by building and installing either
 +
 +
 +
for further information refer to the link http://www.gnu.org/software/libiconv/
 +
 +
; Gettext
 +
This can be downloaded from http://www.gnu.org/software/gettext/
 +
Follow the instructions and install to the standard location. like:
 +
<pre>
 +
wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
 +
tar xzvf gettext-0.18.1.1.tar.gz
 +
cd gettext-0.18.1.1/
 +
./configure
 +
make
 +
sudo make install
 +
</pre>
 +
 +
for further information refer to the link http://www.gnu.org/software/gettext/
 +
 +
 +
Therefore, for systems other than GNU/Linux, first libiconv, then gettext, then libiconv again
 +
 +
=Environment Setup=
 +
Environments may differ from one developer to the next. Below is one of many possible environment setup.
 +
 +
Android environment location
 +
cd ~
 +
mkdir android_rls
 +
cd android_rls
 +
mkdir -p bootloader mydroid myfs my_manifest
 +
export MYDROID=~/android_rls/mydroid
 +
 +
* bootloader -- location for your u-boot and x-loader (covered in next section)
 +
* mydroid -- location for your android filesystem
 +
* my_manifest -- used for locking and building specify release tags
 +
 +
=Installing repo=
 +
For detail information regarding repo visit: [http://source.android.com/source/git-repo.html Using Repo and Git]
 +
 +
Other reference links on Git can be found in [http://omappedia.org/wiki/Technical_References Techincal References page]
 +
 +
Download repo to environment
 +
<pre>
 +
$ cd ~/android_rls/mydroid
 +
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ./repo
 +
$ chmod a+x repo
 +
</pre>
 +
 +
[[Category:Android]]
[[Category:Android]]

Latest revision as of 15:35, 14 November 2011

Android Logov2.jpg
How to get started building your own binaries for the Android OS on your OMAP Platform
Overview Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 Step 9

   

Step 1


Contents

[edit] Linux Distribution

Ubuntu is the recommended Linux distribution for this setup. Other distributions are available, however the configurations listed in this wiki currently only covers Ubuntu.

Ubuntu is available for download at: https://help.ubuntu.com/community/Installation

Note: Around 10GB of hard disk space is required to build one release of Android.


[edit] Working behind a firewall

Refer to OMAP Platform Support Tools for more information on setting up Ubuntu's Firewall.


[edit] ARM Cross Compiler

CodeSourcery ARM Compiler should be used for building different kernel distribution and software releases on OMAP platforms. Visit www.codesourcery.com for more info.

Note 1: For L25x kernel builds, Codesourcery tool chain 2008-q3 release should be used. Quick Link - CodeSourcery G++ Lite 2008q3-72 for ARM GNU/Linux

Note 2: For L24x, L27x kernel builds, Codesourcery tool chain 2010-q1 release should be used. Quick Link - Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux

Steps

 wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 
 OR
 wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 mkdir -p ${HOME}/opt
 tar -C ${HOME}/opt -jxf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
export PATH=/<toolchain_folder>/bin:$PATH
export CROSS_COMPILE=arm-none-linux-gnueabi-

[edit] Eclair and Froyo Release

[edit] Additional packages required for building

sudo apt-get install git-core flex bison gperf libesd0-dev zip
sudo apt-get install libwxgtk2.6-dev zlib1g-dev build-essential libstdc++5 
sudo apt-get install tofrodos x-dev libx11-dev libncurses5-dev 
sudo apt-get install sun-java5-jdk

To uninstall “sun-java6-jdk” please type:

sudo apt-get remove sun-java6-jdk
sudo apt-get install lib32readline5-dev 
sudo apt-get install libstdc++6

#add the old Jaunty repos to /etc/apt/sources.list 
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

#then run below commands
sudo apt-get update
sudo apt-get install sun-java5-jdk


For Ubuntu® users, who previously had java6 installed might run into the following error:

************************************************************
You are attempting to build with the incorrect version of java.

Your version is: java version "1.6.0_10".
The correct version is: 1.5.
 
Please follow the machine setup instructions at 
    http://source.android.com/download
************************************************************

Try to change the default java version with the following command:

sudo update-alternatives --config java

This will show you the options you have for selecting which java version you want by default. You will have to do this for all java binaries that come with the java jdk (javac, javadoc, javah, etc).

This can be downloaded from http://www.gnu.org/software/libiconv/ Follow the instructions and install to the standard location. like:

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xzvf libiconv-1.13.1.tar.gz 
cd libiconv-1.13.1/
./configure
make
sudo make install

After installing GNU libiconv for the first time, it is recommended to recompile and reinstall GNU gettext, so that it can take advantage of libiconv. On systems other than GNU/Linux, the iconv program will be internationalized only if GNU gettext has been built and installed before GNU libiconv. This means that the first time GNU libiconv is installed, we have a circular dependency between the GNU libiconv and GNU gettext packages, which can be resolved by building and installing either

first libiconv, then gettext, then libiconv again

for further information refer to the link http://www.gnu.org/software/libiconv/

This can be downloaded from http://www.gnu.org/software/gettext/ Follow the instructions and install to the standard location. like:

wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
tar xzvf gettext-0.18.1.1.tar.gz
cd gettext-0.18.1.1/
./configure
make
sudo make install

for further information refer to the link http://www.gnu.org/software/gettext/

64-bit Host

On a 64-bit host, you need to force creation of 32-bit code and use the 32-bit version of libiconv and gettext. You can do the native 64-bit build and install as described above first. Then to build a 32-bit version:

./configure CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32
make
sudo make install-lib libdir=/usr/local/lib32

Note: You may also need to install ia32-libs and gcc-multilib if they are not installed. Additional 32-bit compatibility libraries that may be required: lib32readline5-dev lib32z1-dev lib32stdc++6 lib32ncurses5-dev g++-multilib

[edit] Ubuntu 10.x (32 bit)

From a stock default install. openjdk is not supported, but you can try it by uncommenting the requirement in build/core/main.mk:111

Otherwise, you have to download binary-only java.


apt-get install git-core uboot-mkimage openjdk-6-jdk bison flex g++-4.4 zlib1g-dev libncurses5-dev libreadline5-dev gperf


Or you can follow these instructions. After installation, be sure to run the following commands and select the 1.5 version of the JDK.

sudo update-alternatives --config java

sudo update-alternatives --config javac

[edit] Gingerbread Support

64-bit Ubuntu/Linux Distribution (kernel 2.6.35) is required by Gingerbread.

(The procedure to pull the Linux source code is given in Step 3, you are currently on the Step 1 page.)

[edit] Additional packages required for building

sudo apt-get install git-core flex bison gperf libesd0-dev zip libwxgtk2.6-dev zlib1g-dev build-essential tofrodos x-dev 
sudo apt-get install lib32readline5-dev libstdc++6 lib32z1 lib32z1-dev ia32-libs g++-multilib libx11-dev libncurses5-dev 

Add the partner repositories and install the JDK:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
Libiconv

This can be downloaded from http://www.gnu.org/software/libiconv/ Follow the instructions and install to the standard location. like:

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xzvf libiconv-1.13.1.tar.gz 
cd libiconv-1.13.1/
./configure
make
sudo make install

After installing GNU libiconv for the first time, it is recommended to recompile and reinstall GNU gettext, so that it can take advantage of libiconv. On systems other than GNU/Linux, the iconv program will be internationalized only if GNU gettext has been built and installed before GNU libiconv. This means that the first time GNU libiconv is installed, we have a circular dependency between the GNU libiconv and GNU gettext packages, which can be resolved by building and installing either


for further information refer to the link http://www.gnu.org/software/libiconv/

Gettext

This can be downloaded from http://www.gnu.org/software/gettext/ Follow the instructions and install to the standard location. like:

wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
tar xzvf gettext-0.18.1.1.tar.gz
cd gettext-0.18.1.1/
./configure
make
sudo make install

for further information refer to the link http://www.gnu.org/software/gettext/


Therefore, for systems other than GNU/Linux, first libiconv, then gettext, then libiconv again

[edit] Environment Setup

Environments may differ from one developer to the next. Below is one of many possible environment setup.

Android environment location

cd ~
mkdir android_rls
cd android_rls
mkdir -p bootloader mydroid myfs my_manifest
export MYDROID=~/android_rls/mydroid

[edit] Installing repo

For detail information regarding repo visit: Using Repo and Git

Other reference links on Git can be found in Techincal References page

Download repo to environment

$ cd ~/android_rls/mydroid
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ./repo
$ chmod a+x repo



Left arrow1.png Android Logov2.jpg Right arrow1.png
Previous Home Next
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox