Ubuntu Linux下android源碼下載方法

來源:互聯網
上載者:User

1、在Linux的終端下,運行以下命令,在使用者目錄下建立一個android目錄,之後進入該目錄:
 
平板視圖列印?1 mkdir android 
 
2 cd android
 
2、在android下建立bin目錄,以執行其中的命令:
 
平板視圖列印?1 mkdir bin
 
3、並將其加入到環境變數PATH中(這一步是可以略過的,會在第5步中說明):
 
平板視圖列印?1 PATH=~/android/bin:$PATH
 
4、進入bin目錄,下載Repo指令碼,並將其設定為可執行:
 
平板視圖列印?1 curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > repo 
 
2 chmod a+x repo
 
稍等片刻即可完成。
 
5、在android目錄下建立存放android源碼的目錄source,並初始化:
 
 
平板視圖列印?1 repo init -u https://android.googlesource.com/platform/manifest
 
該命令會下載所有的版本,也可以對以上命令加上參數來指定下載某一部分的源碼,例如:
 
平板視圖列印?1 repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.3_r1
 
如果之前的第3步略過了,這裡需要將以上命令中的“repo”修改為“../bin/repo”以使終端可以識別repo命令。
 
6、之後會要求輸入使用者名稱和郵箱地址,可以隨機輸入。如果以後要向google遞交bug,那麼需要輸入有效google帳戶。完成之後如果出現“repo initialized in /home/taskiller/android”,則表示初始化完成,可以開始下載源碼了。
 
7、還是在source目錄下,輸入命令repo sync,下載源碼。這一步視網速,可能需要比較長的一段時間。
 
8、如果只是想下載核心的源碼,可以在第一步後,建立kernel目錄,之後進入到該目錄中:
 
平板視圖列印?1 mkdir kernel 
 
2 cd kernel
 
之後直接用以下命令即可下載:
1 git clone https://android.googlesource.com/kernel/common.git 
 
2 git clone https://android.googlesource.com/kernel/goldfish.git 
 
3 git clone https://android.googlesource.com/kernel/msm.git 
 
4 git clone https://android.googlesource.com/kernel/omap.git 
 
5 git clone https://android.googlesource.com/kernel/samsung.git 
 
6 git clone https://android.googlesource.com/kernel/tegra.git
 
這一步可以與下載源碼同時進行。核心源碼比完整源碼小得多,需要的時間也小得多。下載後用ls命令是看不到的,因為其預設為隱藏的,儲存在名為.git的隱藏檔案中,可以通過la -la查看。
 
對android核心與源碼的編譯會在之後介紹。
讀者也可參考官方網站:http://source.android.com/source/downloading.html
 
如非聲明,本站文章均為Taskiller雲宵閣 原創
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.