Building Fennec on Meego 1.2 chroot environment

From MozillaWiki
Jump to: navigation, search

What this is About

This document describes step by step instructions how to setup Meego 1.2 chroot environent and how to compile Fennec for Meego 1.2.

General Meego.com instructions for chroot environment can be found: http://wiki.meego.com/SDK/Docs/1.2/Building_a_MeeGo_chroot_on_Linux

These defined steps are for Ubuntu 10.04, for other versions or Linux distributions, please take a look on the meego.com links.

Install tools

Meego instructions for mic2 installation: http://wiki.meego.com/Image_Creation#Installation

Update source.list

sudo nano /etc/apt/sources.list

Add line:

deb http://repo.meego.com/MeeGo/tools/repos/ubuntu/10.04/ /

Update:

sudo apt-get update

add repository public key:

gpg --keyserver subkeys.pgp.net --recv 0BC7BEC479FC1F8A 
gpg --export --armor 0BC7BEC479FC1F8A | sudo apt-key add -

Update again

sudo apt-get update

Install mic2

sudo apt-get install mic2 

Install QEmu related tools

sudo apt-get install qemu qemu-arm qemu-common qemu-gl qemu-kvm qemu-user-static 

If qemu-user-static is not available, see possible problems on step "Chroot into the image using mic-chroot"

Download and configure Meego 1.2 image

Different versions of Meego images and for different targets can be found from Meego builds

I used the following one (for armv7hl n900), download the image:

wget http://repo.meego.com/MeeGo/builds/1.2.80/1.2.80.0.20110503.2/images/meego-handset-armv7hl-n900-devel/meego-handset-armv7hl-n900-devel-1.2.80.0.20110503.2-mmcblk0p.raw.bz2

Check that image is fine:

md5sum meego-handset-armv7hl-n900-devel-1.2.80.0.20110503.2-mmcblk0p.raw.bz2

Compare the result with manifest file:

http://repo.meego.com/MeeGo/builds/1.2.80/1.2.80.0.20110503.2/images/meego-handset-armv7hl-n900-devel/MANIFEST

Unpack the image:

bunzip2 meego-handset-armv7hl-n900-devel-1.2.80.0.20110503.2-mmcblk0p.raw.bz2

Install kpartx:

sudo apt-get install kpartx

Create device map:

sudo kpartx -a -v ./meego-handset-armv7hl-n900-devel-1.2.80.0.20110503.2-mmcblk0p.raw

Mount the device map and copy the filesystem into the chroot location:

mkdir ~/tmp-mnt   # temporary mount point
sudo mount /dev/mapper/loop0p1 ~/tmp-mnt -o loop,ro
mkdir ~/meego-chroot
sudo rsync -av ~/tmp-mnt ~/meego-chroot
sudo umount ~/tmp-mnt

Remove the device map and temporary mount point:

sudo kpartx -d -v ./meego-handset-armv7hl-n900-devel-1.2.80.0.20110503.2-mmcblk0p.raw
rmdir ~/tmp-mnt

Fetch Fennec sources and setup mozconfig

First add access rights to home/meego

sudo chmod a+rwx ~/meego-chroot/tmp-mnt/home/meego 

Fetch the sources:

cd ~/meego-chroot/tmp-mnt/home/meego
hg clone http://hg.mozilla.org/mozilla-central

Create mozconfig to ./mozilla-central, I used following one:

export ac_cv_have_usable_wchar_option_v2="no"

ac_add_options --enable-application=mobile
ac_add_options --enable-update-channel=nightly
ac_add_options --enable-update-packaging
ac_add_options --enable-tests
ac_add_options --enable-default-toolkit=cairo-qt
ac_add_options --with-maemo-version=6
ac_add_options --enable-meegocontentaction

# required for meegotouch
ac_add_options --enable-cpp-rtti
ac_add_options --disable-install-strip

export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols="-gdwarf-2"
export MOZILLA_OFFICIAL=1
mk_add_options PROFILE_GEN_SCRIPT=@TOPSRCDIR@/build/profile_pageloader.pl

ac_add_options --enable-optimize=" -g -O2 "
mk_add_options MOZ_MAKE_FLAGS="-j9"
mk_add_options MOZ_OBJDIR="obj-build"
ac_add_options --with-arm-kuser
ac_add_options --with-thumb=toolchain-default
ac_add_options --with-float-abi=toolchain-default
ac_add_options --enable-official-branding

Chroot into the image using mic-chroot

sudo mic-chroot ~/may/meego-chroot/tmp-mnt/

Possible problems:

If chroot fails with following:

...
bind_mount: /lib/modules/2.6.24-25-generic -> /home/iotsala/may/meego-chroot/tmp-mnt//lib/modules/2.6.24-25-generic
bind_mount: /lib/modules/2.6.32-30-generic -> /home/iotsala/may/meego-chroot/tmp-mnt//lib/modules/2.6.32-30-generic
qemu: fatal: cp15 insn ee1d4f70

Check if you have qemu-kvm-extras-static package installed, remove it:

sudo apt-get remove qemu-kvm-extras-static

Install qemu-user-static, Not available for ubuntu 10.04 (Is available for 11.04 ->), so fetched it from http://packages.debian.org/sid/qemu-user-static

wget http://ftp.fi.debian.org/debian/pool/main/q/qemu/qemu-user-static_0.14.0+dfsg-5.1_i386.deb
dpkg -i qemu-user-static_0.14.0+dfsg-5.1_i386.deb

Install fennec build dependencies

At this point you should be in chroot env. If behind proxy, set them:

export http_proxy=http://xxx.xxx:port

Zypper for some reason doesn't find packages under noarch repo, so had to install them manually:

wget http://repo.meego.com/MeeGo/builds/1.2.80/1.2.80.0.20110503.2/repos/oss/armv7hl/packages/noarch/autoconf213-2.13-20.1.noarch.rpm
rpm -i autoconf213-2.13-20.1.noarch.rpm
wget http://repo.meego.com/MeeGo/builds/1.2.80/1.2.80.0.20110503.2/repos/oss/armv7hl/packages/noarch/xorg-x11-filesystem-7.3-6.1.noarch.rpm
rpm -i xorg-x11-filesystem-7.3-6.1.noarch.rpm

Install remaining dependencies with zypper:

zypper install zip qt-devel libqtopengl-devel pango-devel dbus-devel dbus-glib-devel alsa-lib-devel libIDL-devel wireless-tools-devel libXt-devel libmeegotouch-devel libmdatauri-devel libXext-devel

Build Fennec

In ./mozilla-central directory:

make -f client.mk build_all