MacでAndroidのソースをビルド
公式サイト
- Initializing a Build Environment | Android Open Source
- Downloading the Source Tree | Android Open Source
- Building the System | Android Open Source
1. ビルド環境の設定
ディスクイメージの作成ホームディレクトリに android.sparseimage ファイルができる。
$ hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 30g ~/android.sparseimage
以下を .bashrc なり .zshrc なりに追加。
# mount the android file image
function mountAndroid { hdiutil attach ~/android.sparseimage -mountpoint /Volumes/android; }
function unmountAndroid { hdiutil detach /Volumes/android; }# set the number of open files to be 1024
ulimit -S -n 1024export PATH=~/bin:$PATH # 2.ソースの取得参照
設定を反映させる。
$ source ~/.bashrc(~/.zshrc)
GPGをインストール
$ brew install gnupg
2. ソースの取得
Repoのインストール
$ mkdir ~/bin
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
ソース取得
ブランチを指定したい場合は repo init で -bオプションを使用する(e.g. -b android-4.0.1_r1)。
$ mountAndroid
$ cd /Volumes/android
$ mkdir src # このディレクトリ名は任意
$ cd src
$ repo init -u https://android.googlesource.com/platform/manifest
$ repo sync
3. ビルド
シェルはbashが推奨されている。
$ source build/envsetup.sh
$ lunch full-eng # DeviceとBuildtypeによってターゲットを指定
$ make -j4