(i) Download, compile and test Android source code
1. Configure the Android source code download environment
#mkdir ~/bin--Create a directory to hold the download script file
#PATH =~/bin: $PATH
#curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo--download Repo script file
#chmod a+x ~/bin/repo
#mkdir android_source--Create a directory to hold Android source code
#cd Android_source
#repo init-u https://android.googlesource.com/platform/manifest--Initialization
#repo sync--Start downloading the source code
2. Compiling Android source code
Initializing the compilation environment #source build/envsetup.sh or #.build/envsetup.sh--
#lunch full-eng--Set compilation target to Full-eng
#make or #make-j4--when there are multiple CPU cores, multiple simultaneous compilations can be made, reducing compilation time
Compilation Project: # CD/WORKING/ANDROID2.3.4_SCR
# source Build/envsetup.sh
# CD Packages/apps/calculator
# mm
or # CD/WORKING/ANDROID2.3.4_SRC
# build/envsetup.sh
#mmm Packages/apps/calculato
When the compilation is complete, an out directory is generated in the Android source code root, and all the compiled target files are in this directory
(ii) Download and compile the Linux kernel source code
1. Download the Linux kernel source code
# git clone https://android.googlesource.com/kernel/common.git
# git branch-a--see which remote repository is currently available
# git checkout-b android-3.0 remotes/origin/android-3.0--export Linux3.0 kernel
2. Install the Android kernel's build environment
To install the cross-compiler, refer to the second essay.
Configure the Linux kernel source code root directory under the makefile file, open the makefile copy, find arch and Cross_compile
ARCH =arm.
cross_compile?= arm-none-linux-gnueabi-
3. Configuring and compiling the Linux kernel
Assuming the Linux kernel source code directory is/root/linux_kernel, use the following command to compile the Linux kernel:
#export Path=/root/compilers/arm-none-linux-gnueabi/bin: $PATH
#cd ~/linux_kernel
#make Clean
#make
The 4 configuration commands must be executed in the Linux source code directory:
Make config configures the Linux kernel in text form;
Make menuconfig;
Make oldconfig requires user configuration with character interface;
Make xconfig with the Linux kernel in the form of a graphical interface;
Because the make Xconfig command forms a graphical interface using Qt's shared library, if you perform the make Xconfig command of Ubuntu Linux without Qt installed, you can install QT using the following command
#apt-get Install Libqt4-dev
After the Linux kernel is successfully compiled, a zimage file is generated in the <linux kernel source root directory >/arch/arm/boot directory, which is the binary version of the Linux kernel
With the source code, of course, also need to compile!!