国内镜像下载Android10源码并编译(实测)

1.安装ubuntu,不会的百度,一大把。

2.安装编译环境必要软件

sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig 

3.python安装可能失败,建议单独安装

sudo apt-get install python

4.下载repo工具,打开Terminal输入命令

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

5.修改~/bin/repo下的REPO_URL字段为国内镜像

#全局搜索
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
#替换成国内镜像
REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'

6.初始化git仓库设置用户名和邮箱

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

7.创建存放源码的目录,并同步代码

mkdir android
cd android
~/bin/repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r41 --depth 1 --config
#同步远程代码
repo sync

8.拖执行报python错“/usr/bin/env: ‘python’: No such file or directory”,需要创建符号链接或者直接用安装的对应版本的python即可eg:

#方法1
#查看python2或者python3的位置,具体看自己的安装的版本
whereis python2 or whereis python3
#创建符号连接
sudo ln -s /usr/bin/python2 /usr/bin/python
or
sudo ln -s /usr/bin/python3 /usr/bin/python

#方法2
python2 ~/bin/repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r41 --depth 1 --config
or
python3 ~/bin/repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r41 --depth 1 --config

9.等待完成

10.开始编译

source build/envsetup.sh 
lunch aosp_arm-eng 
make -j8

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值