OSXでflame用のB2G OSをビルドする

This article provides instructions on how to build B2G OS for Flame devices using a Mac OS X system as your build platform.

Note: This guide assumes that you have the popular Homebrew package manager installed. If you do not, you should either install it or an equivalent package manager and learn how it works.

Preparing the build environment

brew install binutils
hdiutil create -volname 'firefoxos' -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.sparseimage
open ~/firefoxos.sparseimage
cd /Volumes/firefoxos/

Note: Because the image has been created as a "sparse" image, only disk blocks that are actually used take up physical space on your physical media. This means that a 40 gigabyte image, such as the one above, will not actually take up 40 gigabytes of space. Instead, it will gradually get larger as you write more and more data to it.


最初のビルドを始める前、最初のステップはB2Gリポジトリのクローンです。ここでは全部を取得しません!その代わり、B2Gビルドシステムとセットアップユーティリティを取得します。実際のB2Gコードの大半は、主なMozilla Mercurial リポジトリにあります。


git clone git://github.com/mozilla-b2g/B2G.git


cd B2G


B2Gビルドシステムのコアを取得完了後、インストールする端末に向けて設定(configure)を実行する必要があります。サポート端末の一覧を取得するには、config.sh ユーティリティを使用します — B2Gディレクトリで下記のコマンドを実行します:

./config.sh flame-kk

t's at this point that the majority of the code will be downloaded. This is around 15 GB of source code, so it will take a long time, even if you have a fast Internet connection. Even with high-performance broadband, this can take an hour or so.

Note: Seriously, this will take a very long time if you're on a slow Internet connection. Keep that in mind (as well as any per-megabyte fees you may have to pay on your connection) before doing this step.

Back up important device files

Before beginning the install process, it's important to make a backup of certain key files on the device. These will be needed if you ever need to re-flash the device. 

At this point, connect your Flame if it isn't already connected; the configure process will need to access it. Use the adb devices command to check to see if it's connected:

adb devices -l

This will list any Android or B2G compatible devices that are connected. If yours isn't listed, something's not connected properly.

Once the device is confirmed to be connected, you can make the backup using the following commands:

mkdir flame-backup
cd flame-backup
adb pull /system system
adb pull /data data

To note, if you are building for the first time, you will want to be on the latest version of the flame base image; see https://developer.mozilla.org/en-US/B2G_OS/Phone_guide/Flame/Updating_your_Flame#Full_flash_to_the_latest_base_image for more details.


There's a problem that can happen when building on Mac OS X. This is a solution devised by the Mozilla community; OSX 10.9.4 Mavericでテストされています。



brew create https://github.com/sv99/dosfstools-osx.git


require "formula"

class Dosfstools < Formula
  homepage "https://github.com/sv99/dosfstools-osx"
  url "https://github.com/sv99/dosfstools-osx.git"
  sha1 ""

  def install
    system "make", "install"   



brew install dosfstools


Bug 1039223 - Build for flame fails complaining of missing dt.img (flame向けビルドが、dt.imgがないせいで失敗する
Bug 1027682 - [Flame][Build] Failed to build on Mac OS X 10.9, elf.h file not found (Mac OS X 10.9でビルドに失敗、elf.hファイルが見つからない)
# .userconfig for flame build 14.08.2014
# osx repo change
# Bug 1039223 - Build for flame fails complaining of missing dt.img
# https://bugzilla.mozilla.org/show_bug.cgi?id=1039223
pushd device/qcom/common/dtbtool
patch -N << EOF
--- a/dtbtool/dtbtool.c
+++ b/dtbtool/dtbtool.c
@@ -616,7 +616,7 @@ int main(int argc, char **argv)
        extract "qcom,msm-id" parameter
     while ((dp = readdir(dir)) != NULL) {
-        if ((dp->d_type == DT_REG)) {
+        if ((dp->d_type == DT_REG||dp->d_type == DT_UNKNOWN)) {
             flen = strlen(dp->d_name);
             if ((flen > 4) &&
                 (strncmp(&dp->d_name[flen-4], ".dtb", 4) == 0)) {


# Bug 1027682 - [Flame][Build] Failed to build on Mac OS X 10.9, elf.h file not found
# https://bugzilla.mozilla.org/show_bug.cgi?id=1027682
if [[ ! -e /usr/local/include/elf.h ]]; then
  cp "${B2G_DIR}/external/elfutils/libelf/elf.h" /usr/local/include
  echo "Bug 1027682: elf.h copied into /usr/local/include"

# Disable First Time User experience
export NOFTU=1
echo "NOFTU = ${NOFTU}"

# Enable gaia developer mode

# Keeping both debug and non-debug objects
#export GECKO_PATH=${B2G_DIR}/mozilla-inbound

export B2G_DEBUG=1
echo "B2G_DEBUG = ${B2G_DEBUG}"

#export GECKO_OBJDIR=${GECKO_PATH}/objdir-gonk
if [[ "${B2G_DEBUG}" != "0" ]]; then


Now you're finally ready to build! Just kick it off the way you do for any B2G OS build:




 このページの貢献者: chrisdavidmills, hamasaki, Uemmra3, T.Ukegawa
 最終更新者: chrisdavidmills,