您的位置:首页 > 移动开发 > Android开发

Android操作系统源代码下载方法

2013-10-30 21:19 232 查看

Android操作系统源代码下载方法

使用Ubuntu Liunx系统下载Android操作系统源代码,可以参考Andorid官方网站的下载说明:

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

源代码的站点:

https://android.googlesource.com/

1.安装命令行方式下工作的文件传输工具curl.

$ sudo apt-get install curl

2.开源的分布式版本控制系统git(Android项目使用git管理).

$ sudo apt-get install git

3.安装Repo命令行工具(Repo是Google开发的基于git更好管理Android项目的工具)

$ mkdir ~/bin

$ PATH=~/bin:$PATH

$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

4.初始化Repo客户端

$ mkdir android

$ cd android

$ repo init -u https://android.googlesource.com/platform/manifest


$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.3_r3.1

5.下载Android源代码树

$ repo sync

6.最好使用Google邮件验证身份后下载

打开页面http://source.android.com/source/downloading.html

点击The password generator

提示登录Google邮件帐号,出现密码验证的内容,按提示放到~/.netrc文件中.

$vi ~/.netrc

machine android.googlesource.com login git-xxxxxx.gmail.com password 1/AJr3XpWuDJGReV0eF24IWoRO6LSlJjfKzmwkuRDp

machine android-review.googlesource.com login git-xxxxxx.gmail.com password 1/AJr3XpWuDJGReV0eF24IWoRO6LSlJjfKzmwkuRDp

$ repo init -u https://android.googlesource.com/a/platform/manifest -b android-4.3_r3.1

$ repo sync



$ sudo sysctl -w net.ipv4.tcp_window_scaling=0

$ repo sync -j1

7.使用本地镜像的方法

创建和同步本地镜像

$ mkdir -p /usr/local/aosp/mirror

$ cd /usr/local/aosp/mirror

$ repo init -u https://android.googlesource.com/mirror/manifest --mirror

$ repo sync

通过镜像同步到主版本

$ mkdir -p /usr/local/aosp/master

$ cd /usr/local/aosp/master

$ repo init -u /usr/local/aosp/mirror/platform/manifest.git

$ repo sync

镜像通过远程服务器同步,主版本通过本地镜像同步

$ cd /usr/local/aosp/mirror

$ repo sync

$ cd /usr/local/aosp/master

$ repo sync
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: