Configuring with a specific Galaxy SII firmware

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/system

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.