repo/git Android/CyanogenMod srouce code

For getting the whole Android/CM rom source code,
1. get the repo first.
2. make sure the git is installed.

1. how to get the repo:
http://source.android.com/source/downloading.html#installing-repo
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
2. how to install git (Ubuntu):
apt-get install git-core git-svn gitk git-gui git-email gnupg

** other tools
sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl valgrind

** For Android rom:
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.1_r1 (the whole build)
** For CM rom:
https://github.com/CyanogenMod/android // Click "Fork" button, and copy the "HTTPS clone URL" for git.
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0    // Cm12的代码, 基于android5.0

repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0    // Cm11的代码, 基于android4.4, 大于23.4 GB

** Related URL:
https://github.com/username/android
http://source.android.com/source/using-repo.html

** Related Git:
git clone https://github.com/username/android_frameworks_native.git
git clone https://github.com/username/android.git
git clone https://android.googlesource.com/platform/prebuilt.git (but too big, 2.04GB)

参考文章:

http://my.oschina.net/tonywolf/blog/49214  //设置ndk, 编译环境Cygwin工具搭建及配置, 但android-ndk-r7b(自带toolchain, 不需要装cygwin)。

http://winuxxan.blog.51cto.com/2779763/502340  //Android环境搭建3 编译Android源码

http://bach-dream.iteye.com/blog/1333278  //GitHub使用(二)-- 从代码库下载代码到本地

http://conifertw1.blogspot.com/2014/10/build-android-source-codes.html  //Build Android source codes (looks on Mac PC)

** Sample for fetch CM 11 source code:

xxxxxx@xxxxxx-PC ~/test
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 24081  100 24081    0     0  14071      0  0:00:01  0:00:01 --:--:-- 19264

xxxxxx@xxxxxx-PC ~/test
$ chmod a+x ~/bin/repo

xxxxxx@xxxxxx-PC ~/test
$ PATH=~/bin:$PATH

or edit ~/.profile file
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
$ source ~/.profile


xxxxxx@xxxxxx-PC ~/test
$ git config --global user.email  "xxxxxx@gmail.com"

xxxxxx@xxxxxx-PC ~/test
$ git config --global user.name "xxxxxx"

xxxxxx@xxxxxx-PC ~/test
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

Your identity is: xxxxxx <xxxxxx@gmail.com>
If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white
  bold     dim      ul       reverse
Enable color display in this user account (y/N)? y

repo has been initialized in /home/xxxxxx/test

xxxxxx@xxxxxx-PC ~/test
$ ls -al
total 8
drwxr-xr-x+ 1 xxxxxx None 0 Mar 19 00:43 .
drwxr-xr-x+ 1 xxxxxx None 0 Mar 19 00:46 ..
drwxr-xr-x+ 1 xxxxxx None 0 Mar 19 00:46 .repo
xxxxxx@xxxxxx-PC ~/test
$ repo sync
原文地址:https://www.cnblogs.com/lionfight/p/4381029.html