一、電腦配置
Ubuntu16.04 + 16G,硬盤的大小最好大于300G (我這邊是找了個(gè)win電腦裝了雙系統(tǒng) 沒(méi)有使用虛擬機(jī)的方式) 二、基礎(chǔ)環(huán)境配置
1、安裝git
sudo apt install git
配置git email和name
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
2、安裝依賴工具(需要確認(rèn)的就一直y就好)
sudo apt install git-core libssl-dev libffi-dev gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev libz-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
3、安裝python
執(zhí)行 python --version
可以看到ubuntu自帶的python版本是Python 2.7.12,這里我們需要再安裝一個(gè)python3
這里我是在下載文件夾打開(kāi)終端執(zhí)行下面命令進(jìn)行下載
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
下載完成后解壓
tar xvf Python-3.7.1.tgz
進(jìn)入解壓后的文件夾,編譯安裝python3
./configure
sudo make install
配置update-alternatives(用于處理 Linux 系統(tǒng)中軟件版本的切換,使其多版本共存)
sudo update-alternatives --install /usr/bin/python python python的安裝地址 權(quán)重號(hào)
我這邊根據(jù)安裝地址執(zhí)行下面命令
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.7 3
現(xiàn)在python2和python3都加入到update-alternatives工具了。
然后可以使用 sudo update-alternatives --config python
來(lái)選擇python版本
4、安裝openjdk 8
sudo apt-get install openjdk-8-jdk
到這里我們的基本環(huán)境配置已經(jīng)完成了,接下來(lái)開(kāi)始下載并編譯AOSP 源碼。
三、下載AOSP源碼
參考中科大AOSP鏡像使用文檔:https://mirrors.ustc.edu.cn/help/aosp.html
1、切換到用戶目錄下:cd ~
2、按照AOSP鏡像使用文檔輸入命令
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
如果在執(zhí)行curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
的時(shí)候失敗了可以直接通過(guò)瀏覽器下載,復(fù)制到bin/下面也是那一樣的。
接著執(zhí)行
mkdir aosp
cd aosp
指定版本代碼進(jìn)行倉(cāng)庫(kù)初始化
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-11.0.0_r45
如果提示無(wú)法連接到 gerrit.googlesource.com可以按照文檔編輯 ~/bin/repo,把 REPO_URL 一行替換成下面的:REPO_URL = ‘https://gerrit-googlesource.proxy.ustclug.org/git-repo’
再次執(zhí)行初始化倉(cāng)庫(kù)命令,會(huì)發(fā)現(xiàn)出現(xiàn)server certificate verification failed,如下
這時(shí)候我們可以關(guān)閉git的SSL校驗(yàn)
git config --global http.sslverify false
git config --global https.sslverify false
然后再次執(zhí)行初始化倉(cāng)庫(kù)命令,需要y的直接y就好。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-640641.html
最后執(zhí)行repo sync
完成源碼下載,下載的過(guò)程比較慢,如果中途失敗可以多嘗試幾次。到這里我們的源碼就下載完成了,接下來(lái)就是對(duì)源碼進(jìn)行編譯了文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-640641.html
到了這里,關(guān)于Android AOSP源碼編譯——AOSP下載(一)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!