admin管理员组

文章数量:1614268

一、下载源码

以下载源码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" //设置邮箱

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

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

3、PATH=~/bin:$PATH

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

4、curl https://storage-googleapis.lug.ustc.edu/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/git-repo'

7、repo init -u https://aosp.tuna.tsinghua.edu/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/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   

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

   Hostname ssh.github  

   PreferredAuthentications publickey  //采用公匙

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

   Port 443            //修改端口为443

  保存退出再重新git clone
 


    
   
 

本文标签: 内核源码系统