When we download Android source code, we use “repo sync” command. It takes long time. I show you the tips about “repo sync” to save time.
(Japanese version)
Reducing amount of download size by copying the existing repository
If you have already downloaded old source code (for example, android-2.2_r1.1), you can reduce amount of newly download size to use old repository. so you download only the difference.
$ mkdir android-2.3 $ cd android-2.3/ $ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.3.4_r1 $ cp -R ../android-2.2_r1.1/.repo/projects .repo/ $ repo sync
If you can overwrite the existing working directory,
$ mv android-2.2_r1.1 android-2.3 $ cd android-2.3 $ repo init -b android-2.3.4_r1 $ repo sync
I got this knowledge from Google group of Android Building(how do I switch branches by repo).
Option to run repo sync parallely
“make” command has ‘-j’ option to run multi jobs parallely. “repo sync” has similar option, too.
Let’s examine command line help.
$ repo sync -h
Usage: repo sync [...]
Options:
-h, --help show this help message and exit
-f, --force-broken continue sync even if a project fails to sync
-l, --local-only only update working tree, don't fetch
-n, --network-only fetch only, don't update working tree
-d, --detach detach projects back to manifest revision
-q, --quiet be more quiet
-j JOBS, --jobs=JOBS number of projects to fetch simultaneously
-s, --smart-sync smart sync using manifest from a known good build
repo Version options:
--no-repo-verify do not verify repo source code
$
If you want to run 4 fetching jobs pararellely,
$ repo sync -j4
This can reduce the download time. However, be sure not to occupy the bandwidth of the network.
Related pages
Quick hack to run Android 2.3(Gingerbread) on KZM-A9-Dual board
Pingback: Quick hack to run Android 2.3(Gingerbread) on KZM-A9-Dual board « Koba's blog
Pingback: Android Source Tree building environment «
Thanks for the tip on copying existing files.
I’ve been looking for a way to avoid the hours of download time when repo sync crashes on the 1GB android/prebuilt project and has to redownload hundreds of MB from the same project, again and again.
Worked great!
Appreciate you posting. I’ve looked for a solution for this many times, and this is the first thing I’ve found which helps.
This is great! save me lots of time
you can use
repo sync -c
Refer following for adding a reference to existing android repo to sync quickly:
http://xda-university.com/as-a-developer/repo-tips-tricks
Nice post!! To speed up repo sync use these tips http://goo.gl/gzRM6m