Official Tutorial Links
Https://source.android.com/source/downloading.html
Follow the official tutorials and come to me again.
1. Find a place big enough to create a folder (like Android) to store everything
Source is about 8G, different versions, various tools add up 20G I think it should be enough, but after the download size is 35G only source code ...
2. Installation Tool Repo
Setting up the installation directory bin
mkdir Bin
can choose to put in the ~ directory, so that the future is ~/bin
Download Repo tool, remember to give permission, this repo need python environment, but do not support python3.0+, here is python2.7.5
Curl https:///storage.googleapis.com/git-repo-downloads/repo > ~/bin/repochmod a+x ~/ Bin/repo
3. Initializing the Repo client
This is a setup authentication step and requires a Gmail account
Create a directory to act as a workspace, then enter, input the initialization command, if you do not have the environment variable, you need to use the full path such as Xx/bin/repo if there are multiple Python environments, you need to use such as python2.7 Xx/bin/repo
mkdir-u https://android.googlesource.com/platform/manifest
You will be prompted to enter your name and email with the Gmail account you prepared in front of you.
And then you can check
Repo init-u https://android.googlesource.com/platform/manifest-b android-4.0.1_r1
4. Login Authentication
Repo init-u https://android.googlesource.com/a/platform/manifest
Prompt for user name and password, if prompted fatal:remote error: login Https://android.googlesource.com/new-password Reset the password on it, This is a brand new username and password that should be generated automatically based on your account.
5. Save this user name and password
According to Https://android.googlesource.com/new-password this site above the hint, the user name and password to add to the ~/.NETRC, if there is no such file, you create a, location is still here, To ensure that you can add permissions chmod a+x ~/.NETRC If you do not do so, the user name and password that you need to enter during the download need to be entered manually (quite a lot)
6. Start the download
Sync
After the command input is finished, the brush screen is downloaded, and the next step is the waiting process (which is said to be open overnight)
After the end of the size of 35G
du--max-depth=1 .10696./Build33144./SDK4382528./Prebuilts9248./Docs45416./Developers120428./Development the./ out1204548./Frameworks52544./Hardware -./Libnativehelper46428./Libcore18360./Bionic12560./Art40076./Dalvik2912648./External126816./Device916./PDK434004./CTS11572./system234744./Tools4424./Bootable364508./Packages -./Abi78456./NDK25152888./. Repo35297360.
Gentoo download Android source code