標籤:export 特定 http 內容 構建 串連不上 use 提示 err
分為4個流程
- 源碼下載
- 構建編譯環境
- 編譯源碼
- 運行
源碼下載安裝git並且配置
//安裝gitsudo apt-get install git//配置git名稱和郵箱git config --global user.name "your name"git config --global user.email "[email protected]"
建立repo的bin目錄和源碼目錄
建立repo的bin目錄
midir ~/bin
建立源碼目錄
midir ~/source
安裝repo
由於在採用網上常見的安裝repo方法時,出現了Cannot get http://gerrit.googlesource.com/git-repo/clone.bundle異常,通過網上搜尋,原因是repo需要更新自身項目時,串連不上項目本身的git倉庫,在此,採取了手動拉取repo最新項目的方式
從git上拉取repo項目
git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
將git-repo裡面的repo檔案複製到~/bin目錄
在~/source目錄建立.repo檔案夾,把git-repo重新命名為repo複製到.repo目錄下
將~/bin/repo 添加到環境變數,並賦予許可權
//賦予許可權chmod a+x ~/bin/repo//添加到環境變數將export REPO=~/bin 添加到~/.bash_profile///讓設定檔生效source ~/.bash_profile
下載源碼初始化倉庫
cd到~/source目錄,執行以下命令
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
或者這個命令
repo init -u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest
兩者實現的效果一致,僅僅只是協議不同.
如果執行該命令的過程中,如果提示無法串連到 gerrit.googlesource.com,那麼我們只需要編輯 ~/bin/repo檔案,找到REPO_URL這一行,然後將其內容修改為:
REPO_URL = ‘https://gerrit-google.tuna.tsinghua.edu.cn/git-repo‘
然後重新執行上述命令即可.
補充說明
不帶參數的manifest命令用於擷取master上最新的代碼,但是可以通過-b參數指定擷取某個特定的android版本,比如我們想要擷取android-4.0.1_r1分支,那麼命令如下:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1
(AOSP項目當前所有的分支列表參看:分支列表)
同步代碼
命令如下
repo sync
Ubantu16.04進行Android 8.0源碼編譯