The following tools are required to compile the Android system source code: git tool, Repo tool, Java SDK, and host compilation tool.
My experiment environment is Ubuntu 10.10. The steps are as follows:
1. Open terminal Input
Alex @ Alex-Linux :~ $ Sudo-I
Root @ Alex-Linux :~ $ Apt-Get install Git-core flex bison gperf libesd0-dev zip
Root @ Alex-Linux :~ $ Apt-Get install libwxgtk2.6-dev zlib1g-dev build-essential libstdc ++ 5
Root @ Alex-Linux :~ $ Apt-Get install tofrodos X-dev libx11-dev libncurses5-dev
Root @ Alex-Linux :~ $ Apt-Get install sun-java5-jdk
If the source cannot be found during the above process, see add ubuntu9.04 source in source configuration
2. Compile the Android system source code. We recommend that you use java5. if Java 6 is installed on the local machine, configure it to java5. You Need To uninstall java6.
Alex @ Alex-Linux :~ $ Apt-Get remove sun-java6-jdk
3. Configure the Java environment
Root @ Alex-Linux:/etc/Apt # Update-alternatives -- config Java
Select the path priority status
------------------------------------------------------------
* 0/usr/lib/JVM/java-6-openjdk/JRE/bin/Java 1061 automatic mode
1/usr/lib/JVM/Java-1.5.0-sun/JRE/bin/Java 53 manual mode
2/usr/lib/JVM/java-6-openjdk/JRE/bin/Java 1061 manual mode
3/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 manual mode
Select 1
4. the source code of the Android system needs to compile the host tool during the compilation process, so the host needs to call the GCC tool chain. for compiling the target file, Android integrates the GCC cross-compilation tool chain in the prebuilt directory. Repo is a tool used to encapsulate and install repo.
Alex @ Alex-Linux :~ $ Sudo-I
Root @ Alex-Linux :~ # Cd/bin
Root @ Alex-Linux:/bin # curl http://android.git.kernel.org/repo> ~ /Bin/Repo
If you are prompted that curl is not installed, enter sudo apt-Get install curl
Set the executable permissions for bin/Repo. Alex @ Alex-Linux :~ /Bin $ chmod A + x ~ /Bin/Repo
5. Download the android source code Code The library path is android.git.kernel.org. You can view the content of the code library on the webpage. Create androidsource in the user's home directory to enter this directory
Alex @ Alex-Linux :~ /Androidsource $ repo init-u git: // android.git.kernel.org/platform/manifast.git
When your name [XXX] appears:
Your email [xxx@xnadevelop.com]: Enter the corresponding user name and email, after repo init, execute repo sync to download the Android system source file
It takes a long time. Please be patient.
Enter make in the directory where the source code is downloaded.
. It takes a long time. Please wait.
Finally, output the text.
Target sharedlib: sensors. mahimahi (Out/target/product/generic/obj/shared_libraries/sensors. mahimahi_intermediates/linked/sensors. mahimahi. So)
Target non-prelinked: sensors. mahimahi (Out/target/product/generic/symbols/system/lib/HW/sensors. mahimahi. So)
Target Strip: sensors. mahimahi (Out/target/product/generic/obj/lib/sensors. mahimahi. So)
Generated: (Out/target/product/generic/android-info.txt)
Target System FS image: Out/target/product/generic/obj/packaging/systemimage_intermediates/system. img
Install system FS image: Out/target/product/generic/system. img
Target RAM disk: Out/target/product/generic/ramdisk. img
Target userdata FS image: Out/target/product/generic/userdata. img
Installed file list: Out/target/product/generic/installed-files.txt