android最新源码(4.4.2_r1版本以上)下载参考:http://source./source/downloading.html 红色字体表示多项选择中,我所做的选择
(我百度云盘地址:http://pan.baidu.com/s/1hqABuc8)
安装curl工具 $ sudo apt-get install curl
git工具的安装(按照如下方式安装最新版) 增加ppa $ sudo apt-add-repository ppa:git-core/ppa $ sudo apt-get update $ sudo apt-get install git git的版本号就是最新的 $ git --version git version 1.8.5.2 错误:sudo apt-add-repository ppa:git-core/ppa时出现错误:gpg: requesting keyE1DF1F24from hkp server keyserver.ubuntu.com / gpgkeys: HTTP fetch error 7: couldn't connect to host 原因:keyserver.ubuntu.com使用非标准的11371端口,而一般公司的防火墙都屏蔽掉了该端口,而允许标准的80端口。 所以可以以如下方式强行使用80端口添加软件源: $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 E1DF1F24 绿色部分是你要请求的Key.
repo工具的下载 google是这样告诉我们的: $ curl http://commondatastorage./git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo 但是好像是不能访问 解决方法:http://code.google.com/p/git-repo/downloads/detail?name=repo-1.12这个链接提供下载repo! 也可以通过下面命令得到: $ curl http://git-repo./files/repo-1.12 > ~/bin/repo 我是用在http后面加了个s下载的1.20,居然可以,没有其他版本出的错误 $ curl https://commondatastorage./git-repo-downloads/repo > ./repo 具体的repo版本可以去查看http://code.google.com/p/git-repo/downloads页面上的信息,下载那个版本都行。 修改执行权限 $ chmod a+x repo
repo init创建仓库 初始化android 源代码,下载最新代码 $ ./repo init -u https://android./platform/manifest 或者像这样取得某个分支如android-4.4.2_r1 $ ./repo init -u https://android./platform/manifest -b android-4.4.2_r1 如果需要下载其他分支将android-4.4.2_r1改成其他分支名称就可以了。分支名称请在https://android./platform/manifest/+refs里面查看branch
执行repo sync 进行同步 $ ./repo sync
使用repo sync同步下载代码时因为网络原因可能会经常断线,可以使用下面的脚本来做个脚本文件,让它中断后,又自动下载 创建脚本download.sh #!/bin/bash echo "=========start repo sync==============" ./repo sync while [ $? == 1 ]; do echo "======sync failed, re-sync again======" sleep 3 ./repo sync done chomd a+x download.sh让其可以运,然后终端输入./download.sh就可以开始下载了,用这一步代替官方文档里的repo sync。当连接不上终端时休息3毫秒然后再自动repo sync。
下载完成后,下一步就是编译了
补充: 对于我网盘下载的内容同步出源码的方法如下:
Usinga local mirror When using several clients, especially in situationswhere bandwidth is scarce, it is better to create a local mirror of the entire servercontent, and to sync clients from that mirror (which requires no network access).The download for a full mirror is smaller than the download of two clients, whilecontaining more information. These instructions assume that the mirror iscreated in /usr/local/aosp/mirror. The first step is to create and sync the mirroritself, which uses close to 13GB of network bandwidth and a similar amount of diskspace. Notice the --mirror flag, which can only be specified when creating a newclient: $ mkdir -p /usr/local/aosp/mirror $ cd /usr/local/aosp/mirror $ repo init-u https://android./mirror/manifest --mirror $ repo sync Once the mirror is synced, new clients can becreated from it. Note that it's important to specify an absolute path: $ mkdir -p /usr/local/aosp/master $ cd /usr/local/aosp/master $ repo init-u /usr/local/aosp/mirror/platform/manifest.git $ repo sync Finally, to sync a client against the server,the mirror needs to be synced against the server, then the client against the mirror: $ cd /usr/local/aosp/mirror $ repo sync $ cd /usr/local/aosp/master $ repo sync It's possible to store the mirror on a LAN serverand to access it over NFS, SSH or Git. It's also possible to store it on a removabledrive and to pass that drive around between users or between machines.
|
|