First Hacking Firefox OS day in Madrid

Last Friday we had the first Hacking Firefox OS day in Distrito C, in Telefónica Headquarters in Madrid. This was mainly a clone of the idea developed by The Lab (from O2) in London.

We started by explaining why Firefox OS (and the Open Web Device) is a game changer and why it matters for Telefónica. Also, we shown what is the underliying structure and how apps are easy developed for this platform.

But the fun part began, obviously, with the developing and hack of an app:

  • We created a small app that sends SMS and places calls. Every team was able to do that in less than 10 minutes, including searching for info regarding the API, and they were surprised by how easy is to develop core functionalities of a phone in Firefox OS.
  • We also had a brainstorming where we wrote down a list of applications that could be awesome to have. People from UX, Talentum and dev teams gave their ideas to develop in the following weeks.

We will be doing the development in the following weeks and post the results and findings here.

Hack fun!

Borja and Guillermo

Building B2G from scracth

Hi all!

In this post we are going to learn how to build B2G from the sources.

What is B2G in Firefox OS? Simple is the backend part, the one close to the linux that will provide the Gecko engine to run Gaia (the html5 + css + js frontend).

If we compile B2G, we can run int from our computer, that means we will have an emulator!

But wait … Mozilla is already creating nightly builds for us, that we can run in our computers, why I would need to compile by myself? Simple … cause then we can modify the source code!! Isn’t that awesome?

Ok, so get ready, we are going to compile B2G in a Mac, quite similar for Linux 🙂

  1. Prerequisites:
    Let’s get some tools for compiling and fetching the code. Building B2G is like building any other mozilla product so you can check this instructions for mac here and for linux here.

    $ brew install yasm mercurial libidl
    $ brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb
  2. Getting the code from Mozilla CentralWe will get the code using a Mercurial bundle, that is a compressed version of the repository, then we will update it with lates changes.
    wget http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/mozilla-central.hg
    hg init src
    cd src
    hg unbundle /path/to/your/mozilla-central.hg

    Add the following content to the file src/.hg/hgrc

    [paths]
    default = http://hg.mozilla.org/mozilla-central/
    hg pull
    hg up
  3. Once you do that you will have an updated version of the Mozilla code in the src directory. Now let’s add the configuration options to compile B2G.
    Create a file in the directory src called .mozconfigwith the following content:

    mk_add_options MOZ_OBJDIR=../obj-b2g
    mk_add_options MOZ_MAKE_FLAGS="-j4 -s"
    ac_add_options --enable-application=b2g
    ac_add_options --disable-libjpeg-turbo
    ac_add_options --enable-tests
    ac_add_options --enable-b2g-ril
  4. Now you are ready to compile, execute from the srcdirectory:
    make -f client.mk
  5. Ok the compilation (after a while) finished, where are my binaries??? Remember the .mozconfig file? Remember the option MOZ_OBJDIR, we setup to ../obj-b2g, so our binaries will be:
    cd ../obj-b2g/dist/bin/

    In that directory we have an executable b2g, the same that runs in the mobile but you can run it from your computer!

Cool, so now you have your own emulator, build gaia (you can read it from previous posts) remember when building you will have a profile directory.

Running using your B2G emulator \o/:

./b2g -profile /path/to/your/gaia/profile -jsconsole

Yeah! Next steps … modifying the operating system!!

Initial build push to phone

# Make sure you have the android SDK installed, which you can install via brew.

brew install android-sdk

# Then download the android sdk via:

android

That will pop up the sdk manager. Installing the latest version is fine and you only need to keep checked ‘Android SDK Tools’ and ‘SDK platform’ from the list.

# Then go back to the terminal and run:

make install-gaia

Obviously make sure the phone is plugged into your computer’s usb port 🙂

Quick tip: Running gaia in your Firefox Nightly

# Download and install Firefox Nightly

# Clone the gaia repo:

git clone https://github.com/mozilla-b2g/gaia.git

# ‘Compile’ gaia. Run:

DEBUG=1 make

# Now you are ready to rock, execute Firefox Nightly with the profile you just created in the previous step:

/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin -profile <full_path_to_the_profile_directory>

# Remember, you can browse the different applications by appname, that means, if you want to check the ‘dialer’ just browse http://dialer.gaiamobile.org:8080 from your Firefox Nightly.

# Use the goodies from Firefox Nightly, go to Tools > Web Developer > Responsive Design View and choose the 320×480 mode.

# Enjoy!!!