下载 Android源码 + kernel源码 | 100%顺利完成

来源:互联网 发布:mysql表分区缺点 编辑:程序博客网 时间:2024/05/22 00:26

先照我博客A10专栏里面安装编译服务器描速一样,把源(/etc/apt/sources.list)备份并改好

step1、将Android-4.0.1_r1源码下载到/root/bin/android_source目录


>cd ~

>ls

>mkdir bin //若无bin目录,则创建

>cd bin

>touch repo

>chmod 777 repo

>curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo  //若几次都提示:“(7) Failed to connect to 2404:6800:4005:c00::5b: 网络不可达”,那就用下面的网络路径

>curl http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo > ~/bin/repo

==========================================================================================================================

以下这一部分可以跳过:

//使用浏览器登录https://android.googlesource.com/new-password, 使用自己到gmail帐号登录,点击网页上到“允许访问”,会得到如下信息:

Login for Git:

Username: git-XXX.gmail.comPassword: 1/w1m1wNjI6XD55_TdSWQhkYZwa7bz5PPWcOlHfAdzK10

Staying Authenticated:

To stay authenticated by saving the password, append the following line to the ~/.netrc configuration file:

machine android.googlesource.com login git-wgembed.gmail.com password 1/w1m1wNjI6XD55_TdSWQhkYZwa7bz5PPWcOlHfAdzK10machine android-review.googlesource.com login git-wgembed.gmail.com password 1/w1m1wNjI6XD55_TdSWQhkYZwa7bz5PPWcOlHfAdzK10
根据自己到登录帐号,拷贝自己帐号登录后所获得到以上以machine开头到两行信息,追加到~/.netrc文件到结尾。

>ls .netrc

>touch .netrc //若不存在该文件,新建一个

>chmod 777 .netrc

>gedit .netrc //粘贴以上拷贝到信息并保存


/*

以上写入两行machine到.netrc文件,以免下载过程中出现fatal: HTTP request failed

而将环境变量到临时修改和repo到连接地址初始化直接写在.sh文件中,这样就可以在多个终端页中同时下载时不必手动输入,这里到脚本保证下载失败后会在超时3秒后继续下载,直到下载完成为止

请注意repo init -u https://androdXXX/a/platrXXX,多了一个a目录,原本下载地址很难下载下来,这样就能顺利下载下来

多终端页中运行脚本会提示输入用户名和邮箱地址等信息,随便输入即可:

.repo/manifests/: discarding 60 commits

Your Name  [root]: root
Your Email [root@vm.(none)]: XXX@gmail.com

Your identity is: root <XXX@gmail.com>
is this correct [y/N]? y

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)? white

repo has been initialized in /root/bin/android_source

*/
==========================================================================================================================

>mkdir android_source

>cd android_source

>touch sync_android_source.sh

>chmod 777 sync_android_source.sh

>gedit sync_android_source.sh

//将以下代码拷贝到该脚本并保存

注意:以repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread替换下面的
repo init -u https://android.googlesource.com/a/platform/manifest -b android-4.0.1_r1

#!/bin/bashPATH=~/bin:$PATHrepo init -u https://android.googlesource.com/a/platform/manifest -b android-4.0.1_r1repo syncwhile [ $? != 0 ]; doecho "***Error: sync failed, re-sync again***"sleep 3repo syncdone

>./sync_android_source.sh

step2、将kernel3.4的源码下载到/root/bin/kernel
>cd bin/
>mkdir kernel
>cd kernel/
>git clone https://android.googlesource.com/kernel/common.git //等待下载完成

//导出自己需要的linux3.4版分支
>cd common/
>git branch -a
>git checkout -b android-3.4 remotes/origin/android-3.4

原创粉丝点击