Use git to download the source code.
Download, compile, and test Android source code
1. Configure the Android source code download environment
①. Before downloading, you must perform some commands on the Linux terminal to configure the download environment.
Create a directory command to hold the download script file (repo): #mkdir ~/bin #PATH =~/bin: $PATH "
②. Download repo script file (for downloading Android source code)
#curl address > ~/bin/repo
#chmod a+x ~/bin/repo
③. Creating a directory to hold Android source code
#mkdir android_source#
#cd Android_source
④. Initialization
#repo Init-u Address
⑤. Start downloading Android source code
#repo Sync
2, Android source code directory structure analysis
In addition to the makefile file, all the others are directories. These directories hold different sub-projects of the Android source code, respectively.
3. Download part of the Android source code
There are two ways to download a subproject in the Android source code:
Method One: Use the Repo Sync command
Method Two: Use the git clone command
4. Compiling Android source code
First step: Initializing the compilation environment
Step Two: Select the target (set the compilation target using the lunch command)
Step three: compiling Android source code
5, Out directory structure analysis
The Out directory is the default directory that holds the target files generated by the compiled Android source code.
6. Publish your apk as an Android built-in program
Test the system.img file. Embed a self-generated APK program into the system.img file.
7. Test system.img file with simulator
Second, the core steps of downloading and compiling the Linux kernel source code:
1. Download the Linux kernel source code
Directory structure of 2.Linux kernel source code
3. Install the Android kernel's build environment
The first step: getting Ready for work
Step two: Unzip the compiler
Step three: Verify that the Cross compiler is installed successfully
Fourth Step: Install LIBNCURSES5
4. Configuring and compiling the Linux kernel
Some of the above is my book in the process of writing some of the essays will be written in more detail, some more brief. The main content of this chapter is to understand the actual operation of the various steps and some important instructions. For the actual operation of the process in the notebook encountered some problems in Baidu have some solution, this in the previous configuration of the Linux environment encountered a variety of problems, and then through the Baidu search solution, we all have a lot of experience.
The fourth chapter: download and compile the source code