How to Install Dual Boot in Firefox OS and Android OS Environment
Mozilla finally enters smartphone operating system business with their Firefox OS. Devices using the mobile operating system are now rolled out by major hardware companies.
Sony Mobile, known for Xperia line up of devices which runs on Android, announced their intention to expand horizons in the market, like ZTE and Alcatel.
LG and Huawei seemed to have completed their first Firefox devices.
No exact price, specifications, or release dates have been announced but the audience is waiting just in case the Firefox smartphone appears in the ongoing Mobile World Congress 2013.
Firefox OS is also known under a project called B2G or Boot to Gecko, a Linux-based open source operating system for smartphones and tablet computer being developed by Mozilla. Since it is an open source OS like Android's environment, both operating systems can co-exist in one devices using dual-boot mode.
Mozilla Developer Network has posted on their Web site on how the two can be downloaded using a Samsung Galaxy S2.
Warning: This is not an officially supported configuration. Use this at your own discretion. Make sure the files in device has a backup and a stock ROM is available for system restoration.
Prerequisites: Check the Firefox OS Build Requirements before doing something to Galaxy S2.
- The device must have Android 4.0 or Ice Cream Sandwich installed, otherwise the process will not work correctly.
- A B2G must be built for the Galaxy S2
- Download Siyah Kernel v5.0.1 for Galaxy S2
- The tool "simg2img" is needed which automatically received from building B2G or Boot to Gecko
- Heimdall tool with the best version of 1.3.1 not 1.3.2 which problems are possible to encounter.
One-time Operations
There are several operations on how to do a working dual boot. The following ones need to be done the first time only. For "heimdall" tool to work without requiring root access for Android, you need to create a file called "android.rules" and place it in /etc/udev/rules.d (uDev is a Device File System using Linux 2.6 kernel series). The file should contain the following line:
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
To activate the rule, restart udev:
sudo service udev restart
Unplug and replug in the phone. The above rule will now allow adb to access the Samsung Galaxy S2 without requiring root privileges.
Flashing the Siyah Kernel:
This kernel is a must for dual boot because it is the one which manages it. Decompress the tar file after download and a file named "zImage" will remain. To flash it , follow these steps:
1. Turn off the phone
2. Reboot to Download Mode. Press volume down, home, power keys simultaneously, when asked, volume up key.
3. Use the heimdall tool to flash the kernel using the following commands. The phone should be connected to the computer.
heimdall flash -kernel /path/to/zImage
4. After the kernel is flashed, reboot the phone.
Preparing the Firefox OS ROM:
After installing the Siyah kernel, its functions will be needed to prepare the environment to install your B2G image in the secondary partition.
1. Switch off your phone.
2. Reboot to Recovery Mode
3. In the ClockWorkMod recovery touch interface, go to dual-boot options > Wipe 2ndROM data/cache > Yes - Wipe. The operation will take some time.
4. After the data wipe, Go Back and select Reboot System Now to reboot your phone. A directory named ".secondrom" will now exist inside the internal storage of your phone, containing two files named "cache.img" and "data.img".
Boot to Gecko update operations:
Every time you want to build a new version of B2G, the following operations must be done:
1. To simplify command line instructions, it is advised to copy all needed files in a same folder of your choice. Below are the files needed to be copied.
2. simg2img - found in B2G/out/target/product/galaxys2/system/bin
3. system.img - found in B2G/out/target/product/galaxys2
4. userdata.img - B2G/out/target/product/galaxys2
Do the following steps once all of the files are copied in one place:
1. Create a data.img file out of the sparse file userdata.img.
simg2img userdata.img data.img
2. Put the data.img file on your phone's .secondrom folder. You can do this by enabling file storage mode on your phone or connecting to the PC. The USB debug must be active:
adb push /path/to/data.img /sdcard/.secondrom/data.img
3. Turn off your phone
4. Reboot to Download Mode
5. Use heimdall tool to flash B2G firmware inside the second partition:
Heimdall flass -hidden system.img
6. After the flash, reboot the phone and at boot time you can boot into your second rom or Firefox OS by pressing the home button during the bootloader countdown.
Boot Operations
Every you boot inside B2Gm, the Gaia inside the system.img B2G image always get lost when you turn off the phone, and reinstallation is needed to whenever you want to boot inside B2G. To install Gaia, type the following on a console after the phone booted inside B2g, which is will be a black screen, and make sure that it is connected to the computer:
cd B2G/gaia
GAIA_DOMAIN=foo.org make install-gaia
After Gaia has successfully uploaded, the phone's screen will display the B2G interface.