1. On a Linux terminal, run the following command to create an android directory under the user directory and enter the directory:
Flat view printing? 1 mkdir android
2 cd android
2. Create the bin directory in android to execute the command:
Flat view printing? 1 mkdir bin
3. Add it to the environment variable PATH (this step can be skipped and will be described in step 1 ):
Flat view printing? 1 PATH = ~ /Android/bin: $ PATH
4. Go to the bin directory, download the Repo script, and set it to executable:
Flat view printing? 1 curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> repo
2 chmod a + x repo
Wait a moment.
5. Create the source directory for storing the android source code in the android directory and initialize it:
Flat view printing? 1 repo init-u https://android.googlesource.com/platform/manifest
This command downloads all versions. You can also add parameters to the preceding command to specify the source code to be downloaded. For example:
Flat view printing? 1 repo init-u https://android.googlesource.com/platform/manifest-B android-4.0.3_r1
If the previous step 3rd is skipped, you need to change "repo" in the above command to "../bin/repo" so that the terminal can recognize the repo command.
6. the user name and email address are required. You can enter them randomly. If you want to submit a bug to google in the future, you need to enter a valid google account. If "repo initialized in/home/taskiller/android" is displayed, the initialization is complete and the source code can be downloaded.
7. In the source directory, enter the repo sync command to download the source code. This speed may take a long time.
8. If you only want to download the source code of the kernel, you can create the kernel directory after Step 1 and enter the directory:
Flat view printing? 1 mkdir kernel
2 cd kernel
Then, run the following command to download the file:
1 git clone https://android.googlesource.com/kernel/common.git
2 git clone https://android.googlesource.com/kernel/goldfish.git
3 git clone https://android.googlesource.com/kernel/msm.git
4 git clone https://android.googlesource.com/kernel/omap.git
5 git clone https://android.googlesource.com/kernel/samsung.git
6 git clone https://android.googlesource.com/kernel/tegra.git
This step can be done at the same time as the download source code. The kernel source code is much smaller than the complete source code, and the time required is much smaller. The downloaded files cannot be seen by using the ls command, because they are hidden by default. They are saved in a hidden file named. git and can be viewed through la-la.
The compilation of the android kernel and source code will be introduced later.
Readers can also refer to the official website: http://source.android.com/source/downloading.html
If not stated, the articles on this site are original articles of Taskiller