A Download, compile, and test Android source code:
Configure the environment for Android source code downloads:
1. Create a directory to hold the download script file (repo)
2. Download Repo script file
3. Create a directory to hold Android source code
4. Initialization
5. Start downloading Android source code
Android Source code directory structure parsing
Download part of the Android source code:
Method One: Use the repo Sync command;
Method Two: Use the git clone command;
Compiling Android Source code:
- Initialize the compilation environment: Perform either of the two commands on the Linux terminal.
#source build/envsetup.sh
Or
. build/envsetup.sh
2. Select target: Use the lunch command to set the compilation directory.
3. Compile the Android source code: Run the following command to compile the Android sources:
#make
Out Directory structure analysis:
The Out directory is the default directory that holds the target files generated by the compiled Android source code.
Publish your apk as an Android built-in program:
The simplest way to embed the APK program in a sysytem.img file is to copy the apk file to the Sysytem/app directory and then generate the System.img file from the system directory.
Two Download and compile the Linux kernel source code:
Download the Linux kernel source code: Execute the following command:
#git Clone Https://android.googlesource.com/kernel/common.git
The directory structure of the Linux kernel source code.
Install the Android kernel compilation environment:
Compiling the Linux kernel under Ubuntu Linux requires the installation of a cross compiler.
To configure and compile the 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
Fourth Reading notes