1. Prepare:
Ordinary PC (requires Internet access), PC OS Ubuntu 10.04 LTS (64-bit), has downloaded good Android 1.6_r1 source code.
2.Linux Dependent Package Installation:
In order to download and install the package faster, first modify the update source for Ubuntu10.04, and modify the steps as follows:
Run in Terminal:
$ sudo gedit/etc/apt/sources.list
will open a text editor, modify the source server list, here Use the source of NetEase,
The address is as follows: excerpt from Network
Deb Http://mirrors.163.com/ubuntu/lucid main Universe restricted multiverse
DEB-SRC http://mirrors.163.com/ubuntu/lucid main Universe restricted multiverse
Deb Http://mirrors.163.com/ubuntu/lucid-security Universe main Multiverse restricted
DEB-SRC http://mirrors.163.com/ubuntu/lucid-security Universe main Multiverse restricted
Deb Http://mirrors.163.com/ubuntu/lucid-updates Universe main Multiverse restricted
Deb Http://mirrors.163.com/ubuntu/lucid-proposed Universe main Multiverse restricted
DEB-SRC http://mirrors.163.com/ubuntu/lucid-proposed Universe main Multiverse restricted
Deb Http://mirrors.163.com/ubuntu/lucid-backports Universe main Multiverse restricted
DEB-SRC Http://mirrors.163.com/ubuntu/lucid-backports Universe main Multiverse restricted
DEB-SRC Http://mirrors.163.com/ubuntu/lucid-updates Universe main Multiverse restricted
Close after saving.
Run:
$ sudo apt-get update
Updates the local source address list.
You can then install the packages that are required for the compilation.
The study found that the source address for 32-bit and 64-bit Ubuntu is the same.
To compile the Android source code, to install the required dependencies of the compilation, the following gives the installation package commands (actually copied on the official website):
$ 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 Lib32readline5-dev lib32z-dev \
Libgl1-mesa-dev g++-multilib mingw32 Tofrodos python-markdown \
Libxml2-utils Xsltproc
The GCC version is too high and should be reduced from 4.4 to 4.3.
Installing GCC4.3
$ sudo apt-get install gcc-4.3
$ sudo apt-get install g++-4.3
The meaning of the following two sentences:
$ sudo apt-get install gcc-4.3 g++-4.3
When the installation is complete, set the default GCC version.
Entry directory:/usr/bin/
$ sudo ln-s/usr/bin/gcc-4.3 gcc
$ sudo ln-s/usr/bin/g++-4.3 g++
To install GCC-related dependency packages:
$ sudo apt-get install gcc-4.3-locales gcc-4.3-multilib libmudflap0-4.3-dev \
Gcc-4.3-doc libgcc1-dbg libgomp1-dbg \
libmudflap0-dbg G++-4.3-multilib gcc-4.3-doc \
libstdc++6-4.3-dbg Libstdc++6-4.3-doc
See if there is/usr/lib32/mesa/libgl.so this file, if not
$ sudo ln-s/usr/lib32/mesa/libgl.so.1/usr/lib32/mesa/libgl.so
To this, the dependency package installed almost, installation speed, depends on the network download speed. Because the entire process is first downloaded and then installed.
Repeat the install command to see if the dependent package was installed successfully.
3.Linux the installation of the JDK.
The first thing to do is to download the JDK on the Oracle website. I have downloaded it, using "Jdk-1_5_0_22-linux-amd64.bin".
Heard: Android version is less than or equal to 2.2 with JDK1.5, version greater than or equal to 2.3 with JDK1.6
To create a Java installation directory
$ cd/usr/local/
$ sudo mkdir java
Copy the installation file "Jdk-1_5_0_22-linux-amd64.bin" to the directory you created
Enter the/usr/local/java/directory
Add execute permissions to the "Jdk-1_5_0_22-linux-amd64.bin" file.
$ sudo chmod 777 Jdk-1_5_0_22-linux-amd64.bin
To run the installation:
$ sudo./jdk-1_5_0_22-linux-amd64.bin
The installation protocol will appear, enter a Yes and agree to the installation. Wait a little while for the installation to succeed.
A jdk1.5.0_22 directory will appear, indicating that the installation is complete.
Environment variables:
Back to User directory: cd ~
Modify the configuration file with the current user:
$ VI. BASHRC
At the end of the. BASHRC, add:
Export Java_home= "/usr/local/java/jdk1.5.0_22"
Path= $PATH: $JAVA _home/bin
Export Classpath= ".: $JAVA _home/bin"
The first sentence is to create an environment variable called "Java_home", and the second sentence to add the JAVA installation directory path at the end of the environment variable "path" (Specify Javac path). In the third sentence, create an environment variable called "CLASSPATH".
After editing: Wq save exit.
Execute command:
$ source. BASHRC
The environment variable is in effect.
Or turn off the terminal (terminal) and turn it back on.
View the version of the JDK.
$ java-version
4. Compile the Android source code and upgrade to the SDK:
Copy the Android source to Ubuntu's user home directory,
Enter the root directory of the Android source code,
Run the following command to compile the environment initialization:
$ . build/envsetup.sh
Note that there is a point, or use:
$ source Build/envsetup.sh
Select a compilation entry:
$ Lunch Sdk-eng
To start compiling:
$ Make SDK
After compiling, the Out/target/product/generic directory generates SYSTEM.IMG, RAMDISK.IMG, userdata.img
Complete.
Android Source Build Environment (64-bit Ubuntu) various dependent package installation