一、下载源码

以下载源码2.3.7版本为例

环境ubuntu14.04

1、安装git

     sudo apt-get install git

     git --version  //查看版本

     git config --global user.name "zhangsan"  //设置用户名

     git config --global user.email "zhangsan@163.com" //设置邮箱

     git config --list  //查看配置是否成功

2、在用户目录下面新建文件夹bin

3、PATH=~/bin:$PATH

     也就是让环境变量包含用户目录下的bin文件夹

4、curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo > ~/bin/repo

      到~/bin下可以看到有个文件repo,输入file repo可以看到文件的属性是个python脚本

5、chmod a+x ~/bin/repo

6、vi ~/bin/repo

    将里面的 REPO_URL 值改为 'https://gerrit-googlesource.lug.ustc.edu.cn/git-repo'

7、repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-2.3.1_r1

      初始化repo,用的是清华源,可以将android-2.3.1改成自己想要的版本如android-x.x.x

8、repo sync

     网络断了或者卡住了可以中断然后用这句可以恢复下载

结果:

 

二、下载内核

     mkdir kernel //文件夹用来存放内核

     cd kernel 

     git init //初始化代码库

     git clone https://aosp.tuna.tsinghua.edu.cn/android/kernel/goldfish.git

     cd goldfish

     git branch -a

     git checkout remotes/origin/android-goldfish-2.6.29//git库可根据需求进行替换,这里下载了模拟器内核

    如果git clone卡住很久不动,解决办法端口修改为443,如下:

    cd ~/.ssh/

    vim config //新建config文件

    在config文件中添加如下代码:

    Host github.com   

   User "zhangsan@163.com"    //github上的注册邮箱

   Hostname ssh.github.com  

   PreferredAuthentications publickey  //采用公匙

   IdentityFile ~/.ssh/id_rsa    //公匙文件路径

   Port 443            //修改端口为443

  保存退出再重新git clone
 


    
   
 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