Configuring with a specific Galaxy SII firmware

  • Revision slug: Mozilla/Boot_to_Gecko/Configuring_against_a_specific_Galaxy_SII_firmware
  • Revision title: Configuring against a specific Galaxy SII firmware
  • Revision id: 322767
  • Created:
  • Creator: Seta00
  • Is current revision? No
  • Comment

Revision Content

If you flashed a custom ROM or firwmare that is not compatible with the build system, you might still be able to boot B2G with a compatible kernel. This article explains how to configure against a specific firmware without flashing it to your phone.

You'll need to mount an EXT4 filesystem. If you have a Linux system easily available, it is recommended to follow these steps there, so you can avoid installing EXT4 drivers on Windows/OS X.

Getting the firmware

Download one of the supported firmwares. You can find them on the XDA-Developers forum. This thread has a collection of firmware packages.

Extract the contents of the TAR file inside the ZIP archive. You should see the files boot.bin, cache.img, factoryfs.img, hidden.img and zImage.

Converting the system image

In order to get the files needed by the build system, we'll need to convert the factoryfs.img file to a readable format.

  1. Download the sgs2toext4 tool.
  2. Double click the sgs2toext4.jar file, or run java -jar sgs2toext4.jar in a terminal.
  3. A window will appear. Drag the factoryfs.img file to the drop area.
  4. The program will convert the image to an EXT4 image on the same directory of the original file, called factoryfs.ext4.img

Extracting the data

If you're on Linux, open a terminal, mount the image and extract the data:

  1. sudo mkdir /mnt/tmp
  2. mkdir ~/b2g_system_files
  3. sudo mount -t ext4 factoryfs.ext4.img /mnt/tmp
  4. cp /mnt/tmp/* ~/b2g_system_files

The files will now be in the b2g_system_files folder in your home directory.

On Windows or OS X, you'll need to install special software to mount the EXT4 filesystem. You can also run a Linux VM inside VirtualBox.

Build using the extracted firmware

To build B2G using the firmware you extracted, set the ANDROIDFS_DIR environment variable to ~/b2g_system_files when configuring your tree.

More information at Preparing_for_your_first_B2G_build.

Revision Source

<p>If you flashed a custom ROM or firwmare that is not <a href="https://github.com/mozilla-b2g/android-device-galaxys2/blob/master/extract-files.sh#L53" title="https://github.com/mozilla-b2g/android-device-galaxys2/blob/master/extract-files.sh#L53">compatible</a> with the build system, you might still be able to boot B2G with a compatible kernel. This article explains how to configure against a specific firmware without flashing it to your phone.</p>
<div class="note">
  <p>You'll need to mount an EXT4 filesystem. If you have a Linux system easily available, it is recommended to follow these steps there, so you can avoid installing EXT4 drivers on Windows/OS X.</p>
</div>
<h2>Getting the firmware</h2>
<p>Download one of the supported firmwares. You can find them on the <a href="http://forum.xda-developers.com/forumdisplay.php?f=1055" title="http://forum.xda-developers.com/forumdisplay.php?f=1055">XDA-Developers forum</a>. <a href="http://forum.xda-developers.com/showthread.php?t=1544487" title="http://forum.xda-developers.com/showthread.php?t=1544487">This thread</a> has a collection of firmware packages.</p>
<p>Extract the contents of the TAR file inside the ZIP archive. You should see the files boot.bin, cache.img, factoryfs.img, hidden.img and zImage.</p>
<h2>Converting the system image</h2>
<p>In order to get the files needed by the build system, we'll need to convert the factoryfs.img file to a readable format.</p>
<ol>
  <li>Download the <a href="http://forum.xda-developers.com/attachment.php?attachmentid=1070699&amp;d=1337438078" title="http://forum.xda-developers.com/attachment.php?attachmentid=1070699&amp;d=1337438078">sgs2toext4</a> tool.</li>
  <li>Double click the sgs2toext4.jar file, or run java -jar sgs2toext4.jar in a terminal.</li>
  <li>A window will appear. Drag the factoryfs.img file to the drop area.</li>
  <li>The program will convert the image to an EXT4 image on the same directory of the original file, called factoryfs.ext4.img</li>
</ol>
<h3>Extracting the data</h3>
<p>If you're on Linux, open a terminal, mount the image and extract the data:</p>
<ol>
  <li>sudo mkdir /mnt/tmp</li>
  <li>mkdir ~/b2g_system_files</li>
  <li>sudo mount -t ext4 factoryfs.ext4.img /mnt/tmp</li>
  <li>cp /mnt/tmp/* ~/b2g_system_files</li>
</ol>
<p>The files will now be in the b2g_system_files folder in your home directory.</p>
<div class="note">
  <p>On Windows or OS X, you'll need to install special software to mount the EXT4 filesystem. You can also run a Linux VM inside VirtualBox.</p>
</div>
<h2>Build using the extracted firmware</h2>
<p>To build B2G using the firmware you extracted, set the ANDROIDFS_DIR environment variable to ~/b2g_system_files when <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build#Configuring_for_a_mobile_device" title="https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build#Configuring_for_a_mobile_device">configuring your tree</a>.</p>
<p>More information at <a href="/en-US/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build" title="/en-US/docs/Mozilla/Boot_to_Gecko/Preparing_for_your_first_B2G_build#Configuring_for_a_mobile_device">Preparing_for_your_first_B2G_build</a>.</p>
Revert to this revision