"Turn" on the Ubuntu10.04 compiled Android source (build Android source in Ubuntu10.04 Platform)

Source: Internet
Author: User

Label:

Original URL: http://blog.csdn.net/chenyafei617/article/details/6570928

First, Introduction

Today we will talk about how to compile Android source on the Ubuntu platform, my version of ubuntu10.04, before the compilation process explained I want to talk about making, make snod, makes kernel role, m, MM, Mmm their role as well as the difference.

-Make: Compile the source code, generate the corresponding system image file.
-Make Snod: Regenerate a system.img system image file
-Make kernel: Compile kernel (optional) generally based on the contents of the envsetup.sh file


-M:makes from the top of the tree (compile all modules).
-Mm:builds all of the modules in the current directory (compiles all the modules in the present catalog).
-Mmm:builds all of the modules in the supplied directories (compiles all modules in the specified directory).

Second, compile Android source and SDK

2.1. Fully compiled

Compiling and generating mirrors with make

~$: cd ~/ANDROID/SRC
~$: Make

After the image compiles successfully, ~/android/src/out/target/product/generic  some image files are generated in the directory

Ramdisk.img system.img userdata.img Android-info.txt

We can verify that we are compiling correctly by launching the emulator, and we'd better take the following action in the directory where system.img is located

~$ Emulator-kernel ~/android2.2/prebuilt/android-arm/kernel/kernel-qemu-ramdisk Ramdisk.img-debug all-data Userdata-qemu.img-system System.img-sysdir. -show-kernel-skin 800x480

If it starts correctly, the complete compilation succeeds.

After the complete compilation we can use the Make SDK command to do the SDK compile and pull the following steps:

~$ CD ~/ANDROID/SRC
~$ Make SDK

Note: If you need the build SDK, as the version is different, the environment we need is different, the version before compiling android2.2 needs to install SUN-JAVA5-JDK, not SUN-JAVA6-JDK, otherwise the following error will occur:

build/core/product_config.mk:207:warning:adding Test OTA key
====================================== ======
Target_product=generic
Target_build_variant=eng
target_simulator=
Target_build_type=release
Target_arch=arm
host_arch=x86
host_os=linux
host_build_type=release
build_id=
============= ===============================
Combining NOTICE Files:out/target/product/generic/obj/notice.txt
Finding NOTICE Files:out/host/linux-x86/obj/notice_files/hash-timestamp
Combining NOTICE files:out/host/linux-x86/obj/ NOTICE.txt
Package:out/target/product/generic/generic-img-eng.anjoy.zip
SDK buildinfo:out/target/product/ Generic/sdk/sdk-build.prop
Docs droiddoc:out/target/common/docs/dx
Javadoc: Error-in Doclet class Droiddoc, method start is thrown Out exception java.lang.reflect.InvocationTargetException
Com.sun.tools.javac.code.symbol$completionfailure: Not Found Sun.util.resources.OpenListResourceBundle class file  

So, if the JDK version is different, then go to the official website to download one or install a bar, here I do not say more pull

After the SDK compiles successfully, the SDK's file directory and the package are generated in ~/android/src/out/host/linux-x86/sdk/:

Android-sdk_eng.anjoy_linux-x86
Android-sdk_eng.anjoy_linux-x86.zip


and package all the image files under ~/android/src/out/target/product/generic (generic is the default product name):

Generic-img-eng.anjoy.zip

The resulting SDK directory structure is:

/home/anjoy/android/src/out/host/linux-x86/sdk/android-sdk_eng.anjoy_linux-x86:
Total 32
DRWXRWX---6 anjoy anjoy 4096 2011-06-27 17:48.
Drwxr-x---3 anjoy anjoy 4096 2011-06-27 17:48..
DRWXRWX---2 anjoy anjoy 4096 2011-06-27 17:48 add-ons
DRWXRWX---anjoy anjoy 4096 2011-06-27 17:48 docs
-RW-RW----1 Anjoy anjoy 172 2011-06-27 17:50 documentation.html
DRWXRWX---3 anjoy anjoy 4096 2011-06-27 17:48 platforms
-RW-RW----1 Anjoy anjoy 225 2011-06-27 17:50 release_notes.txt
DRWXRWX---3 anjoy anjoy 4096 2011-06-27 17:50 Tools


To make it easy to use the generated SDK only needs to be added in the. BASHRC:

Export path= $PATH:/home/anjoy/android/src/out/host/linux-x86/sdk/android-sdk_eng.anjoy_linux-x86/tools

2.2. Modular compilation

Note: We must make a envsetup.sh script source before the modular compilation, or you can directly configure the path of the envsetup.sh file to your personal BASHRC file, so you don't have to pull the source action every time.

ENVSETUP.SH provides some bash function definitions that can be viewed using the help command when ENVSETUP.SH is run:

~$ Help
Invoke ". Build/envsetup.sh "from your shell to add the following functions to your environment:
-Croot:changes directory to the top of the tree.
-M:makes from the top of the tree.
-Mm:builds all of the modules in the current directory.
-Mmm:builds all of the modules in the supplied directories.
-Cgrep:greps on all local C + + files.
-Jgrep:greps on all local Java files.
-Resgrep:greps on all local res/*.xml files.
-Godir:go to the directory containing a file.
...
..

The compilation of the module is helpful for tapas, m, mm, mmm these commands.

Where MMM is followed by the module root directory, not all directories have sub-modules, those containing the Android.mk file directory is the root directory of the module, the module name can be from the android.mk local_module or Local_package_name Variable to get.

To compile a module separately, you need to specify the module path behind MMM, such as compiling the Launcher2 in application:

Mmm packages/apps/launcher2/

or run the Make module name directly in the SRC directory:

CD ~/ANDROID/SRC
Make Launcher2


2.3. Steps for incremental compilation

A, if we modify the code under a module, then we just need to re-compile the module can be pulled, without the need to compile the entire project.

B. The module that compiles the modified code, for example:

CD ~/ANDROID/SRC
Mmm packages/apps/launcher2

C, run in ~/ANDROID/SRC:

CD ~/ANDROID/SRC
Make Snod

D, the command generates a new system image system.img, which copies the system image to the SDK:

CD ~/ANDROID/SRC
CP out/target/product/generic/system.img/
out/host/linux-x86/sdk/android-sdk_eng.anjoy_linux-x86/tools/lib/images/

OK, this completes the Android source code compilation as well as the SDK generation pull

Reminder: If you are Ubuntu10.04 system installed on the 32-bit machine to compile Android2.3 source code, its steps and considerations are as follows:

1. Installing JDK6
For Android2.3 systems, do not install JDK5, you should install the latest JDK6.
If the installation of Jdk6,android will automatically press 64-bit compilation, if the system is 32-bit, there will be a compilation error, the following will say how to modify the error.
sudo add-apt-repository "Deb http://archive.canonical.com/lucid partner"
sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid Partner"
sudo apt-get update
sudo apt-get install SUN-JAVA6-JDK
sudo update-java-alternatives-s Java-6-sun
After installation, you need to manually set the Java_home, Jre_home, Class_path for the JDK6 installation path.

2. Compiling the android2.3

~$ CD ~/android2.3
~$ Source build/envsetup.sh
~$ make

An error will be prompted when making:

************************************************************
You is attempting to build on a 32-bit system.
Only 64-bit build environments is supported beyond froyo/2.2.
************************************************************

Because Android2.3 is compiled on a 64-bit system by default, you need to manually modify the build/core/main.mk to comment out this part of the judgment:

#ifneq (64,$ (findstring 64,$ (build_arch)))
#$ (Warning ************************************************************)
#$ (warning you is attempting to build on a 32-bit system.)
#$ (warning only 64-bit build environments is supported beyond froyo/2.2.)
#$ (Warning ************************************************************)
#$ (Error stop)
#endif

Re-make, if the JDK6 version is installed, will also error:

Docs droiddoc:out/target/common/docs/api-stubs
Could not load ' clearsilver-jni '
Java.library.path = Out/host/linux-x86/lib
Make: * * * [Out/target/common/docs/api-stubs-timestamp] Error 45
Make: * * * waiting for unfinished jobs ....
Could not load ' clearsilver-jni '
Java.library.path = Out/host/linux-x86/lib
Make: * * * [Out/target/common/docs/doc-comment-check-timestamp] Error 45

We just need to modify these files to go back to the 32-bit compilation environment:

# EXTERNAL/CLEARSILVER/CGI/ANDROID.MK
# EXTERNAL/CLEARSILVER/JAVA-JNI/ANDROID.MK
# EXTERNAL/CLEARSILVER/UTIL/ANDROID.MK
# EXTERNAL/CLEARSILVER/CS/ANDROID.MK

Change the compilation options of the above file contents-m64 to-m32.
Make again and make it in less than one hours.

OK, Max Gaocheng

Some of the make commands commonly used by Android

Http://blog.chinaunix.net/uid-26926660-id-3216956.html

1.make-jxx
XX Represents the number, this command will compile the Android system and generate an image, XX represents the number of CPU cores that can be used, which is particularly useful on a configured computer, the company's 16-core Ubuntu server executes make-j16 as long as less than 20 minutes, while a dual-core PC takes 4 hours!

2. Make Snod
 
This command will regenerate the mirror, consuming little time, similar toWinCE's makeimg process is useful if you modify files such as music, video, and more.

3.make CTS
This command compiles the CTS sleeve, and the compiled results are placed under the Data/app directory of the Out directory's corresponding version. Useful when CTS testing

4.make Installclean
This command clears the contents of the corresponding Board folder in the Out directory, which is equivalent to make clean, usually if you change some data files (such as remove), it is best to do the following made Installclean, otherwise the remaining in the out directory will be packaged in.

5.mm/mm-b
Development debugging most like this command, in the modified directory to execute this command, you can intelligently compile, the output of the file is pushed through the ADB to the target machine, can be easily debugged.

6.make SDK
This command generates a ready-to-publish SDK that has not yet been tried and is said to require JDK1.5

7.make Setting
can be compiled separately setting this module, has not yet tried, guess is not able to compile email, music these modules

8.make bootimage
This command can be used to generate BOOT.IMG, this image file contains the Linux Kernel,ram disk, the generated boot.img can only be burned by fastboot, which is useful when only modifying the Linux kernel

"Turn" on the Ubuntu10.04 compiled Android source (build Android source in Ubuntu10.04 Platform)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: