How to build custom gaia

Hello Mozillians,

As Mozilla says that Firefox OS is purely hackable  i.e. if you want to introduce any new feature in the Firefox OS or work on old to build it to better or just hack it and remix it. Many of you wondered how the hack it is possible and if it is possible then from where i can get started with it.

So folks, I am writing this post to somewhat address this issue though Mozilla already explained whole process on MDN but here i am going to explain it in is some different way, also i am assuming that initially you don’t have a device i.e. you are running gaia on simulator  .

Before proceeding further it would be great if you mind few points:

  • You should have previous knowledge how things with github works like fork, pull, push, merge blah blah.
  • As far as i know you can not build gaia on Windows. So, “don’t try this in windows” :mrgreen:
  • Little bit of experience with command line (more preferably linux command line though if you have basic knowledge of windows command prompt, it will work)
  • And most necessary as you are going to change few features in OS that means you should have a good amount of skills in JavaScript and HTML
  1. Make a fork of the main Gaia repo
  2. Clone your fork locally:

    git clone https://github.com/your-username/gaia.git

  3. Add upstream

    cd gaia
    git remote add upstream https://github.com/mozilla-b2g/gaia

  4. Now you need to create a Gaia profile. Running make inside your repo folder creates a profile in the profile directory, which is setup for optimal debugging. It creates unpackaged (hosted versions) of the Gaia apps that can be served directly via the local HTTPD server bundled along with Firefox desktop as an extension. When you make a change you just need to refresh your browser window to see the result (as you’ll see later), rather than having to rebuild the profile, repush it to the device, etc. This is really good for rapid CSS/JS/HTML hacking.
  5. To create gaia profile run this command

    make PRODUCTION=1 DEVICE_DEBUG=1 MOZILLA_OFFICIAL=1 REMOTE_DEBUGGER=1 GAIA_KEYBOARD_LAYOUTS=en

  6. Now i would suggest you to download Mozilla central version of B2G desktop as i had already tried using web simulator and had some pretty bad experience so my recommendation would be to use B2G desktop version(We can launch it using pre loaded binary).
  7. Download tar file according to your OS architecture, like mine is ubuntu 32 bit so i am going with b2g-38.0a1.multi.linux-i686-localizer.tar.bz2
  8. Use this command to extract tar

    tar -xvjf b2g-38.0a1.multi.linux-i686-localizer.tar.bz2

  9. Now you will see b2g named directory
  10. Move to b2g directory(cd b2g)
  11. Enter command ./b2g-bin -profile ‘profile path of your gaia directory’ like:

    ./b2g-bin -profile ‘/home/yaseen/gaia/profile’

  12. If all goes well you will see simulator running custom gaia 🙂
Simulator running custom gaia

Simulator running custom gaia

Summary of what i had tried to do here. We had downloaded gaia repo and created build profile. We had downloaded b2g and through b2g binary we are launching gaia profile.

I would like to Thanks Ahmed Nefzaoui for helping me out at every step.

Thanks for reading patiently .

~Yaseen

Advertisements

3 thoughts on “How to build custom gaia

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s