Document directory
- 2.1 Python and JDK
- 2.2 "Fatal: git 1.5.4 or later required"
- 3.1 install dependent Software
- 3.2 installation script Repo
- 3.3 initialize the code repository
- 3.4 "Fatal: git 1.5.4 or later required" SOLUTION
- 3.5 download code
- 3.6 compile
1 Overview
Last week, I saw the android open source code message. Although I felt that Google's action would have a huge impact on the industry, I didn't have time to read it carefully and only browsed it.Project Layout. This morning, a netizen said in mail that android has been compiled and run. During the noon break, I compiled and ran it on a ubuntu7.10 virtual machine.
I have compiled openmoko and poky on this virtual machine. Compared with the two platforms that use openembedded, Android compilation is simpler and faster. When compiling openmoko and poky, I save all downloaded packages in a directory and direct the sources subdirectory of the compilation directory to this directory. In this way, even if some links become invalid in the future, you can compile them (in fact, you do not need to connect to the Internet during compilation). In addition, you do not need to download them again during recompilation to speed up compilation. Even so, it takes one night to fully compile poky. It takes only one hour to compile android.
2. Two minor issues in Compilation: 2.1 Python and JDK
The Google website's introduction to the compilation process is clear. However, when introducing other software packages, the apt-GET command is provided, but the link addresses of Python and JDK are provided separately, which is easy to mislead readers and thinks that the two software should be manually installed. In fact, these two software should also be installed through apt-Get. In particular, if python is installed from the source code, some components may fail to be compiled due to dependency on other software, affecting Android compilation. In addition, the source code package of Python 2.6 does not provide make uninstall, Which is troublesome to uninstall. In fact, we only need an apt-GET command to install all the dependent software.
2.2 "Fatal: git 1.5.4 or later required"
When executing repo init on ubuntu7.10, an error message "Fatal: git 1.5.4 or later required" is displayed. Compilation on ubuntu8.04 does not solve this problem. The following process describes how to solve this problem.
3. Install the dependent software in the compilation process 3.1 on ubuntu7.10
Run
Sudo apt-Get install Git-core GnuPG flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl Python sun-java5-jdk valgrind
3.2 installation script Repo
cd ~mkdir binexport PATH=$PATH:~/bincurl http://android.git.kernel.org/repo >~/bin/repochmod a+x ~/bin/repo
After adding the directory where the repo is located to the path, you can directly execute it in other directories.
3.3 initialize the code repository
I use/UI/mydroid as the working directory. After creating the directory, execute the following command in the directory:
repo init -u git://android.git.kernel.org/platform/manifest.git
If "Fatal: git 1.5.4 or later required" is returned, 3.4 is executed. Otherwise, run 3.5.
3.4 "Fatal: git 1.5.4 or later required" solution 3.4.1 delete Git-core and add apt Source
Run
sudo apt-get remove git-core
Edit the apt source file.
sudo vi /etc/apt/sources.list
Add at last
deb http://www.backports.org/debian/ etch-backports maindeb-src http://www.backports.org/debian/ etch-backports main
Then execute
sudo apt-get update
Update source. If the error message "The following signature cannot be verified because there is no public key: no_pubkey ea8e8b21_ba136c" appears, execute 3.4.2. Otherwise, execute 3.4.3.
3.4.2 install the Public Key
Run the GPG command to download the public key:
sudo gpg --keyserver wwwkeys.pgp.net --recv-keys EA8E8B2116BA136Csudo gpg --export -a EA8E8B2116BA136C > /tmp/key
Add public key:
sudo apt-key add /tmp/key
3.4.3 update Git-core
Run:
sudo apt-get updatesudo apt-get install debian-backports-keyringsudo apt-get updatesudo apt-get -t etch-backports install git-core
Then execute:
repo init -u git://android.git.kernel.org/platform/manifest.git
It should be enough.
3.5 download code
Run
repo sync
Download the code. I will execute this command at and download it.
3.6 compile
Run
make
Compile. I started compiling at and finished at around. The final output of compilation is:
Install system fs image: out/target/product/generic/system.imgTarget ram disk: out/target/product/generic/ramdisk.imgTarget userdata fs image: out/target/product/generic/userdata.img
4. Run
You can use a simulator to run the compiled image. Download one from the InternetAndroid-sdk-linux_x86-1.0_r1.zip, I put it in ~ /Decompress the android directory. Add the SDK tools directory in the path:
export PATH=${PATH}:~/android/android-sdk-linux_x86-1.0_r1/tools
Use environment variables to tell the simulator image directory:
export ANDROID_PRODUCT_OUT=/ui/mydroid/out/target/product/generic
Last run:
emulator
You can. You can use the-skin parameter to select the skin. The SDK's tools/lib/images/skins directory contains the SDK's own skin. Below are two running tasks:
Compared with the Java framework of Android, I prefer GTK and C. But I have to admit that the android UI is much better than openmoko.
5 conclusion
You can ~ /. Add bashrc at the end:
export PATH=${PATH}:~/bin:~/android/android-sdk-linux_x86-1.0_r1/toolsexport ANDROID_PRODUCT_OUT=/ui/mydroid/out/target/product/generic
Automatically sets the compiling and Running Environments.
The Chinese text message bug of gsmd is being modified these two nights. I don't have time to take a closer look at the android compilation system. It seems easier than openembedded. In fact, openembedded is also a good habit, that is, it is not concise enough, the speed is slower, and the Occupied Space is larger. The working directory for compiling Android is 3.5 GB. I compiled 10.59 GB of poky directories and 11.6 GB of openmoko directories.