1. How to download the Android source code environment
First step: Create a directory to hold the download script file repo
#mkdir ~/bin
#PATH =~/bin: $PATH
Step two: Download the repo script file (for downloading Android source code)
#curl Https://dl-ssl.goole.com/dl/goolesource/git-repo/repo>~/bin/repo
#chmod a+x ~/bin/repo
Step three: Create a directory to hold the Android source code
#mkdir Android_source
#cd Android_source
Part fourth: Initialization
#repo init-u https://android.goolesourse.com/platform/manifest
Fifth step: Start downloading the android source code:
#repo Sync
Meaning of the 2.Android source code directory
ADI: Application Binary interface
Bionic:c/c++ run-time library. A large part of the NDK program is called this program.
Bootable: For Android mount and startup programs
Brush Program: Recovery A file in a compressed package = a program that overwrites the system directory in the phone's memory
Build: File tools for programming Android source code and building system.img,ramdisk.img
CTS: Tools for compatibility testing
Dalvik:dalvik the source code of the virtual machine
Development: High-level development and commissioning tools
External: Source code for Extension tools
Framework:android framework layer source code. The source code of the Android SDK
Hardware: Hardware layer interfaces and libraries. Hal's source code is in this directory.
Libcore:java Core Library
Related source code for NDK:NDK
Packages: The source code of the app (APK program) released with the Android system
Prebuilts:android tools to use before compiling on various platforms
SDK: Tools for use in the development environment
System:android's basic system.
3. Download a section of the Android source code in the method:
① using the Repo Sync command
② using the git close command
4. Compiling Android source code
First step: Initializing the compilation environment
SOURCE build/envsetup.sh or:. build/envsetup.sh
MM and mmm two commands can be compiled in the Android source code specified in the project
The mm command must refer to the project's catalog for compilation
MMM can compile any specified project in any level of directory in the Android source code directory structure. As long as you specify the project path.
Step Two: Select the target:
To set the compilation target using the lunch command:
Lunch Full-eng
Step three: compiling Android source code
#make
#make-j4
5. Download the Linux kernel source code:
#git Clone Http://android.goolesoure.com/kernel/common.git
#git branch-a
#git clone http://android. Goolesource.com/kernel/goldfish.git
#git Checkout-b android-goldfish-2.629remotes/origin/android-goldfish-2.6.29
The meaning of the 6.Linux kernel source code directory:
Arch: Source code and configuration files related to CPU architecture
Block: Some device drivers
Crypto: A program to implement a CRC check algorithm for cryptographic decryption
Documentation for the Documentation:linux kernel
Driver: Device driver
Firmware: Some implementation codes for the device firmware to be used by the driver
FS: Implementation code for various file systems. Each directory corresponds to a file system implementation
Include: Contains all the header files required for the Linux kernel. Platform-Independent header files in the Include/linux directory are associated with the platform-related header files in the appropriate subdirectories.
Init: Initializes the implementation code of the kernel program. These programs can pass boot parameters to the Linux kernel
Ipc:linux implementation code for inter-process communication
Kernel: Implementation code for kernel management that is not related to CPU architecture. CPU-related architecture is placed in the arch/<cpu>/kerne/directory
Some libraries used by the Lib:linux kernel
MM: is an architecture-independent implementation code for memory management. Architecture-related memory management implementation code in the appropriate subdirectory of the Arch directory
NET: Implementation code of Network protocol
Samples: Some examples of kernel programming
Scripts: Configuring scripts for the Linux kernel
Security:linux implementation code for security enhancement tools
Sound: Drivers for audio Devices
Implementation code for some of the tools Tools:linux comes with
The implementation code for the Usr:gen_init_cpio command. Gen_init_cpio for integrated file system and Linux kernel
Virt: Implementation code for the kernel virtual machine
8. Cross compiler: Compile programs on the CPU of a architecture that can run on the B-schema CPU
9. Install the cross-compiler:
First step: Prepare
Copy the Arm-liunx-gcc-4.3.2.tgz file and the arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2 file to the working directory
Step two: Unzip the compiler
#tar ZXVF arm-linux-gcc-4.3.2.tgz-c/
#tar JXVF arm-none-linux-gnueabi-arm-2008q3-for-linux.tar.bz2-c/
Step three: Verify that the Cross compiler is installed successfully
#ls/usr/local/arm-l
Fourth Step: Install Libncurses 5
#apt-get Install Libncurses5-dev
10.make mproper: Clears all files generated by the compilation + purge configuration file
11.make distclean:make mrproper+ Delete the backup files and patch files left by the editor
12. Configure the 4 commands that are executed by the Linux source root directory:
Make config: This command configures the Linux kernel in textual form.
Make Menuconfig: Configures the Linux kernel as a menu split from the character interface.
Make Oldconfig:make Oldconfig is similar to make config and requires user configuration on a character-by-interface basis. However, make oldconfig shows fewer configuration items than do config that require the user to participate.
Make Xconfig: Configure the Linux kernel as a graphical interface and install Qt:apt-get installation when you run this command Libqt4-dev
Fourth chapter source code download and compile