下载编译android源代码

android

Posted by DYD on October 24, 2019

从清华源aosp上下android源代码,下android linux源代码

清华android源

虚拟机硬盘空间不够,添加新的硬盘,格式化,挂载,修改用户权限。

大概源代码有100多G,最少分配200G空间。

添加虚拟机硬盘教程

这里的/mnt/sdb是新挂载的硬盘修改属主

sudo chown -R 1000:1000 /mnt/sdb

下载repo文件

mkdir ~/bin
PATH=~/bin:$PATH
cd ~/bin
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod a+x ~/bin/repo

.zshrc中导入环境变量

export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

source一下zshrc

source ~/.zshrc

测试是否生效,echo $REPO_URL 显示刚设置的环境变量

新建代码仓

mkdir android && cd android

初始化仓库

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest

如果需要特定版本

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

如因网络中断,可用

repo sync

android 内核

git clone http://android.googlesource.com/kernel/goldfish.git