firefox-5 Hello again, and welcome back to our next excursion into Firefox OS.

Today I will show you how I built Firefox OS v1.3 for my ZTE Open.

First of all, let me say that probably the best way to build your own Firefox OS is to either use a desktop/laptop you do not use anymore, or virtualize a dedicated build-machine. I chose to virtualize the build machine with VirtualBox (it’s available for Windows and Linux).

Firefox OS can be built either on 64bit Linux, or OSX if you happen to have an Apple.

My Laptop is installed with Windows 8, has 16GB of memory and an i7 4002mq quad core.

The virtual machine I created with VirtualBox has 5GB of memory (4 is minimum) and 2 cores, capped at 90% execution. The Harddisk size I chose is 50GB – you will need at least 30GB and that could potentially be not enough. I won’t go through the details of setting up VirtualBox, there are tutorials out there to help you with that.

Here it’s also important to mention that you will also need the VirtualBox Extension Packs because you need to be able to attach USB devices.

The VM was then installed with Ubuntu 12.04.4 LTS 64bit. I did this by downloading the Desktop Live-CD.

After successfull installation, follow the instructions of how to set up your build environment on Mozilla Developer Network:
https://developer.mozilla.org/en-US/Firefox_OS/Firefox_OS_build_prerequisites.firefox

I won’t detail this here because I would encourage you to actually read through the instructions there to better understand what is going on.
also, if you want to use a different Linux Distribution (such as Mint or Fedora) everything you need is described there also.

You will also need adb and fastboot, which is described here:
https://developer.mozilla.org/en-US/Firefox_OS/Debugging/Installing_ADB

If you haven’t already configured udev rules, this how to do it:

  • Create a file 51-android.rules in /etc/udev/rules.d/ and put this inside:
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

The first line is for ADB to recognize your zte roamer2 (=open)
The second line is for fastboot

  • Restart udev like so:
sudo service udev restart
  • Now connect your ZTE Open (dont forget to attach it to the VM)
  • Check if you can see it:
adb devices

it should show

[email protected]:~$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
full_inari    device

In your case it should show ZTE open/roamer2 instead of inari.

Now go get the 1.1 update from ZTE, you have to install that first.
Depending on your geo and the revision of your phone you need to download the right update:

If all went well, you should now be on V1.1 – hurray.

  • Now move on in the description on MDN of how to get the code. (git clone etc.)
  • Configure the build. If you want a clean enduser build its like this:
BRANCH=v1.3 VARIANT=user ./configure inari

inari is the code name for the ZTE open.

This is going to take a LONG time, depending on how fast your internet is, it’s going to fetch about 17GB.

Once this is done, go ahead and build. In order to do that, your phone needs to be connected and attached, because the first time it’s going to pull the system folder for the build process.

  • so to really build ->
BRANCH=v1.3 VARIANT=user ./build.sh

If you set up the build machine correctly, this should be successful.

Now comes the tricky part. Since the hal is provided by ZTE and also the RIL proxy is a binary blob, if you flash your phone now it will be stuck in a boot loop. You don’t want a boot loop, so we will fix the problem beforehand.

To avoid the boot loop, you will need:

  1. boot.img contained in the v1.1 update zip
  2. abootimg (is a standard Ubuntu package, install as usual with sudo apt-get install abootimg)
  3. mkbootfs
  4. mkbootimg – the last two tools are from the android source code, either you compile them from there or you ask Mr. Google – there ar precompiled ones to download.
  • If you have all 4 of these ready to go, do as follows:
abootimg -x boot.img
mkdir a_dir; cd a_dir
gunzip -c ../initrd.img | cpio -i

This will extract the boot.img file and the included initrd.img so you can edit it.

  • Edit default.prop so it looks like this:
[email protected]:~/FXOS/bootimg/a_dir$ cat default.prop
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
persist.sys.usb.config=adb
persist.usb.serialno=full_inari
  • Edit init.b2g.rc (you need to comment out everything related to the RIL proxy)
[email protected]:~/FXOS/bootimg/a_dir$ cat init.b2g.rc
service fakeperm /system/bin/fakeperm
class main
user root

service b2g /system/bin/b2g.sh
class main
onrestart restart media

#service rilproxy /system/bin/rilproxy
# class main
# socket rilproxy stream 660 root system
# user root
# group radio

on boot
exec /system/bin/rm -r /data/local/tmp
# set RLIMIT_NOFILE to increase soft limit from 1024(default) to 2048.
# Hard limit keeps default value(4096).
setrlimit 7 2048 4096
  • Last but not least, edit init.rc. Go to line 111 where it mounts all the filesystems and change it to look like this:
# mount mtd partitions
    # Mount /system rw first to give the filesystem a chance to save a checkpoint
    mount yaffs2 [email protected] /system
# make bootable b2g environment
    chmod 0755 /system/b2g/b2g
    chmod 0755 /system/b2g/updater
    chmod 0755 /system/b2g/plugin-container
#done, b2g should work now
    mount yaffs2 [email protected] /system ro remount

All done. Bravo.

  • Repack everything like this:
