Android M 6.0 Build about 64-bit (__arm64__)

來源:互聯網
上載者:User

標籤:

 

Android M 的編譯

對於新版本的Android系統(6.0 開始 ??),在編譯時間,支援同時編譯出兩種CPU架構( 即 32-bit 和 64-bit )的 Binaries,這個被稱作 "Multilib build"。

對於 native static libraries 和 shared libraries,編譯系統會同時編譯出兩種架構的 Binary。

PRODUCT_PACKAGES 會決定哪個 Binary 會被放進 System Image。

系統預設是編譯 64-bit 的版本,可以通過修改 BoardConfig.mk 檔案進行定製。

 

產品配置 (整個系統)

在BoardConfig.mk中,以下變數可以配置 second CPU architecture 以及 ABI(application binary interface):

TARGET_2ND_ARCHTARGET_2ND_ARCH_VARIANTTARGET_2ND_CPU_VARIANTTARGET_2ND_CPU_ABITARGET_2ND_CPU_ABI2

以 build/target/board/generic_arm64/BoardConfig.mk 為例:

TARGET_NO_BOOTLOADER := trueTARGET_NO_KERNEL := trueTARGET_ARCH := arm64TARGET_ARCH_VARIANT := armv8-aTARGET_CPU_VARIANT := genericTARGET_CPU_ABI := arm64-v8aTARGET_2ND_ARCH := armTARGET_2ND_CPU_ABI := armeabi-v7aTARGET_2ND_CPU_ABI2 := armeabi

如果想改為,預設編譯32-bit系統,可以設定以下變數:

TARGET_PREFER_32_BIT := true

 

在Android.mk中配置模組

在某個模組的 Andorid.mk 中,使用 LOCAL_MULTILIB 變數,可以 override 系統設定的 TARGET_PREFER_32_BIT。

LOCAL_MULTILIB可以設定為:

"both"    // build both 32-bit and 64-bit"32"       // build 32-bit"64"       // build 64-bit"first"     // build for the first arch (32-bit in 32-bit device, 64-bit in 64-bit device)""           // the default 

 還可以使用指定架構的 "LOCAL_MODULE_TARGET_ARCH" 變數來編譯指定架構的 Binaries:

LOCAL_MODULE_TARGET_ARCH := arm

 

 

 

參考文獻:

https://source.android.com/source/64-bit-builds.html  (請自行FQ~~~)https://www.ibm.com/developerworks/cn/opensource/os-cn-android-build/   

Android M 6.0 Build about 64-bit (__arm64__)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.