Install FirefoxOS on Nexus S (GT-9023)
By Leo Gaggl
I just had one of my old hand-me-down phones returned by my offspring in a great condition (junior is very careful with his equipment – well done young man !). This doesn’t happen all too often shows that the Nexus S is a decently built phone. This is also a good example of breaking the built-in obsolescence of modern phones. This particular unit has served me well for nearly 2 years (my average is one year) and served 2 kids after that.
These instructions have been compiled on Ubuntu 13.10 64bit to allow me to re-do this process in future. It should work on any Linux based distro (see pre-requisites) – if you are using another Operating System it might be time to switch. Hopefully it might be useful for other people as well.
Installing pre-requisites
As per https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Linux_Prerequisites
wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py<br></br>python bootstrap.py
Ubuntu 13.10 additions
As per https://developer.mozilla.org/en-US/Firefox_OS/Firefox_OS_build_prerequisites#Ubuntu_13.10.
sudo apt-get install --no-install-recommends autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git lib32ncurses5-dev lib32z1-dev zlib1g:amd64 zlib1g-dev:amd64 zlib1g:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip libxml2-utils<br></br>sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 1<br></br>sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 2<br></br>sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 1<br></br>sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 2<br></br>sudo update-alternatives --set gcc "/usr/bin/gcc-4.6"<br></br>sudo update-alternatives --set g++ "/usr/bin/g++-4.6"
Check out & build Firefox OS
git clone git://github.com/mozilla-b2g/B2G.git<br></br>cd B2G<br></br>echo "export HIDPI=1" > .userconfig<br></br>./config.sh nexus-s<br></br>./build.sh -j3
The config script will take quite some time depending on your internet connection as it has to download a lot of data. The build time will depend on your machine. In my case it took xx hours for the config and yy hours for build.
Notes
I had the following error with the config script: https://bugzilla.mozilla.org/show_bug.cgi?id=956098 (workaround contained in comments).
Install on the phone
NOTE: Before doing this you obviously want to backup your phone & data if you have anything useful on there (in my case not necessary).
NOTE: Before doing this step you need to ensure that the Nexus S bootloader is unlocked
- Reboot the Nexus S into bootloader mode by pressing volume up + power buttons simultaneously until you see the bootloader screen
- Connect the device to the PC via the USB cable
- Check the line “LOCK STATE – LOCKED”
If the unit is locked you can unlock it by issuing the following command
fastboot oem unlock
And use the VOLUME key to select + the POWER key to confirm/
Flash the phone
./flash.sh
VOILA !
Or you can do it manually by using fastboot to copy the images
fastboot erase boot<br></br>fastboot erase system<br></br>fastboot erase userdata<br></br>fastboot flash userdata userdata.img<br></br>fastboot flash system system.img<br></br>fastboot flash boot boot.img<br></br>fastboot reboot
For the people that don’t want or can not (time to upgrade your OS!) build I have uploaded the resulting images (Build Date: 2014-01-20) to GoogleDrive. As usual this comes with a warning – proceed at your own risk !
If you want to return back to the factory Android ROM you can find the Google images here: https://developers.google.com/android/nexus/images
Now this unit will serve as a secondary phone (being compared against Ubuntu Touch on a Nexus N4) while Overseas where I generally need 2 phones.
Thank you Mozilla foundation for all the work and making it available fully in Open Source ! If you haven’t done so it’s time to join here: https://sendto.mozilla.org/
Thank you to Google for NOT making it harder than necessary to extend the usefulness of their NEXUS range of phones and tablets. And in the same breath curse you SAMSUNG, APPLE, … ! The reason for me moving phones actually was the fact that the Galaxy S4 is such a P.I.T.A. to get upgraded and get rid of the Samsung bloatware. Back on the Nexus range – in hindsight I should have never left.