Mobile/Fennec/RaspberryPi
From MozillaWiki
Contents
- 1 Build Qt Mozilla for Raspberry Pi
- 1.1 Build crosstool-ng toolchain
- 1.2 Prepare target wheezy armhf chroot
- 1.2.1 Download raspbian public key from root
- 1.2.2 Debootstrap wheezy chroot
- 1.2.3 Install required packages inside chroot
- 1.2.4 make chroot alias
- 1.2.5 Make chroot shell different from host
- 1.2.6 Make sure that proc mounted in order to avoid some warnings
- 1.2.7 fix undefined locale warnings, and enable bash completion
- 1.3 Setup Scratchbox 2 around installed toolchain and dev rootfs
- 2 Build Qt-Mozilla inside chroot
Build Qt Mozilla for Raspberry Pi
Build crosstool-ng toolchain
Install crosstool-ng using this tutorial: http://www.bootc.net/archives/2012/05/26/how-to-build-a-cross-compiler-for-your-raspberry-pi
In addition to step 13. enable C++
And choose compiler linaro-4.7-2013.01
Tested crosstool-ng config available here:
http://romaxa.info/raspberrypi/rasp-armhf-whz-4.7-config
Prepare target wheezy armhf chroot
Download raspbian public key from root
sudo su wget http://archive.raspbian.org/raspbian.public.key;apt-key add raspbian.public.key CTRL^D sudo apt-get install qemu-user-static
Debootstrap wheezy chroot
export CHROOTPATH=$HOME/wheezy-armhf export CHROOTPREFIX=whrp mkdir -p $CHROOTPATH/usr/bin cp -rf /usr/bin/qemu-arm-static $CHROOTPATH/usr/bin sudo debootstrap --verbose --arch=armhf --keyring /etc/apt/trusted.gpg --include=apt wheezy $CHROOTPATH http://archive.raspbian.org/raspbian sudo cp /usr/bin/qemu-arm-static $CHROOTPATH/usr/bin/ sudo cp -f /etc/apt/apt.conf $CHROOTPATH/etc/apt/ sudo cp -f /etc/apt/apt.conf.d/* $CHROOTPATH/etc/apt/apt.conf.d/ sudo cp -f /etc/resolv.conf $CHROOTPATH/etc/ sudo cp -f /etc/hosts $CHROOTPATH/etc/
Install required packages inside chroot
sudo chroot $CHROOTPATH apt-get update sudo chroot $CHROOTPATH apt-get install -y --force-yes sudo adduser python2.7 bash-completion
make chroot alias
echo "alias o"$CHROOTPREFIX"chroot='sudo chroot $CHROOTPATH su - '" >> ~/.bashrc . ~/.bashrc
Make chroot shell different from host
echo "PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]-"$CHROOTPREFIX":\[\033[01;34m\]\w\[\033[00m\]\$ '" >> $CHROOTPATH/root/.bashrc
Make sure that proc mounted in order to avoid some warnings
echo "sudo mount -t proc proc /proc" >> $CHROOTPATH/root/.bashrc
fix undefined locale warnings, and enable bash completion
echo " export LANGUAGE=C export LC_ALL=C export LANG=C if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi " >> $CHROOTPATH/root/.bashrc
Setup Scratchbox 2 around installed toolchain and dev rootfs
# Install sbox2 with: sudo apt-get install scratchbox2 # or use these instructions: # http://russelldavis.org/2011/09/07/setting-up-scratchbox2-from-scratch-for-the-raspberry-pi/ # also small hack around: error "Never use <bits/predefs.h> directly; include <stdc-predef.h> instead." sudo cp /opt/cross/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/usr/include/features.h $CHROOTPATH/usr/include
Initialize sb2 config
cd $CHROOTPATH sb2-init Raspi /opt/cross/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc sb2-config -d Raspi
Build Qt-Mozilla inside chroot
Install Qt dev packages to Dev rootfs
# Core dependencies (--enable-default-toolkit=linuxgl) sudo chroot $CHROOTPATH apt-get install -y --force-yes libpango1.0-dev libasound-dev libfreetype6-dev libffi-dev # Qt dependencies (--enable-default-toolkit=cairo-qt) sudo chroot $CHROOTPATH apt-get install -y --force-yes libqt4-dev libqt4-opengl-dev libxt-dev libx11-dev libxext-dev # Gtk dependencies (--enable-default-toolkit=cairo-gtk2) sudo chroot $CHROOTPATH apt-get install -y --force-yes libgtk2.0-dev
Clone Mozilla-Central and build
mkdir ~/build && cd ~/build hg clone http://hg.mozilla.org/mozilla-central cd mozilla-central # Apply configure hacks for crosstool-ng toolchain problems, probably could be fixed with better configuration of cross-toolchain hg qimport -P http://pastebin.mozilla.org/?dl=2137908 cat > mozconfig.rsppi ##################################################################### export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig export CPPFLAGS="-I/usr/include/arm-linux-gnueabihf" export CFLAGS="-I/usr/include/arm-linux-gnueabihf" mk_add_options CPPFLAGS=$CPPFLAGS mk_add_options CFLAGS=$CFLAGS FIX_LINK_LDFLAGS="-L/usr/arm-linux-gnueabihf/lib -Wl,-rpath-link=/usr/arm-linux-gnueabihf/lib -L/lib/arm-linux-gnueabihf -Wl,-rpath-link=/lib/arm-linux-gnueabihf" FIX_LINK_LDFLAGS="$FIX_LINK_LDFLAGS -L/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link=/usr/lib/arm-linux-gnueabihf" export LDFLAGS="$FIX_LINK_LDFLAGS" LDFLAGS="$FIX_LINK_LDFLAGS" export WRAP_LDFLAGS="$FIX_LINK_LDFLAGS" mk_add_options LDFLAGS="$FIX_LINK_LDFLAGS" export ac_cv_have_usable_wchar_option_v2="no" ac_add_options --enable-application=browser # or browser for desktop firefox build ac_add_options --disable-tests ac_add_options --disable-dbus ac_add_options --disable-accessibility ac_add_options --disable-webrtc ac_add_options --enable-logging ac_add_options --enable-default-toolkit=cairo-qt # or cairo-gtk2 ac_add_options --enable-mobile-optimize ac_add_options --enable-optimize ac_add_options --enable-system-ffi 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 export CXXFLAGS="$CXXFLAGS -DFORCE_BASICTILEDTHEBESLAYER=1 -DEGL_HAS_BACKING_SURFACE=1 -DUSE_ANDROID_OMTC_HACKS=1 " ac_add_options --disable-elf-hack ac_add_options --enable-libjpeg-turbo ac_add_options --with-gl-provider=EGL mk_add_options MOZ_MAKE_FLAGS="-j4" mk_add_options MOZ_OBJDIR="@TOPSRCDIR@/objdir-arm-rasppi" ac_add_options --with-arm-kuser ac_add_options --with-thumb=toolchain-default ac_add_options --with-arch=armv6 ac_add_options --with-float-abi=hard ac_add_options --with-thumb=no ac_add_options --with-fpu=vfp ac_add_options --with-arm-kuser ##################################################################### # Finally build # switch to sb2 environment sb2 { MOZCONFIG=$(pwd)/mozconfig.rsppi make -f client.mk build_all }