B2G/DeveloperPhone

From MozillaWiki
Jump to navigation Jump to search

Gaia Developer Environment

WINDOWS USERS: We do not currently support Windows as development platform. You can install a Linux VM using VMWare Player (see http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/).

The user interface on the phone is called "Gaia". It is hosted on gaiamobile.org, and offline cached on the device using appcache. At the moment the easiest way to modify Gaia is to check out the Gaia repository, modify the HTML5/JS source, and upload the new content to the phone. We will discuss this approach first:

1. First we need to checkout the Gaia source:

$ git clone https://github.com/andreasgal/gaia
Cloning into gaia...
remote: Counting objects: 14812, done.
remote: Compressing objects: 100% (5014/5014), done.
remote: Total 14812 (delta 9876), reused 14224 (delta 9345)
Receiving objects: 100% (14812/14812), 119.18 MiB | 1.46 MiB/s, done.
Resolving deltas: 100% (9876/9876), done.
$ cd gaia

2. The version of Gaia installed on developer phones is tagged "m2.5". You probably want to switch to that tag.

$ git checkout m2.5
Note: checking out 'm2.5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 8b547e6... Merge pull request #1075 from krellian/owa

3. Next we will need adb, the Android Debugger Bridge. The easiest way to install adb is to install the Android SDK from this url:

http://developer.android.com/sdk/index.html

Make sure to install the Platform Tools (not installed by default).

4. Make sure adb is in your path.

$ adb
Android Debug Bridge version 1.0.26

 -d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
...

5. You should be able to connect to the B2G phone via adb now:

$ adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
root@android:/ # ^D
$ 

Control-D exits the shell again.

Gecko

Gecko is the "rendering engine", or "application runtime", on the device. It's the same engine that powers Firefox. The Gecko build on your phone is configured to automatically update itself. It should mostly stay out of your way.

However, if something does go wrong, you can repair your Gecko installation by running the following commands in your shell

curl update.boot2gecko.org/m2.5/b2g-gecko-m2.5-recovery.zip > b2g-gecko-m2.5-recovery.zip
unzip b2g-gecko-m2.5-recovery.zip
cd b2g-gecko-m2.5-recovery
make install-gecko