来源:http://blog.csdn.net/zeroboundary/article/details/17555183

android最新源码(4.4.2_r1版本以上)下载

参考:http://source.android.com/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.googleapis.com/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.googlecode.com/files/repo-1.12 > ~/bin/repo

我是用在http后面加了个s下载的1.20,居然可以,没有其他版本出的错误

$      curl https://commondatastorage.googleapis.com/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.googlesource.com/platform/manifest

或者像这样取得某个分支如android-4.4.2_r1

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

如果需要下载其他分支将android-4.4.2_r1改成其他分支名称就可以了。分支名称请在https://android.googlesource.com/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.googlesource.com/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.

2. kernel下载
            内核的下载不需要repo这个工具,仅仅使用git的clone命令就可以了,不过一样面临地址被封需要绕过的问题。kernel代码大概600多M,比较小一点。
            $ git clone https://android.googlesource.com/kernel/common.git kernel
            命令行最后面的kernel的意思是保存在这个文件夹下,所以可以自行命名,系统会帮你创建出来的
            当然,还有其他的内核可以下载,从字面上看,msm应该是针对高通芯片的,omap是针对TI芯片的,samsung是针对三星芯片,tegra则是nVidia公司的芯片。
            $ git clone https://android.googlesource.com/kernel/goldfish.git
            $ git clone https://android.googlesource.com/kernel/msm.git
            $ git clone https://android.googlesource.com/kernel/omap.git
            $ git clone https://android.googlesource.com/kernel/samsung.git
            $ git clone https://android.googlesource.com/kernel/tegra.git

下载完了之后可以用ls命令看一下,是不是kernel没看到任何代码?试着运行一下git的列出分支命令
            $ git branch -a,你会看到一系列分支,其中打*的分支是当前分支(刚下载完就是master啦),这个时候你切换一下分支,切换到你想要的分支代码就会出现了,我使用的是remotes/origin/android-2.6.39分支

最后一点,如果需要代码和kernel同时下载,在./repo/manifests/default.xml文件中增加如下语句:
            <project path="kernel/common" name="kernel/common" revision="android-2.6.39"/>

android最新源码(4.4.2_r1版本以上)下载相关推荐

  1. quado编辑Android代码步骤,Ubuntu11.10下编译android内核源码

    编译android源码时并不会自动编译android内核,因此需要手动编译这部分代码.编译内核所用的时间比编译android源码要少得多,只需一会就编译完成. 1.确定内核版本 进入存放android ...

  2. android系统源码7.1.2_r8下载,编译,运行到nexus5X上,修改源码并编译SDK进行测试

    一,学习android系统源码下载,编译的作用 1,可以自己 DIY 自己的rom系统,从系统层面,宏观的加深理解 android系统 2,编译自己的 userdebug(原生root权限) rom, ...

  3. 完美高仿精仿京东商城手机客户端android版源码

    转自http://blog.csdn.net/xiaocnblogs/article/details/45815445, 完美高仿精仿京东商城手机客户端android版源码,喜欢的朋友可以下载吧. 源 ...

  4. [转]2014年最新810多套android源码2.46GB免费一次性打包下载

    转载自:http://www.eoeandroid.com/thread-497046-1-1.html 感谢该博客主人无私奉献~~ 下面的源码是从今年3月份开始不断整理源码区和其他网站上的安卓例子源 ...

  5. 转--2014年最新810多套android源码2.46GB免费一次性打包下载

    转载自:http://www.eoeandroid.com/thread-497046-1-1.html 感谢该博客主人无私奉献~~ 下面的源码是从今年3月份开始不断整理源码区和其他网站上的安卓例子源 ...

  6. 2014年最新720多套Android源码2.0GB免费一次性打包下载

    之前发过一个帖子,但是那个帖子有点问题我就重新发一个吧,下面的源码是我从今年3月份开始不断整理源码区和其他网站上的android源码,目前总共有720套左右,根据实现的功能被我分成了100多个类,总共 ...

  7. 小程序源码:全网独家小程序版本独立微信社群人脉系统社群空间站最新源码开源+详细教程

    功能介绍: 1.微信社群是一个集发布.展示社群信息.人脉推广的裂变工具/平台. 2.通过人脉广场,将商家信息通过名片进行展示,让资源对接.人脉推广更加便捷高效.为平台带来更多流量,让平台更有价值. 3 ...

  8. 你要的开源报修系统V2版本已发布,请及时更新最新源码。

    开源报修系统V2版本 开源报修管理系统V2版本,后台采用flask框架+layui实现,前台采用原声微信小程序框架编写,V2版本在V1版本基础上扩展,功能更加丰富. 文章目录 开源报修系统V2版本 1 ...

  9. 自编译x86 openwrt固件,基于L大12.7日最新源码,精简版本

    自编译x86openwrt固件,精简版本,基于L大12.7日最新源码,仅仅适用于软路由,其他硬路由器不能刷入.精简了部分功能,保留了一些好玩的服务,适合轻度使用或者单做旁路实现部分特殊功能使用,简单稳 ...

最新文章

  1. 「2019嵌入式智能国际大会」 399元超值学生票来啦,帮你豪省2600元!
  2. 虚拟机无法上网/连接失败原因及解决方法
  3. mknod创建设备(加载新的设备驱动时候,通常会用到此命令)
  4. 关于Xcode6编译Pods工程出错问题
  5. 201671010135 2016--2017java程序设计对java的初步认识和对第一,二章的总结(0)
  6. css鼠标变成小手_技巧篇:CSS高级技巧详解
  7. (三)重构ResNet50以诊断COVID-19
  8. mysql order by 固定_MySQL 强制操作以及order by 使用
  9. 非负矩阵分解 NMF(Non-negative Matrix Factorization )
  10. Dev ChartControl
  11. Jensen不等式讲解与证明
  12. 软件测试好书推荐《自动化测试实践》30个项目测试案例分析
  13. Puzzle UVA - 227 谜题
  14. python 相关系数矩阵_用numpy计算Pearson相关系数
  15. 系列篇|一文尽览事件相机原理
  16. 帝国cms 自动生成html,帝国cms二次开发用户访问自动生成html
  17. betterscroll的使用
  18. 初识flowable工作流-实现简单请假流程SpringBoot+VUE
  19. fMRI预处理-DPABI
  20. 未来大数据就业情况分析

热门文章

  1. python使用pip命令自动下载安装库
  2. php 截取逗号前字符串,php如何截取逗号之前的字符
  3. android 视频直播SDK
  4. javax.net.ssl.SSLHandshakeException: Unacceptable certificate: CN=GeoTrust SSL C
  5. 深圳非全日制计算机专业院校,深圳非全日制研究生招考院校
  6. 互联网晚报 | 9月16日 星期四 | 网易云音乐发布“村民证”;阿里社区电商品牌升级为“淘菜菜”;高德打车上线“实景上车点”
  7. Vue 项目中实现的微信、微博、QQ空间分享功能(亲测有效)
  8. alpha和color key
  9. java socket 加密,Java socket通信实现DES加密与解密
  10. Docker容器下mysql数据库权限Access denied for user ‘‘@‘172.17.0.1‘ (using password: YES)