Mozilla Days:Working with Fennec, The Mobile Browser!

Fennec, the Mobile Browser is developed by Mozilla. And I have started working on it just a week back.I had figured out that Firefox is not going work on the little android device I own, it does not generally.
(Mozilla Firefox is not supported in Galaxy Y. As it has armv6 CPU and a RAM of size 290 MB, while Firefox requires 512 MB at least.)

Well, the news is : Fennec browser is up and running successfully on my Galaxy Y, and pretty cool it is! 😉

Here’s how to do it.  

Building Fennec:

First install the Sun Java jdk7, which the Android SDK depends on. If you’re on Ubuntu (pre-11.10), you’ll need to enable the partner’s repo to get it.

# Ubuntu 11.10 and after
# Download Java from Oracle. and
# download the latest version of the JDK.
# These instructions assume the file is called jdk-6u35-linux-x64.bin
sudo mkdir /opt/java
sudo mv ~/Downloads/jdk-6u35-linux-x64.bin
sudo chmod +x ./jdk-6u35-linux-x64.bin
sudo ./jdk-6u35-linux-x64.bin
ln -f -s /opt/java/jdk1.6.0_35/bin/* /usr/local/bin/
# something like
sudo update-alternatives--install /usr/local/bin/java java /opt/java/jdk1.6.0_35/bin/ 1 is
# close to the distro way of registering java

ia32-libs is needed to allow the toolchain binaries to run.

sudo apt-get install ia32-libs

Then install the usual stuff needed for a firefox build.Install Gecko Requirements.

sudo apt-get install mercurial ccache
sudo apt-get build-dep firefox

Download and extract the Android NDK.

tar -xjf android-ndk-r5c-linux-x86.tar.bz2

You should just install the latest Android SDK. 
You will need SDK version at least 16.

tar -xzf android-sdk_r20.0.3-linux.tgz
./android-sdk-linux/tools/android update sdk --no-ui
./android-sdk-linux/tools/android update adb

You will probably want to add the SDK’s “tools” and “platform-tools” directory to the PATH environment variable in your shell, so that you can run adb and other tools easily. For example, if you installed the SDK in $HOME/opt, you could add the following line to the end of your .bashrc:


export PATH=$PATH:$HOME/opt/android-sdk-linux/platform-tool:$HOME/opt/android-sdk-linux/tools
Setup Mercurial:

Create a .hgrc file, with the following codes written.
username = Your Real Name <>
merge = your-merge-program (or internal:merge)

git = 1
showfunc = 1
unified = 8

commit = -v
Configure kdiff3 as a merge tool.
kdiff3.args=--auto -L1 base --L2 local --L3 other $base $local $other -o $output
Configure mq. Many Mozilla developers use the mq extension.  If you want to enable it, you probably want the following in your .hgrc:
mq =

qnew = -U

plain = True
Getting the source:

Grab a clone of the repository.

hg clone src
Setup Fennec mozconfig:

Create a .mozconfig file under src.

# Add the correct paths here:
ac_add_options --with-android-ndk="$HOME/android-ndk-r5c"
ac_add_options --with-android-sdk="$HOME/android-sdk-linux/
ac_add_options --with-android-version=5

# android options
ac_add_options --enable-application=mobile/android
ac_add_options --target=arm-linux-androideabi
ac_add_options --with-ccache

mk_add_options MOZ_OBJDIR=./objdir-droid
mk_add_options MOZ_MAKE_FLAGS="-j9 -s"
 ac_add_options --with-arch=armv6
 export MOZ_PKG_SPECIAL=armv6

Now, here’s the trick. The last two lines of the above code is where you’re doing the armv6 settings.

Building the code:

This will build (compile+link), package into apk, and deploy to the Android device. 

make -f
make -C objdir-droid package

USB Debugging:

Turn on “USB Debugging” on your device.
On the device, go to Settings > Applications > Development and enable USB debugging (on an Android 4.0 device, the setting is located in Settings > Developer options).

Let your system discover your device, after connecting it to your system with the help of some USB cable.

/your/path/to/adb devices

Install it on your phone!

/your/path/to/adb install your/path/to/fennec 

That’s it! 🙂

Happy Browsing, Everyone!

Leave a Reply

Your email address will not be published. Required fields are marked *