soapdog / b2g-mips

A repository to hold the patches to build Firefox OS (B2G) for the Ingenic tablet reference (MIPS platform)
8 stars 2 forks source link

Porting Firefox OS v2.0 on MIPS Architecture

This is a manual for building Firefox OS V2.0 for MIPS architecture emulator. The manual is written for 64bit Debian Wheezy and 64bit Ubuntu 12.04 operating systems.

For more info and hardware requirements see: https://developer.mozilla.org/Firefox_OS/Firefox_OS_build_prerequisites#Requirements_for_Linux

Preparing the Build Environment

dpkg --print-foreign-architectures

If i386 is not in the output list, execute following line:

sudo dpkg --add-architecture i386

sudo apt-get install bison bzip2 ccache curl flex gawk git make patch zip sudo apt-get install build-essential autoconf2.13 g++-multilib libc6-dev sudo apt-get install python python-markdown sudo apt-get install libxml2-utils libreadline6 gnupg sudo apt-get install libncurses5-dev:i386 zlib1g-dev:i386 ia32-libs lib32z1-dev sudo apt-get install libxrender1 libdbus-glib-1-2 libgtk2.0-0 ia32-libs-gtk sudo apt-get install libgl1-mesa-dev libglapi-mesa:i386 libgl1-mesa-glx:i386 libgl1-mesa-dri:i386

Install python-dev library. For Debian systems use version 2.6, and for Ubuntu use 2.7.

sudo apt-get install python2.6-dev

sudo apt-get install python2.7-dev

Install and setup Mesa:

sudo apt-get install x11proto-core-dev libx11-dev libx11-dev:i386 sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Install Java:

sudo update-java-alternatives -s java-6-sun wget --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" -O jdk-6u45-linux-x64.bin http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin sudo mkdir -p /usr/lib/jvm sudo mv jre1.6.0_45 /usr/lib/jvm/ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_45/bin/java" 1

sudo apt-get install gcc-4.6 g++-4.6 gcc-4.6-multilib g++-4.6-multilib sudo ln -sf gcc-4.6 /usr/bin/gcc sudo ln -sf g++-4.6 /usr/bin/g++

Checking out Source Code

cd /workarea/fxos-mips-20150901

Untar files from patches.tar archive:

tar -xf /ffos-mips-20140901.tar

Clone the b2g manifest repository:

git clone https://github.com/mozilla-b2g/b2g-manifest.git -b v2.0

Add the new manifest files (emulator-mips-jb.xml and ingenic-npm801.xml). Manifest files contain a snapshot descriptions of B2G project for the 1st of September 2014.

cd b2g-manifest/ git am ../patches/emulator/manifest-MIPS-emulator.patch git am ../patches/ingenic/manifest-MIPS-npm801-device.patch cd ../

Checkout B2G tools from github.com:

git clone https://github.com/mozilla-b2g/B2G.git cd ./B2G git checkout f0a118cc40ead852710bf409c3847d73250f403b

Config.sh script is used to call repo command with predefined parameters. We need to patch the script, so it can work with the newly added manifest files:

export B2G_HOME=pwd git am $B2G_HOME/../patches/emulator/config-.patch git am $B2G_HOME/../patches/ingenic/config-.patch

Adding MIPS Support for Emulator

cd $B2G_HOME GITREPO="pwd/../b2g-manifest" BRANCH=v2.0 ./config.sh emulator-mips-jb

git am $B2G_HOME/../patches/emulator/b2g-*.patch

cd $B2G_HOME/gonk-misc git am $B2G_HOME/../patches/emulator/gonk-*.patch

cd $B2G_HOME/bionic git am $B2G_HOME/../patches/emulator/bionic-*.patch

cd $B2G_HOME/device/generic/goldfish git am $B2G_HOME/../patches/emulator/goldfish-*.patch

cd $B2G_HOME/gecko git am --whitespace=nowarn $B2G_HOME/../patches/emulator/gecko-*.patch

cd $B2G_HOME/external/qemu git am $B2G_HOME/../patches/emulator/qemu-*.patch

cd $B2G_HOME

./build.sh

./run-emulator.sh

Adding MIPS Support for Ingenic tablet

cd $B2G_HOME GITREPO="pwd/../b2g-manifest" BRANCH=v2.0 ./config.sh ingenic-npm801

NOTE: All patches for emulator build must be applied first before proceeding with further instructions for tablet build.

cd $B2G_HOME git am $B2G_HOME/../patches/ingenic/b2g-*.patch

cd $B2G_HOME/external/bluetooth/bluedroid git am $B2G_HOME/../patches/ingenic/bluedroid-*.patch

cd $B2G_HOME/build git am $B2G_HOME/../patches/ingenic/build-*.patch

cd $B2G_HOME/device/ingenic/npm801 git am $B2G_HOME/../patches/ingenic/device-ingenic-*.patch

cd $B2G_HOME/device/generic/goldfish git am $B2G_HOME/../patches/ingenic/device-goldfish-*.patch

cd $B2G_HOME/gaia git am $B2G_HOME/../patches/ingenic/gaia-*.patch

cd $B2G_HOME/gecko git am $B2G_HOME/../patches/ingenic/gecko-*.patch

cd $B2G_HOME/gonk-misc git am $B2G_HOME/../patches/ingenic/gonk-*.patch

cd $B2G_HOME/hardware/ingenic/xb4780 git am $B2G_HOME/../patches/ingenic/hardware-ingenic-*.patch

cd $B2G_HOME ./build.sh

Flashing image files onto device

NOTE: If tablet does not have a new fastboot compatible X-boot, refer first to instructions given at end of this section. Afterwards, return to instructions at beginning of this section.

sudo su

source build/envsetup.sh lunch full_npm801-userdebug

fastboot devices

Return message from fastboot should be this:

Google, Inc fastboot

fastboot -w flashall


Update the bootloader

!!!NOTE!!!: Needs to be done ONLY once, it installs a new fastboot compatible X-boot.

cd $B2G_HOME/device/ingenic/npm801/ingenic-xboot-updater/

sudo ./ingenic-xboot-updater --boot=x-boot-nand.bin