HowToMeegoFennecDraft

From MozillaWiki
Jump to navigation Jump to search

What this is About

This document explains "How to build Mobile Firefox for Meego Netbook Platform".


Versions

This is written for Meego 1.1 SDK. Target Device is the Lenovo Ideapad. Target Platform is the Intel Netbook Release.

Current State

Configuration successful, Build successful.

Setup your Netbook

I use a Lenovo Ideapad S10-3t supporting multitouch. This is the recommended target device of Intel. Follow Instructions

Steps

  1. Get MeegoSDK
    Follow the steps from the official Meego Website. Stop at the point "Install MeeGo Runtime", we will continue from this point on. 
  2. Download and install the Runtime
    sudo mad-admin create -f -e meego-netbook-ia32-qemu-1.1.20101031.2037-sda-runtime

  3. Mount the SDK
    It is important to know that it is not a good idea to use Qemu and the Meego SDK. This is because of:
    a) In case Qemu crash once, you can not start it again, everything is gone.
    b) Qemu is very slow on compiling
    c) For mounting working directories into Qemu you need to use nfs which is possible but increase complexity
    d) The Image Partitions for netbook and handset are just to small in order to hold the mozilla sources

    Steps:
    1. Create mount point on your HOST Storage wherever you like it best
    sudo mkdir ~/meegoSDK 
    2. Create a working directory on your HOST Storage whereever you like it best
    sudo mkdir ~/meegoWorkingDirectory
    3. Mount the SDK Image into your Host System
    sudo mount -o loop,offset=512 /usr/lib/madde/linux-i686/runtimes/meego-netbook-ia32-qemu-1.1.20101031.2037-sda-runtime/meego-netbook-ia32-qemu-1.1.20101031.2037-sda.raw ~/meegoSDK 
    4. Create a mount point within the meegoSDK Directory
    sudo mkdir ~/meegoSDK/meegoWorkingDirectory
    5. Bind Mount your external Working Directory into the SDK Working Directory
    sudo mount --bind ~/meegoWorkingDirectory ~/meegoSDK/meegoWorkingDirectory
  4. ChangeRoot into MeegoSDK
    1. Copy the changeroot script from this page (see section "Scripts"
    2. Use this script by calling
    sudo sdk-changeroot ~/meegoSDK
  5. Download and install dependencies / needed packages
    zypper in python-devel docutils libidl-devel libcontentaction-devel alsa-lib-devel gst-plugins-base-devel libXext-devel git doxygen libXrender-devel freetype-devel fontconfig-devel glib2-static libXt-devel libffi-devel python sharutils bc quilt yasm zip wget
  6. Get and Compile Mercurial
    MeegoSDK is missing Mercurial packages, we need to download, compile and install them by our own.
    cd /meegoWorkingDirectory
    wget http://mercurial.selenic.com/release/mercurial-1.7.3.tar.gz 
    tar -xzf mercurial-1.7.3.tar.gz 
    cd mercurial-1.7.3 
    make install
  7. Get and Compile autoconf2.13
    wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz
    tar -xvzf autoconf-2.13.tar.gz
    cd autoconf-2.13/
    ./configure --program-suffix=2.13
    make
    sudo make install
  8. Get and Compile libresourceqt
    git clone git://gitorious.org/maemo-multimedia/libresourceqt.git
    qmake
    make
    make install
  9. Get Xulrunner Sources from Meego Developer Preview Repository
    cd /meegoWorkingDirectory 
    hg clone http://hg.meego.com/mozilla-central
    cd mozilla-central
    hg clone http://hg.meego.com/mobile-browser mobile
    cd mobile
    Update to PRC1 Branch, which is a Fennec Beta 2 with changes for Meego
    hg update -C PRC1
    cd ..
    hg update -C PRC1
  10. Copy mozconfig from this page into the /meegoWorkingDirectory
  11. Compile
    The checkout there is still debian based, this needs to be adjusted. For now it's good enough to use the mozconfig provided in the bottom of this page.
    mkdir ./build-tree
    make -f client.mk build
  12. Package it
    cd build-tree/obj-qt-buildxulrunner/xulrunner

    make package
  13. Copy it to your device
    Find the fennec*tar* within your build-tree/obj-qt-buildxulrunner/xulrunner directory
    scp fennec-#####.en-US.linux-i686.tar.bz2 <user>@IPTOYOURMEEGONETBOOK:/home/<user>

  14. Extract it
  15. Run it


Scripts

The SDK-Change-Root-Script

# Copyright 2010, Intel Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Authors:
# Haitao Feng <haitao.feng@intel.com>
# Jackie Wu <jackie.wu@intel.com>

CHROOT_NAME=$0

usage()
{
echo Usage: "$CHROOT_NAME NEWROOT [COMMAND [ARG]...]"
echo " or: $CHROOT_NAME OPTION"
echo "Run COMMAND with root directory set to NEWROOT."
echo
echo " OPTIONS:"
echo " --help display this help and exit"
echo
echo "If no command is given, run ``${SHELL} -i''"
}

reference_increase()
{
if [ -f $1 ]; then
count=`cat $1`
if [ "X$count" != "X" ]; then
count=`expr $count + 1`
echo $count > $1
fi
fi
}

reference_decrease()
{
if [ -f $1 ]; then
count=`cat $1`
if [ "X$count" != "X" ] && [ $count -gt 0 ]; then
count=`expr $count - 1`
echo $count > $1
fi
fi
}

reference_print()
{
if [ -f $1 ]; then
count=`cat $1`
if [ "X$count" != "X" ]; then
echo "The reference count of [$1]: $count"
fi
fi
}

setup()
{
chroot=$1
# normal preparation for chroot
echo mount --bind /proc $chroot/proc
mount --bind /proc $chroot/proc
echo mount --bind /sys $chroot/sys
mount --bind /sys $chroot/sys
echo mount --bind /dev $chroot/dev
mount --bind /dev $chroot/dev
echo mount --bind /dev/pts $chroot/dev/pts
mount --bind /dev/pts $chroot/dev/pts

# preparation for X
# X sockets are at /tmp/.X11-unix
# echo mount --bind /tmp $chroot/tmp
# mount --bind /tmp $chroot/tmp

# preparation for dbus
# echo mount --bind /var/lib/dbus $chroot/var/lib/dbus
# mount --bind /var/lib/dbus $chroot/var/lib/dbus
# echo mount --bind /var/run/dbus $chroot/var/run/dbus
# mount --bind /var/run/dbus $chroot/var/run/dbus

# preparation for network
echo cp /etc/resolv.conf $chroot/etc/resolv.conf
cp /etc/resolv.conf $chroot/etc/resolv.conf
}

cleanup()
{
chroot=$1
#clean up processes using chroot
pid_set=$( ps ax | awk '{ print $1 }')
for pid in $pid_set
do
if [ -h /proc/$pid/root ]; then
ps=$( ls -l /proc/$pid/root 2>/dev/null | grep $chroot)
if [ "X$ps" != "X" ]; then
kill $pid
fi
fi
done

sleep 3

# umount directories
echo umount $chroot/proc
umount $chroot/proc
echo umount $chroot/sys
umount $chroot/sys
echo umount $chroot/dev/pts
umount $chroot/dev/pts
echo umount $chroot/dev
umount $chroot/dev

echo umount $chroot/tmp
umount $chroot/tmp

echo umount $chroot/var/lib/dbus
umount $chroot/var/lib/dbus
echo umount $chroot/var/run/dbus
umount $chroot/var/run/dbus
}

if test "x$1" = "x"
then
echo "$CHROOT_NAME: missing operand";
echo "Try '$CHROOT_NAME --help' for more information";
exit;
fi

if [ -e $1 ]; then
CHROOT=$(readlink -f $1)
if [ -e $CHROOT/proc ] && [ -e $CHROOT/sys ] && [ -e $CHROOT/dev ] && [ -e $CHROOT/dev/pts ]; then
chroot_reference_count=`echo $CHROOT | sed 's/\//_/g'`
chroot_reference_count=/tmp/meego_chroot$chroot_reference_count.ref_count
chroot_mount=$( mount | grep $CHROOT/proc )
if [ "X$chroot_mount" = "X" ]; then
touch $chroot_reference_count
echo 0 > $chroot_reference_count
reference_increase $chroot_reference_count

setup $CHROOT
else
if [ "x$2" != "x" ]; then
if [ $2 = "force-clean" ]; then
echo "$CHROOT_NAME: clean up meego chroot $CHROOT"
cleanup $CHROOT
exit;
fi
fi
reference_increase $chroot_reference_count
fi

#patch from Graham Cobb, see bug #3156 for detail
unset DBUS_SESSION_BUS_ADDRESS

export HOME=/root
export PWD=/root
export CHROOTFROM=$CHROOT
export DISPLAY=:0.0

#perform the command in chroot
chroot $@

reference_decrease $chroot_reference_count
count=`cat $chroot_reference_count`
if [ "X$count" != "X" ] && [ $count -eq 0 ]; then
cleanup $CHROOT
else
echo "$CHROOT_NAME: warning: The housekeeping is not done. There might be other meego-chroot running."
fi
else
echo "$CHROOT_NAME: invalid meego chroot directory: $CHROOT";
exit;
fi
else
if [ $1 = "--help" ]; then
usage;
else
echo "$CHROOT_NAME: invalid meego chroot directory: $CHROOT";
echo "Try '$CHROOT_NAME --help' for more information";
fi
fi

MOZCONFIG, i386 Build


export LDFLAGS="-Wl,--no-keep-memory,-rpath-link,$PWD/dist/bin/:/usr/lib:/lib"
export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib"

# Options for client.mk.
mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
mk_add_options AUTOCONF=autoconf2.13
ac_add_options --with-maemo-version=6 

# XULRunner options
ac_add_app_options xulrunner --enable-application=xulrunner
ac_add_app_options xulrunner --disable-javaxpcom

# Mobile options
ac_add_app_options mobile --enable-application=mobile

#Enable RTTI
ac_cv_visibility_pragma=no

# Global options
ac_add_options --enable-default-toolkit=cairo-qt 
ac_add_options --enable-faststart
ac_add_options --enable-printing
ac_add_options --enable-codesighs
ac_add_options --enable-system-ffi 
ac_add_options --enable-cpp-rtti
ac_add_options --enable-meegotouch -prefix=/usr

ac_add_options --disable-necko-wifi
ac_add_options --disable-wave
ac_add_options --disable-optimize
ac_add_options --disable-installer
ac_add_options --disable-crashreporter
ac_add_options --disable-javaxpcom
ac_add_options --disable-embedding-tests
ac_add_options --disable-elf-dynstr-gc
ac_add_options --disable-updater
ac_add_options --disable-pedantic
ac_add_options --disable-elf-dynstr-gc 
ac_add_options --disable-install-strip 
ac_add_options --disable-jemalloc 
ac_add_options --disable-logging 
ac_add_options --disable-logrefcnt 
ac_add_options --disable-tests --disable-mochitest
ac_add_options --disable-accessibility
ac_add_options --disable-thumb2


mk_add_options MOZ_OBJDIR=./build-tree/obj-qt-buildxulrunner
mk_add_options MOZ_MAKE_FLAGS=