android点滴(16)--ubuntu下android源代码以及内核的获取

---------------------------------------------------- 誑逩の蝸犇 : I believe Nothing is impossible. ---------------------------------------------------- 

 

android源码的获取
1.安装git,curl

sudo apt-get install git
sudo apt-get install curl

2.新建一个目录android,在这个目录下建立bin,kernel,source三个子目录。bin用来存放repo,kernel用来存放android内核源代码,source目录用来存放android源代码。

3.输入
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

添加环境变量

 

PATH=/root/android/bin:$PATH
 

 

$ chmod a+x /root/android/bin/repo

4.切换到source目录,输入
$ repo init -u https://android.googlesource.com/platform/manifest
如果是获取一个分支的源代码则输入
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
-----------------------------------------------------------

可用的分支(部分)

 

[new branch]      android-2.1_r2.1s -> origin/android-2.1_r2.1s
 * [new branch]      android-2.2.1_r1 -> origin/android-2.2.1_r1
 * [new branch]      android-2.2.1_r2 -> origin/android-2.2.1_r2
 * [new branch]      android-2.2.2_r1 -> origin/android-2.2.2_r1
 * [new branch]      android-2.2.3_r1 -> origin/android-2.2.3_r1
 * [new branch]      android-2.2.3_r2 -> origin/android-2.2.3_r2
 * [new branch]      android-2.2_r1 -> origin/android-2.2_r1
 * [new branch]      android-2.2_r1.1 -> origin/android-2.2_r1.1
 * [new branch]      android-2.2_r1.2 -> origin/android-2.2_r1.2
 * [new branch]      android-2.2_r1.3 -> origin/android-2.2_r1.3
 * [new branch]      android-2.3.1_r1 -> origin/android-2.3.1_r1
 * [new branch]      android-2.3.2_r1 -> origin/android-2.3.2_r1
 * [new branch]      android-2.3.3_r1 -> origin/android-2.3.3_r1
 * [new branch]      android-2.3.3_r1.1 -> origin/android-2.3.3_r1.1
 * [new branch]      android-2.3.4_r0.9 -> origin/android-2.3.4_r0.9
 * [new branch]      android-2.3.4_r1 -> origin/android-2.3.4_r1
 * [new branch]      android-2.3.5_r1 -> origin/android-2.3.5_r1
 * [new branch]      android-2.3.6_r0.9 -> origin/android-2.3.6_r0.9
 * [new branch]      android-2.3.6_r1 -> origin/android-2.3.6_r1
 * [new branch]      android-2.3.7_r1 -> origin/android-2.3.7_r1
 * [new branch]      android-2.3_r1 -> origin/android-2.3_r1
 * [new branch]      android-4.0.1_r1 -> origin/android-4.0.1_r1
 * [new branch]      android-4.0.1_r1.1 -> origin/android-4.0.1_r1.1
 * [new branch]      android-4.0.1_r1.2 -> origin/android-4.0.1_r1.2
 * [new branch]      android-4.0.2_r1 -> origin/android-4.0.2_r1
 * [new branch]      android-4.0.3_r1 -> origin/android-4.0.3_r1
 * [new branch]      android-cts-2.2_r8 -> origin/android-cts-2.2_r8
 * [new branch]      android-cts-2.3_r10 -> origin/android-cts-2.3_r10
 * [new branch]      android-cts-2.3_r11 -> origin/android-cts-2.3_r11
 * [new branch]      android-cts-4.0_r1 -> origin/android-cts-4.0_r1
 

 

 

-----------------------------------------------------------

 

 

-b后面为分支的版本

5.输入 $ repo sync

在这个过程中要输入用户名和邮箱,随便输入一下就好了



android kernel的获取
1.切换到kernel目录,输入
$ git clone http://Android.git.kernel.org/kernel/common.git

2.下载完后,什么都看不到,这是切换到kernel下的common目录,输入
$ git branch -a
查看内核版本分支

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/android-2.6.39
  remotes/origin/android-3.0
  remotes/origin/master

3.输入
$ git checkout  remotes/origin/android-3.0获取分支



其他有用命令
将origin这个版本库的代码更新到本地的master主枝:
$ git pull origin master

将本地的代码更新到名为orgin的远程版本库中:
$ git push origin


http://source.android.com/source/downloading.html

 

你可能感兴趣的:(android)