最終更新:2017-03-28 (火) 17:27:46 (238d)  

Android/ビルド はてなブックマークを見る
Top / Android / ビルド

手順

Eclipseの設定

カスタマイズ

容量

ビルド前

Ubuntu/バージョン

JDK/バージョン

ビルド環境の準備

オフィシャル

ホストOS

Ubuntu

64bit

仮想マシンでビルドする場合

  • メモリ:16GB
  • ディスク:30GB以上

必要なパッケージ

Android/ソースコードのダウンロード

Repoのインストール

  • mkdir ~/bin
    PATH=~/bin:$PATH
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    chmod a+x ~/bin/repo

ソースコードのダウンロード

  • mkdir WORKING_DIRECTORY
    cd WORKING_DIRECTORY
    repo init -u https://android.googlesource.com/platform/manifest
    repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
    repo sync

Binaries for Nexus Phones

  • Starting with Ice Cream Sandwich, the Android Open-Source Project can't be used from pure source code only, and requires additional hardware-related proprietary libraries to run, specifically for hardware graphics acceleration.
  • Official binaries for Nexus S, Nexus S 4G?, Galaxy Nexus, Nexus 7, and PandaBoard can be downloaded.

Android/Linuxカーネル

  • ICSではビルド時間削減のためにカーネルのソースコードがツリーになく、あらかじめビルドされたバイナリ形式で提供されている。
  • AOSP/deviceのデバイスごとのフォルダに含まれている
  • Android/Linuxカーネル/ビルド

ビルド

ビルド用のコマンドを有効化

lunch

  • ビルドに関する各種個別情報を設定するenvsetup.shの関数
    lunch <BUILD>-<BUILDTYPE>
    • lunch aosp_hammerhead-userdebug

BUILD

  • ビルド名デバイス名メモ
    aosp_armARM emulatorAOSP, fully configured with all languages, apps, input methods
    aosp_maguromaguroAOSP, running on Galaxy Nexus GSM/HSPA+ ("maguro")
    aosp_pandapandaAOSP, running on PandaBoard ("panda")
  • mini_emulator
  • 昔の
    fullemulatorfully configured with all languages, apps, input methods
    full_maguromagurofull build running on Galaxy Nexus GSM/HSPA+ ("maguro")
    full_pandapandafull build running on PandaBoard ("panda")

BUILDTYPE

デバイス別の推奨オプション/ブランチ

  • $ lunch
    You're building on Linux
    
    Lunch menu... pick a combo:
         1. aosp_arm-eng
         2. aosp_arm64-eng
         3. aosp_mips-eng
         4. aosp_mips64-eng
         5. aosp_x86-eng
         6. aosp_x86_64-eng
         7. aosp_hammerhead-userdebug
         8. aosp_mako-userdebug
         9. aosp_flounder-userdebug
         10. aosp_shamu-userdebug
         11. mini_emulator_mips-userdebug
         12. mini_emulator_arm64-userdebug
         13. mini_emulator_x86-userdebug
         14. mini_emulator_x86_64-userdebug
         15. m_e_arm-userdebug
         16. aosp_manta-userdebug
         17. aosp_flo-userdebug
         18. aosp_grouper-userdebug
         19. full_fugu-userdebug
         20. aosp_fugu-userdebug
         21. aosp_deb-userdebug
         22. aosp_tilapia-userdebug
    
    Which would you like? [aosp_arm-eng] aosp_flo-userdebug
    
    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=5.1.1
    TARGET_PRODUCT=aosp_flo
    TARGET_BUILD_VARIANT=userdebug
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a-neon
    TARGET_CPU_VARIANT=krait
    TARGET_2ND_ARCH=
    TARGET_2ND_ARCH_VARIANT=
    TARGET_2ND_CPU_VARIANT=
    HOST_ARCH=x86_64
    HOST_OS=linux
    HOST_OS_EXTRA=Linux-3.16.0-30-generic-x86_64-with-Ubuntu-14.04-trusty
    HOST_BUILD_TYPE=release
    BUILD_ID=LMY47V
    OUT_DIR=out
    ============================================

Android/make

  • make -j<タスク数>
  • between 1 and 2 times the number of hardware threads on the computer being used for the build.

AOSP/Makefile

  • Common make targets:
    ----------------------------------------------------------------------------------
    make droid                   Default target
    make clean                   (aka clobber) equivalent to rm -rf out/
    make snod                    Quickly rebuild the system image from built packages
    make offline-sdk-docs        Generate the HTML for the developer SDK docs
    make doc-comment-check-docs  Check HTML doc links & validity, without generating HTML
    make libandroid_runtime      All the JNI framework stuff
    make framework               All the java framework stuff
    make services                The system server (Java) and friends
    make help                    You're reading it right now

ccache

  • Android 4.0から対応
    export USE_CCACHE=1
    prebuilt/linux-x86/ccache/ccache -M 50G

Eclipseでの開発

スライド

Android internals 03 - Build system, emulator (rev_1.1) from Egor Elizarov

ビルドプロセス

  • Set up standard variables
  • Clean up (AOSP/build/core/cleanbuild.mk?)
  • Find all Android.mk
  • Generate dependencies
  • Build modules
  • Make Images

参考

関連