2013年4月7日日曜日

FireFoxOS(B2G)のビルド

FireFoxOS(B2G)をビルドしてみました。

ビルド環境構築

ビルド環境の構築方法はこちら。
https://developer.mozilla.org/ja/docs/Mozilla/Boot_to_Gecko/B2G_build_prerequisites

Androidのビルド環境がある方は、次のパッケージを追加すればいけるはず。(Ubuntu10.04で確認)

追加でインストールしたパッケージ
ccache autoconf2.13

ソース取得

ソースの取得方法はこちら。
https://developer.mozilla.org/ja/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build

git cloneでベース環境を取得。
1
2
git clone git://github.com/mozilla-b2g/B2G.git
cd B2G

Nexus Sのビルド環境は次のスクリプトを実行。config.shの中身をみれば、対応デバイスがわかります。

1
./config.sh nexus-s


ビルド実行

次のスクリプトを実行。
1
./build.sh


次のスクリプトでproprietary binariesの取得を行っています。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Select which blob setup script to use, if any.  We currently
# assume that $DEVICE maps to the filesystem location, which is true
# for the devices we support now (oct 2012) that do not require blobs.
# The emulator uses a $DEVICE of 'emulator' but its device/ directory
# uses the 'goldfish' name.
if [ -f device/*/$DEVICE/download-blobs.sh ] ; then
    important_files="device/*/$DEVICE/download-blobs.sh"
    script="cd device/*/$DEVICE && ./download-blobs.sh"
elif [ -f device/*/$DEVICE/extract-files.sh ] ; then
    important_files="device/*/$DEVICE/extract-files.sh"
    script="cd device/*/$DEVICE && ./extract-files.sh"
else
    important_files=
    script=
fi


ビルドが成功すると、こんな感じ。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Creating filesystem with parameters:
    Size: 536870912
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 2048
    Label:
    Blocks: 131072
    Block groups: 4
    Reserved block group size: 31
Created filesystem with 873/32768 inodes and 24287/131072 blocks
Install system fs image: out/target/product/crespo/system.img
out/target/product/crespo/system.img+out/target/product/crespo/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p total size is 93266198
 
real 19m22.266s
user 110m3.480s
sys 14m37.520s
Run |./flash.sh| to flash all partitions of your device
 
real 19m25.213s
user 110m7.650s
sys 14m37.910s


Corei7&VMware上(メモリ12GB)で、約20分でフルビルドができました。