mkbootfs . | gzip > ../newinitramfs.cpio.gz
cd ..
mkbootimg --kernel zImage --ramdisk newinitramfs.cpio.gz --base 0x200000 --cmdline 'androidboot.hardware=roamer2' -o newboot.img
  • Copy the new boot image to the finished build so you can flash it together with it: (adjust the path to your environment)
cp newboot.img ~/B2G/out/target/product/inari/boot.img 

Now when you then flash your phone the boot.img will be flashed also.

This is the last chance you get to backup anything, because in the next step the phone will be wiped clean (the sdcard will be left alone – but your contacts etc. are gone)

  • Go back to the B2G folder and flash your phone (again, your phone has to be connected and attached)
./flash.sh

This will reboot your phone into fastboot mode – if you use Virtualbox, you have to reattach the Android “bla bla” now, then the process should go through until you see -”trying to set time”,

  • Then your phone should be booting and you have to reattach it again in Virtualbox.

If all went ok, it should be successful now.

Bravo, you just installed Firefox OS 1.3. If you have any questions or comments, please feel to ask in the comments or at www.chinaphonearena.com

How To Build Firefox OS 1.3 Roland Lindner How ToRecentTutorials,,,
Hello again, and welcome back to our next excursion into Firefox OS. Today I will show you how I built Firefox OS v1.3 for my ZTE Open. First of all, let me say that probably the best way to build your own Firefox OS is to either use a desktop/laptop...
<img class="size-full wp-image-4217 alignleft" src="http://www.gizbeat.com/wp-content/uploads/2014/04/firefox-51.jpg" alt="firefox-5" width="222" height="227" /> Hello again, and welcome back to our next excursion into Firefox OS. Today I will show you how I built Firefox OS v1.3 for my ZTE Open. First of all, let me say that probably the best way to build your own Firefox OS is to either use a desktop/laptop you do not use anymore, or virtualize a dedicated build-machine. I chose to virtualize the build machine with VirtualBox (it’s available for Windows and Linux). Firefox OS can be built either on 64bit Linux, or OSX if you happen to have an Apple. My Laptop is installed with Windows 8, has 16GB of memory and an i7 4002mq quad core. The virtual machine I created with VirtualBox has 5GB of memory (4 is minimum) and 2 cores, capped at 90% execution. The Harddisk size I chose is 50GB - you will need at least 30GB and that could potentially be not enough. I won’t go through the details of setting up VirtualBox, there are tutorials out there to help you with that. Here it’s also important to mention that you will also need the VirtualBox Extension Packs because you need to be able to attach USB devices. The VM was then installed with Ubuntu 12.04.4 LTS 64bit. I did this by downloading the Desktop Live-CD. After successfull installation, follow the instructions of how to set up your build environment on Mozilla Developer Network: <a href="https://developer.mozilla.org/en-US/Firefox_OS/Firefox_OS_build_prerequisites.">https://developer.mozilla.org/en-US/Firefox_OS/Firefox_OS_build_prerequisites.</a><img class="aligncenter size-full wp-image-4218" src="http://www.gizbeat.com/wp-content/uploads/2014/04/firefox.jpg" alt="firefox" width="259" height="194" /> I won’t detail this here because I would encourage you to actually read through the instructions there to better understand what is going on. also, if you want to use a different Linux Distribution (such as Mint or Fedora) everything you need is described there also. You will also need adb and fastboot, which is described here: <a href="https://developer.mozilla.org/en-US/Firefox_OS/Debugging/Installing_ADB">https://developer.mozilla.org/en-US/Firefox_OS/Debugging/Installing_ADB</a> If you haven't already configured udev rules, this how to do it: <ul class="fox"> <li>Create a file 51-android.rules in /etc/udev/rules.d/ and put this inside:</li> </ul> <pre><code>SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev" SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" </code></pre> The first line is for ADB to recognize your zte roamer2 (=open) The second line is for fastboot <ul class="fox"> <li>Restart udev like so:</li> </ul> <pre><code>sudo service udev restart </code></pre> <ul class="fox"> <li>Now connect your ZTE Open (dont forget to attach it to the VM)</li> <li>Check if you can see it:</li> </ul> <pre><code>adb devices </code></pre> it should show <pre><code>[email protected]:~$ adb devices * daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached full_inari device </code></pre> In your case it should show ZTE open/roamer2 instead of inari. Now go get the 1.1 update from ZTE, you have to install that first. Depending on your geo and the revision of your phone you need to download the right update: <ul class="fox"> <li>For UK phones go here: <a href="http://www.ztedevices.com/support/smart_phone/cba40ed6-d3ab-44c0-bdee-3a15803dc187.html">http://www.ztedevices.com/support/smart_phone/cba40ed6-d3ab-44c0-bdee-3a15803dc187.html</a></li> <li>For US ones here: <a href="http://www.ztedevices.com/support/smart_phone/b5a2981a-1714-4ac7-89e1-630e93e220f8.html">http://www.ztedevices.com/support/smart_phone/b5a2981a-1714-4ac7-89e1-630e93e220f8.html</a></li> <li>Extract the zip file, there is another zip and the instructions in there.</li> <li>Copy the zip on the sdcard of your ZTE open (does not work if you do not have one)</li> <li>Boot to recovery (hold Power and Volume up) and istall from sdcard. if in doubt, follow the included instructions.</li> </ul> If all went well, you should now be on V1.1 - hurray. <ul class="fox"> <li>Now move on in the description on MDN of how to get the code. (git clone etc.)</li> <li>Configure the build. If you want a clean enduser build its like this:</li> </ul> <pre>BRANCH=v1.3 VARIANT=user ./configure inari </pre> inari is the code name for the ZTE open. This is going to take a LONG time, depending on how fast your internet is, it’s going to fetch about 17GB. Once this is done, go ahead and build. In order to do that, your phone needs to be connected and attached, because the first time it’s going to pull the system folder for the build process. <ul class="fox"> <li>so to really build -></li> </ul> <pre><code>BRANCH=v1.3 VARIANT=user ./build.sh </code></pre> If you set up the build machine correctly, this should be successful. Now comes the tricky part. Since the hal is provided by ZTE and also the RIL proxy is a binary blob, if you flash your phone now it will be stuck in a boot loop. You don’t want a boot loop, so we will fix the problem beforehand. To avoid the boot loop, you will need: <ol> <li>boot.img contained in the v1.1 update zip</li> <li>abootimg (is a standard Ubuntu package, install as usual with sudo apt-get install abootimg)</li> <li>mkbootfs</li> <li>mkbootimg - the last two tools are from the android source code, either you compile them from there or you ask Mr. Google - there ar precompiled ones to download.</li> </ol> <ul class="fox"> <li>If you have all 4 of these ready to go, do as follows:</li> </ul> <pre><code>abootimg -x boot.img mkdir a_dir; cd a_dir gunzip -c ../initrd.img | cpio -i </code></pre> This will extract the boot.img file and the included initrd.img so you can edit it. <ul class="fox"> <li>Edit default.prop so it looks like this:</li> </ul> <pre><code>[email protected]:~/FXOS/bootimg/a_dir$ cat default.prop # # ADDITIONAL_DEFAULT_PROPERTIES # ro.secure=0 ro.allow.mock.location=1 ro.debuggable=1 persist.sys.usb.config=adb persist.usb.serialno=full_inari </code></pre> <ul class="fox"> <li>Edit init.b2g.rc (you need to comment out everything related to the RIL proxy)</li> </ul> <pre><code>[email protected]:~/FXOS/bootimg/a_dir$ cat init.b2g.rc service fakeperm /system/bin/fakeperm class main user root service b2g /system/bin/b2g.sh class main onrestart restart media #service rilproxy /system/bin/rilproxy # class main # socket rilproxy stream 660 root system # user root # group radio on boot exec /system/bin/rm -r /data/local/tmp # set RLIMIT_NOFILE to increase soft limit from 1024(default) to 2048. # Hard limit keeps default value(4096). setrlimit 7 2048 4096 </code></pre> <ul class="fox"> <li>Last but not least, edit init.rc. Go to line 111 where it mounts all the filesystems and change it to look like this:</li> </ul> <pre><code># mount mtd partitions # Mount /system rw first to give the filesystem a chance to save a checkpoint mount yaffs2 [email protected] /system # make bootable b2g environment chmod 0755 /system/b2g/b2g chmod 0755 /system/b2g/updater chmod 0755 /system/b2g/plugin-container #done, b2g should work now mount yaffs2 [email protected] /system ro remount </code></pre> All done. Bravo. <ul class="fox"> <li>Repack everything like this:</li> </ul> <pre><code>mkbootfs . | gzip > ../newinitramfs.cpio.gz cd .. mkbootimg --kernel zImage --ramdisk newinitramfs.cpio.gz --base 0x200000 --cmdline 'androidboot.hardware=roamer2' -o newboot.img </code></pre> <ul class="fox"> <li>Copy the new boot image to the finished build so you can flash it together with it: (adjust the path to your environment)</li> </ul> <pre><code>cp newboot.img ~/B2G/out/target/product/inari/boot.img </code></pre> Now when you then flash your phone the boot.img will be flashed also. This is the last chance you get to backup anything, because in the next step the phone will be wiped clean (the sdcard will be left alone - but your contacts etc. are gone) <ul class="fox"> <li>Go back to the B2G folder and flash your phone (again, your phone has to be connected and attached)</li> </ul> <pre><code>./flash.sh</code></pre> This will reboot your phone into fastboot mode - if you use Virtualbox, you have to reattach the Android “bla bla” now, then the process should go through until you see -”trying to set time”, <ul class="fox"> <li>Then your phone should be booting and you have to reattach it again in Virtualbox.</li> </ul> If all went ok, it should be successful now. Bravo, you just installed Firefox OS 1.3. If you have any questions or comments, please feel to ask in the comments or at <a href="www.chinaphonearena.com">www.chinaphonearena.com</a>