By referring to the relevant information on the Internet, I compiled the Android source code steps are as follows:
- 1 My system is Ubuntu 8.04
- 2 The following tools must be installed on the system (from online sources):
sudo apt-get install build-essential
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install Libc6-dev
sudo apt-get install Flex
sudo apt-get install Bison
sudo apt-get install patch
sudo apt-get install Texinfo
sudo apt-get install Libncurses-dev
sudo apt-get install Git-core gnupg//(GNUPG system may be self-brought)
sudo apt-get install Flex Bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential Zip Curl
sudo apt-get install Ncurses-dev
sudo apt-get install Zlib1g-dev
sudo apt-get install valgrind (optional, 21M large, I think the average person is not used)
sudo apt-get install python2.5 (not actually installed, Ubuntu 8.04 already comes with it)
sudo apt-get install SUN-JAVA5-JDK
Attention:
A. Do not use SUN-JAVA6-JDK, otherwise in the Make SDK, specifically make Doc This step, encountered this error:
Docs DROIDDOC:OUT/TARGET/COMMON/DOCS/DX
Javadoc:error-in Doclet class Droiddoc, method start have thrown an
Exception java.lang.reflect.InvocationTargetException
Com.sun.tools.javac.code.symbol$completionfailure:class file for
Sun.util.resources.OpenListResourceBundle not found
B. The online information says that environment variables need to be set, but I do not set:
Export Android_java_home= $JAVA _home
C. There is no mention of installing Ncurses-dev on the Internet, but a compilation error will occur during my compilation before installation.
- 3 Set up the Android source storage directory
$ mkdir ~/OPEN_SRC
$ mkdir ~/open_src/android
$ CD ~/open_src/android
$ mkdir Bi
- 4 Download the repo script, put it in the ~/open_src/android/bin directory, add the executable right
$ curl http://android.git.kernel.org/repo > Repo
$ sudo mv repo ~/open_src/android/bin
$ sudo chmod a+x ~/open_src/android/bin/repo
- 5 Execute
$ ~/open_src/android/bin/repo init-u git://android.git.kernel.org/platform/in Source directory Android Manifest.git
//in the middle will be prompted to enter e-mail or something, if you plan to submit patches, Google accounts registered mailbox
- 6 Execute repo sync in the Android directory to start downloading the source code.
We can also copy the source code from other sources to the Android directory, and that's exactly what I did.
- 7 Compile the source code and get the ~/open_src/android/out directory
Execute the make command at the command line:
$make
This is a long process, wait ...
- 8 test Run
8.1 set the environment variable first:
Open the ~/.BASHRC file and add the following two lines at the end:
export path= $PATH: ~/open _src/android/out/host/linux-x86/bin
export android_product_out=~/open_src/android/out/target/ Product/generic
8.2 run emulator:
emulator--debug-init-skin qvga-l // You may be prompted unknown option:--debug-init, remove--debug-init to
or execute emulator directly, using the default skin
If you finally get into the system and see a large clock, the instructions are done.
- 9 Subsequent compilation:
Execute in Android directory first
$ . build/envsetup.sh
Then you'll have a few more available commands. After changing the contacts contact item, you can simply execute the command to compile the section separately:
$mmm packages/apps/contacts/
In order to be able to test the changes directly, a new system.img needs to be generated and executed in the Android directory:
$ make Snod
Of course, if you change the emulator or other peripheral related, not the inside of the system, it's not just to regenerate the system.img.
- The following is the final output after successful compilation:
Install:out/target/product/generic/system/xbin/scp
Notice File:system/extras/showmap/notice--out/target/product/generic/obj/notice_files/src//system/xbin/ Showmap.txt
Install:out/target/product/generic/system/xbin/showmap
Notice File:system/extras/showslab/notice--out/target/product/generic/obj/notice_files/src//system/xbin/ Showslab.txt
Install:out/target/product/generic/system/xbin/showslab
Notice File:external/sqlite/dist/notice--out/target/product/generic/obj/notice_files/src//system/xbin/ Sqlite3.txt
Install:out/target/product/generic/system/xbin/sqlite3
Notice File:external/dropbear/notice--Out/target/product/generic/obj/notice_files/src//system/xbin/ssh.txt
Install:out/target/product/generic/system/xbin/ssh
Install:out/target/product/generic/system/xbin/strace
Notice File:system/extras/su/notice--Out/target/product/generic/obj/notice_files/src//system/xbin/su.txt
Install:out/target/product/generic/system/xbin/su
Install:out/target/product/generic/system/xbin/timeinfo
Copy:out/target/product/generic/system/etc/apns-conf.xml
Copying:out/target/product/generic/obj/notice_files/src/kernel.txt
Finding NOTICE Files:out/target/product/generic/obj/notice_files/hash-timestamp
Combining NOTICE Files:out/target/product/generic/obj/notice.html
Gzip-c out/target/product/generic/obj/notice.html > out/target/product/generic/obj/notice.html.gz
ZIP-QJ Out/target/product/generic/system/etc/security/otacerts.zip build/target/product/security/ Testkey.x509.pem
Generated: (Out/target/product/generic/android-info.txt)
Target System FS Image:out/target/product/generic/obj/packaging/systemimage_unopt_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
- [email protected]: ~$
Share the entire process of compiling Android source code