Android mirroring help
Note: This image is an AOSP image, and Android SDK cannot provide image services due to copyright reasons.
Visit https://cs.android.com or Android Open Source Project · GitHub to search and browse AOSP source code online.
Refer to the Google tutorial https://source.android.com/setup/build/downloading , just https://android.googlesource.com/
use all of https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/
them instead.
Since using the HTTPS protocol is safer and more convenient for us to handle flexibly, it is strongly recommended to use the HTTPS protocol to synchronize the AOSP image.
Due to the heavy CPU/memory load caused by AOSP mirroring, we have limited the number of concurrency, so it is recommended to:
- When syncing, the concurrency number should not be too high, otherwise a 503 error will appear, that is, the
-j
following number should not be too large, and it is recommended to choose 4. - Please try to choose staggered peak synchronization when the traffic is small.
process excerpt
(Refer to AOSP(Android) image usage help - written by LUG @ USTC)
Download the repo tool:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Or use tuna's git-repo mirror
Use monthly updated init packs
Since the first synchronization needs to download about 95GB of data, any network failure during the process may cause the synchronization to fail. We strongly recommend that you use the initialization package for initialization.
Download https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar , remember to check it according to the content of checksum.txt after the download is complete.
Since all the codes are checked out from the hidden .repo
directory, we only keep .repo
the directory, and after downloading, unzip it again repo sync
to get the complete directory.
The method of use is as follows:
wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar
cd AOSP # 解压得到的 AOSP 工程目录
# 这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
repo sync # 正常同步一遍即可得到完整目录
# 或 repo sync -l 仅checkout代码
After that, just run each time repo sync
to keep in sync. We strongly recommend that you keep syncing every day, and try to choose low peak times such as early morning
traditional initialization method
Create a working directory:
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
Initialize the repository:
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest
If you are prompted that you cannot connect to gerrit.googlesource.com, please refer to the update section of the git-repo help page .
If you want a specific Android version ( list ):
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-4.0.1_r1
Synchronize the source tree (you only need to execute this command to synchronize in the future):
repo sync
create secondary mirror
Due to the huge demand for AOSP mirroring, and the Git service occupies more resources, the load generated by AOSP on the TUNA server has already accounted for the main part. If you are a team user, we strongly recommend that you create a secondary image through TUNA, and then share it with other users in the team to reduce the pressure on the TUNA server. It takes about 460G disk to build AOSP image.
The specific steps are:
Download repo
tools and create a working directory (omitted)
initialization:
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/mirror/manifest --mirror
Finally synchronize the source tree:
repo sync
After the synchronization is complete, run git daemon --verbose --export-all --base-path=WORKING_DIR WORKING_DIR
( WORKING_DIR
for the directory where the code tree is located).
After that, other users git://ip.to.mirror/
can use it as a mirror image.
Replace the remote of the existing AOSP source code
If you have obtained the source code of AOSP in some way (or you just finished the init step), and you want to synchronize the AOSP part of the code through TUNA in the future, you only need to modify .repo/manifests.git/config
the
url = https://android.googlesource.com/platform/manifest
change to
url = https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest
Or you can execute without modifying the file
git config --global url.https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/.insteadof https://android.googlesource.com
FAQ
- What is mirrored?
- AOSP's git repository
- Why can't I access it through a browser?
- There is no gitweb for the time being, and it is a git bare warehouse anyway, so there is no content that can be seen directly.
- It is recommended to visit https://cs.android.com or Android Open Source Project · GitHub to search and browse the AOSP source code online.
- What should I do if it appears
curl: (22) The requested URL returned error: 404 Not Found Server does not provide clone.bundle; ignoring.
?- Just ignore it.
- 参见:AOSP clone bundle · Issue #936 · tuna/issues · GitHub