Difference between revisions of "Fennec on a Nokia N810"

From CDOT Wiki
Jump to: navigation, search
(Debugging on Fennec on a Nokia N810)
(Debugging on Fennec on a Nokia N810)
Line 231: Line 231:
 
     "make package PKG_SKIP_STRIP=1"
 
     "make package PKG_SKIP_STRIP=1"
  
note: right now running fennec with the -g flag doesn't work
+
'''note:''' right now running fennec with the -g flag doesn't work

Revision as of 08:33, 18 March 2009

Documentation on Building and Testing Fennec on the Nokia N810 device.

Setting up your environment.

There are instructions available on the Fennec Mobile page In order to develop for Fennec on an Nokia device one must install scratchbox.

In order to compile Fennec for the nokia devices. we need 3 different components in order to make this work

scratchbox: Scratchbox is the cross platform compilation tool that is needed.

scratchbox toolchain: A set of tools used for a certain versions of compiler libraries, special headers and other tools a cross-toolchain enables compiling binaries for different CPU architecture than the host CPU

maemo sdk: Maemo is an open source development platform that runs on Linux and the SDK provides a set of libraries and compilier and emulator that "emulates" the Nokia for developing and debugging.

note: theres an installer(choose to install everything)

instructions are available at [1]

note: sometimes you will require to install the libIDL and setup the PKG_CONFIG_PATH

to do that you must login into scratchbox. /scratchbox/login

   wget http://ftp.gnome.org/pub/gnome/sources/libIDL/0.8/libIDL-0.8.9.tar.gz
   tar -xzvf libIDL-0.8.9.tar.gz
   cd libIDL-0.8.9
   ./configure
   make
   fakeroot make install
   cd ..

note: if the libIDL error appears on build run this.

   export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pgkconfig

note: mmap Permission error occurs quit scratchbox and run 'sudo sysctl -p'

Unistalling Scratchbox

If at any point in time you wish to uninstall Scratchbox you can follow these instructions.

note: these commands are done as root.

   # apt-get remove scratchbox-libs

removes all info int he users folder(save all your important files)

   # /scratchbox/sbin/sbox_ctl stop

/scratchbox directory should be empty

   # rm -rf /scratchbox/users

scratchbox mounts directories sbox_ctl stop then you can remove the rest of scratchbox

   # rm -r /scratchbox


Setting up your N810 for development

In order to access the N810 remotely on your wireless network you will need a wireless router.

In order to access the device from outside your wireless network over the internet you will need a service like DynDNS if your IP is not static. Then port forward the ssh communcation to the device.

You might also want to consider giving the device a dedicated IP address.

It is required for you to install SSH and fix the mounting options on the device.

Install SSH on the device: [2]

Fix the mounting options on the device in order to be able to run your builds on the built in memory card (/media/mmc2) There are instructions available here on how to do it. [3]

For more information on setting up your device visit: [4]


note: To find out the IP address of the device if you are on your local wireless network in Settings>Connection Manager>menu>Internet connection>IP address


Building Fennec

Mozilla currently uses Mercurial for version tracking ref: [5]

To get a copy of the Fennec Source Login to scratchbox and run these commands.

   hg clone http://hg.mozilla.org/mozilla-central
   cd mozilla-central
   hg clone http://hg.mozilla.org/mobile-browser mobile

Depending on your connection this might take a while. Once you have the source you will want to create a .mozconfig file you will want to place this inside the mozilla-central directory.

Here is a sample of a .mozconfig: .mozconfig

note: If you want to know what other build options are available to you check out: [6]

Once you have your .mozconfig saved in the mozilla-central directory To build Fennec just run

   # make -f client.mk build

note: this will take a while

Once that is done you will have 2 directories in your object directory mobile and xulrunner

Packaging Fennec

It is required for you to package Fennec and then copy it over to the device using scp command to do this follow these instructions

   cd $objdir/mobile
   make package
   cd dist
   ls

then you should have a file called fennec-1.0a3pre.en-US.linux-arm.tar.bz2 note: if its not linux-arm you didn't build in the right environment

you will want to bunzip the file

   bunzip2 fennec-1.0a3pre.en-US.linux-arm.tar.bz2

then copy it over to the device

   scp bunzip2 fennec-1.0a3pre.en-US.linux-arm.tar root@ip.address.to.device:/media/mmc2/

note: /media/mmc2 is the built in memory card on the device

Running Chrome Tests

To run Chrome tests on Fennec on the Nokia N810 currently it is required that you apply 3 patches from bugs 470971, 460515, and 421611

then build it again

Follow these steps in scratchbox.

from your $objdir/xulrunner/

   cd _tests/testing/mochitest
   
   ## create backup
   cp -R chrome chrome.bak
   
   ## NOTE: you need to do the following steps in a look for each directory
   ## dirs: [content, docshell, dom, toolkit, widget]
   rm -Rf chrome/*
   
   cp -R chrome.bak/content chrome/

Then you will want to package and port your tests over to the device.

   cd $objdir/xulrunner 
   make package-tests

you will end up with a file called

   xulrunner-1.9.2a1pre.en-US.linux-arm.tests.tar.bz2

You will first want to uncompress the .bz2

   bunzip2 xulrunner-1.9.2a1pre.en-US.linux-arm.tests.tar.bz2

then you will end up with a file called

   xulrunner-1.9.2a1pre.en-US.linux-arm.tests.tar

This file you will copy over to the device.

   scp xulrunner-1.9.2a1pre.en-US.linux-arm.tests.tar root@ip.address.to.device:/media/mmc2/

note: media/mmc2 is the built in memory card on the device that you can use to test things.

   python mochitest/runtests.py --appname=/path/to/fennec/fennec --chrome --utility-path=/path/to/bin --certificate-path=/path/to/bin --xre-path=/path/to/fennec/xulrunner --log-file=chrome_content.log --autorun --close-when-done


For more information visit: [7] [8]

Running Mochitests

Mochitest is a automated testing framework. [9]

note: Due to Fennec's constant development these instructions will probably change. Please refer to these instructions [10] It is also highly encouraged that you go on IRC in to stay up-to-date with the information.

On IRC: irc.mozilla.org #mobile


Debugging on Fennec on a Nokia N810

You must rely on dump() in javascript and printf() in C++ and your console/terminal in order to debug.

note: Usually I put "DEBUG" in front of all the dump() and printf() so that you can grep for them on the console/terminal.


There are instructions on how to get gdb installed here: [11]

In order to get gdb to work on fennec it needs to be packaged with it's symbols to do that run

    "make package PKG_SKIP_STRIP=1"

note: right now running fennec with the -g flag doesn't work