Android source code including application source code, SDK toolset and NDK toolset, etc., how to download? See:
Configure the Android source code download environment:
Create a directory to hold the download script file (repo)
# mkdir ~/bin
# Path=~/bin: $PATH
Download Rope script File
# Curl Https://dl-ssl.google.com/dl/googlesource/git-repo > ~/bin/repo
# chmod A+x ~/bin/repo
Create a directory to hold Android source code
# mkdir Android_source
# CD Android_source
Initialization
# Repo Init–u https://andriod.googlesource.com/platform/manifest
Start downloading Android source code
# Repo sync all Android source code
# repo sync platform/bootable/recovery Download only recovery project part of the source code
# git clone https://android.googlesource.com/<project name> only download <> content about the project name can be viewed in manifest.xml under the. repo file.
Compiling Android Source code:
Initialization
# source build/envsetup.sh OR #. build/envsetup.sh
Select target
# Lunch Full-eng
Compiling Android source code
# make
Embed your own apk file in the system.img, allowing the application to be root protected
Just copy the apk file to the System/app directory and regenerate the sysrem.img file from the system directory. When you build an. img file, package the system directory with the Mkyaffs2image command-line tool, with the following package commands and test commands:
# Mkyaffs2image System system.img
# EMULATOR–AVD Myavd–system System.img–data userdata.img
Install the Android kernel's build environment
Download Linux kernel source code:
# git clone https://android.googlesource.com/kernel/common.git
Enter the extracted Linux kernel source root directory under the makefile file, open and find the variable arch and cross_compile, set their values as follows:
ARCH? = Arm
cross_compile?= arm-none-linux-gnueabi-
Download compiler arm-linux-gcc-4.3.2.tgz and arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2 to working directory and unzip: # tar ZXVF Arm-linux-gcc-4.3.2.tgz–c/
# tar JXVF arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2–c/
Verifying the installation compiler results
# ls/usr/local/arm-l
Installing LIBNCURSES5
# Apt-get Install Libncurses5-dev
Configuring and compiling the Linux kernel
Configure the Linux kernel (must be executed in the Linux source root directory):
Make config: Configure in text form
Make Menuconfig: Configure with character interface style
Make Oldconfig: ibid. config but gives more default values and is more concise to configure.
Make Xconfig: Configured with a graphical interface, QT installation is required:
# Apt-get Install Libqt4-dev
To compile the Linux kernel:
# Export Path=/root/compilers/arm-none-linux-gnueabi/bin: $PATH
# cd ~< kernel root directory >
# Make clean//clear most of the. O,. ko files generated by the compilation but retain the configuration file
# make
Testing the Linux kernel (generated zimage files):
# EMULATOR–AVD Myavd–kernel/root/kernel/goldfish/arch/arm/boot/zima
http://www.cnblogs.com/lv-peng/
13:05:30 2016-05-03
Download and compile the Android source code