Setting up Ubuntu 12.04 Virtual Machine for Firefox OS Build
Ultimately, I want to try installing FirefoxOS on my old Xperia X8 phone and give it a new lease of life. For now, this is just a few words on my experience building FirefoxOS for emulator. This was all done on Windows 8.1 with Ubuntu 12.04 64bit virtual machine running in Virtual Box 4.3.6. Even though the guide says otherwise, it is possible to run the emulator inside Virtual Box.
Right at the start I had issues with even running Ubuntu installation. Virtual Box is offering, when configuring the type of operating system, Ubuntu 64bit distribution, however, the option did not show up initially. With plain Ubuntu selected it just doesn’t work. The issue was that Hyper-V client was installed on my machine and prevented Virtual Box from using virtualization support (AMD-V or Intel VT-x) even though it had been enabled in BIOS. The solution was to uninstall Hyper-V, then Ubuntu 64bit option appeard in the drop down list (along with other 64bit Linux distributions).
With that out of the way I created a Ubuntu 64bit virtual machine with 4GB of RAM and HDD of 40GB. I tried initially with less memory and HDD space but the system and the build take over 30GB so I’d say 40GB is a must.
Install Ubuntu 12.04, then Virtual Box Guest Addons (addons are optional but just makes life so much easier … until it comes to running the emulator).
Next are the commands that need to be run.
sudo apt-get update sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip sudo apt-get install libgl1-mesa-dev libglapi-mesa:i386 libgl1-mesa-glx:i386 sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so sudo apt-get install binutils-gold ccache --max-size 3GB git clone git://github.com/mozilla-b2g/B2G.git cd B2G ./config.sh emulator ./build.sh
The first two lines are straight from the prerequsites guide (Requirements for Linux). The third, fourth and fifth are to overcome emulator build issues. The next one is for fixing “…is referenced by DSO” error. And the rest is cach configuration, cloning and configuring repository and finally building. Emulator build issue will come up and DSO error will come up, did I mention I failed to follow the script a couple of times? Btw, configuration is actually getting the necessary projects to be built, B2G project is just build system. It takes a while to download everything – talking about an hour or two on a speedy connection. Build takes a while too, an hour or two … well, I don’t remember to be honest, I was doing other things while this was happening :$
Anyway, the last remaining thing is making emulator run. It is as simple as: ./run-emulator.sh … well, after a few other tweaks. 3D acceleration needs to be enabled in Virtual Box for this virtual machine. That’s simple. The issue I spent some time figuring out was how to make emulator running properly because it was showing only blank screen due to OpenGL error. Since my X server got corrupt at one stage – booted into a blank screen, I uninstalled Virtual Box Guest Addins, and that made emulator start working. It’s quite a pain in the back to use virtual machine without the guest addon, so the trick is to install it but disable vboxvideo module. Easier said than done. I tried few things and black listing doesn’t work, rmmod didn’t work either etc. I’m not that good with Linux, but the solution I came up with didn’t need any sophistication whatsoever.
The fix is to remove or rename vboxvideo.ko so it is not loaded on startup. Ha Didn’t I say no sophistication! I found vboxvideo.ko in : /lib/modules/3.8.0-35-generic/misc and renamed it with sudo mv videobox.ko _videobox.ko (or you could use /lib/modules/`uname -a`/misc/ to get to the module)
Anyway, after rebooting the virtual machine here’s the result: