高通源代碼 Ubuntu14.04下載&編譯Android(1)


 337人閱讀 評論(0) 收藏 舉報
 分類:

1 安裝git&repo&curl

    下載Android源碼需要git,repo等工具,啓動repo是Google寫的一個專門用於下載Android源碼的工具,主要調用了git。

(1)安裝git

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. sudo apt-get install git  
(2)安裝repo

    下載repo,改變可執行權限,然後移動到/usr/bin目錄中即可:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. chomd +x repo  
  2. sudo mv repo /usr/bin  

2 下載Android

    由於Google被牆了,因此無法直接從Google官網下載Android源碼,因此需要另覓途徑,高通開源網是一個不錯的選擇。本文在其中下載支持高通msm8909平臺的Android源碼,Android版本爲6.0.1,詳細步驟如下:

1)創建源碼目錄

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. mkdir android-msm8909  
2)進入源碼目錄,然後初始化repo

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. cd android-msn8909  
  2. repo init -u git://codeaurora.org/platform/manifest.git -b release -m LA.BR.1.2.6.c1-02100-8x09.0.xml  
3)同步源碼(下載)

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. repo sync -j4  
    注意:

    a)源碼大小有40GB,下載過程要幾個小時;

    b)上述LA.BR.1.2.6.c1-02100-8x09.0.xml在高通開源網上查看:


3 編譯Android

3.1 安裝JDK

    通過《Android源碼編譯--jdk版本查詢》的方法查看上述源碼所需的JDK版本,得知需要安裝OpenJDK-1.7:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. sudo apt-get install openjdk-7-jdk  

3.2 編譯

1)進入android-msm8909目錄:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. cd android-msm8909  

2)配置環境變量:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. source build/envsetup.sh  

3)執行下面命令選擇產品:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. lunch  

    

在上圖中選擇一個版本(我選擇了27),然後按回車鍵即可。

4)執行下面命令啓動編譯:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. make  

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. make -j4 showcommands dist  

參數說明:

    -j4, 開啓4個線程;

    showcommands, 顯示編譯過程中執行的命令[38];

    dist, 將編譯後產生的發佈文件拷貝到out/dist目錄中[38];

3.3 編譯結果

    編譯完成後,生產的相關鏡像在out/target/product的子目錄中,例如:


    其中,linux內核編譯結果保存在obj/KERNEL_OBJ目錄中(Linux內核也一同被編譯了,而無需另外獨立編譯!)。

4 編譯sdk

    詳見《Android源碼編譯SDK》。

5 編譯內核

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. make bootimage  

6 編譯其它模塊

    參考資料[37]總結了編譯各個模塊的方法:

[plain] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. make sdk - build the tools that are part of an SDK (adb, fastboot, etc.)  
  2. make snod - build the system image from the current software binaries  
  3. make services  
  4. make runtime  
  5. make droid - make droid is the normal build.  
  6. make all - make everything, whether it is included in the product definition or not  
  7. make clean - remove all built files (prepare for a new build). Same as rm -rf out/<configuration>/  
  8. make modules - shows a list of submodules that can be built (List of all LOCAL_MODULE definitions)  
  9. make <local_module> - make a specific module (note that this is not the same as directory name. It is the LOCAL_MODULE definition in the Android.mk file)  
  10. make clean-<local_module> - clean a specific module  
  11. make bootimage TARGET_PREBUILT_KERNEL=/path/to/bzImage - create a new boot image with custom bzImage  

參考資料

[1]Ubuntu 下載 & 編譯 Android5.1 源碼

[2]國內鏡像加速Android源碼下載

[3]在Ubuntu系統中下載Android源碼(5.1.1_r8)

[4]ubuntu repo準備和代碼下載

[5]android系統源碼下載

[6]下載android4.4.2源碼全過程(附已下載的源碼)

[7]android 4.4源碼下載——百度雲盤地址

[8]基於Ubuntu 14.04 LTS編譯Android4.4.2源代碼

[9]Qualcomm平臺android開發總結

[10]高通android平臺源碼 (2011-03-28 10:56)

[11]在官網途徑無法下載到android 源碼時,,你可通過這種方式去下載

[12]高通平臺android開發總結(7630)

[13]Android for MSM Project
[14]Qualcomm平臺android開發總結

[15]高通平臺android開發總結 MSM平臺上的AMSS

[16] android源碼下載(上)

[17]android源碼下載(下)

[18]開源代碼下載路徑

[19]如何下載並編譯Android4.0內核源碼goldfish(圖文)

[20]Android源碼、內核編譯

[21]如何下載Android kernel內核源代碼,編譯燒寫驗證

[22]編譯Android系統源碼和內核源碼

[23]Android源碼編譯的全過程記錄

[24]在Ubuntu 14.04系統中編譯Android 5.1.1源碼

[25]Android AOSP 5.1.0 & 5.0.1源代碼百度雲下載

[26]Android 6.0 源代碼編譯實踐

[27]自己動手編譯Android源碼(超詳細)

[28]Android學習系列(38)--Android源碼下載和編譯

[29]Android SDK 源代碼編譯

[30]編譯時候 make和 make sdk有什麼區別?

[31]android 如何製作自己的sdk

[32]Android 源碼編譯 make sdk ADT

[33]android編譯SDK問題彙總

[34]如何在linux下編譯windows版android sdk

[35]ubuntu12.04(64bit)編譯android4.2.2源代碼及SDK步驟

[36]Android_SDK編譯,帶自己api的android.jar編譯

[37]Android Build System

[38]Android源代碼編譯命令m/mm/mmm/make分析

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章