Building B2G for Samsung Galaxy S2

  • Revision slug: Mozilla/Boot_to_Gecko/Building_B2G_for_Samsung_Galaxy_S2
  • Revision title: Building B2G for Samsung Galaxy S2
  • Revision id: 13971
  • Created:
  • Creator: jhammink
  • Is current revision? No
  • Comment 1 words added, 9 words removed

Revision Content

It is assumed you've already setup your build environment and cloned the repositories.

It is advisable to follow the instructions in the order presented.

Backing up your Galaxy S2's native OS

You'll want to back up your phone's factory image before attempting to build or flash anything to it.  As it happens, the builds or flash process itself can be unstable and you don't want to end up with a brick.

These instructions assume that you have already installed heimdall.

From some other directory than where you have B2G installed:
$ cd /tmp
$ wget http://cmw.22aaf3.com/c1/recovery/re...4-galaxys2.tar
$ tar xvf recovery-clockwork-*tar
$ adb reboot download


When your phone is in "download" mode, it's ready to be flashed using Odin protocol.

To Flash Clockworked (and backup image):
With your phone in "download" mode, run the following:
$ heimdall flash --kernel zImage

Next, reboot the phone to recovery mode.
$ adb reboot recovery

With the phone in recovery mode, follow the on-screen instructions to make a backup image.

Building for Samsung Galaxy S2

Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories:

$ cd B2G
$ make sync


FIRST TIME ONLY: you should configure local.mk with WIDGET_BACKEND parameter:
$ sudo nano local.mk
 
and add the following line:
WIDGET_BACKEND=gonk

Next, you will setup your build directory with the binary blobs necessary for building for your device.  With your device booted to the original Android OS, connected via USB and running:
$ make config-galaxy-s2

Now, build gonk backend and the system itself:
$ make gonk
$ make

 

Flashing to Samsung Galaxy S2

Making and flashing the kernel (first time only)

$ make kernel
$ adb reboot download
$ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImage

Flashing B2G

$ adb reboot recovery
$ make flash-only


Building and flashing Gaia frontend

Assuming you're in the root of B2G repo:
$ cd gaia

Pull files from the remote repo and merge them to your local repo:

$ git pull origin master
$ cd ..

Install Gaia (by copying files from repo to your device).

$ make install-gaia
$ make kill-b2g

Revision Source

<p>It is assumed you've already <a href="Setting_Up_Boot_to_Gecko_Build_Environment" rel="internal" title="https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko/Setting_Up_Boot_to_Gecko_Build_Environment">setup your build environment and cloned the repositories</a>.</p>
<p>It is advisable to follow the instructions in the order presented.</p>
<h2>Backing up your Galaxy S2's native OS</h2>
<p>You'll want to back up your phone's factory image before attempting to build or flash anything to it.  As it happens, the builds or flash process itself can be unstable and you don't want to end up with a brick.<br> <br> These instructions assume that you have already <a href="/en/Mozilla/Boot_to_Gecko/Setting_Up_Boot_to_Gecko_Build_Environment#Installing_Heimdall" title="https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko/Setting_Up_Boot_to_Gecko_Build_Environment#Installing_Heimdall">installed heimdall</a>.<br> <br> From some other directory than where you have B2G installed:<br> <code>$ cd /tmp<br> $ wget <a class=" external" href="http://cmw.22aaf3.com/c1/recovery/recovery-clockwork-4.0.1.4-galaxys2.tar" rel="freelink">http://cmw.22aaf3.com/c1/recovery/re...4-galaxys2.tar</a><br> $ tar xvf recovery-clockwork-*tar<br> $ adb reboot download</code><br> <br> When your phone is in "download" mode, it's ready to be flashed using Odin protocol.<br> <br> To Flash Clockworked (and backup image):<br> With your phone in "download" mode, run the following:<br> <code>$ heimdall flash --kernel zImage</code><br> <br> Next, reboot the phone to recovery mode.<br> <code>$ adb reboot recovery</code><br> <br> With the phone in recovery mode, follow the on-screen instructions to make a backup image.</p>
<h2>Building for Samsung Galaxy S2</h2>
<p>Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories:<br> <br> <code>$ cd B2G<br> $ make sync</code><br> <br> FIRST TIME ONLY: you should configure <code>local.mk</code> with <code>WIDGET_BACKEND</code> parameter:<br> <code>$ sudo nano local.mk</code><br>  <br> and add the following line:<br> <code>WIDGET_BACKEND=gonk</code><br> <br> Next, you will setup your build directory with the binary blobs necessary for building for your device.  With your device booted to the original Android OS, connected via USB and running:<br> <code>$ make config-galaxy-s2</code><br> <br> Now, build gonk backend and the system itself:<br> <code>$ make gonk<br> $ make</code></p>
<p><a class="external" href="http://4.bp.blogspot.com/-IaDmq-AlC_I/TydgNEkHvAI/AAAAAAAAAMs/G2DJfdUkIts/s320/Make.tiff"><img alt="" class="default" src="http://4.bp.blogspot.com/-IaDmq-AlC_I/TydgNEkHvAI/AAAAAAAAAMs/G2DJfdUkIts/s320/Make.tiff"></a></p>
<p> </p>
<h3><strong>Flashing to Samsung Galaxy S2</strong></h3>
<h4>Making and flashing the kernel (first time only)</h4>
<p><code>$ make kernel<br> $ adb reboot download<br> $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImage</code><br>
</p>
<h4>Flashing B2G</h4>
<p><code>$ adb reboot recovery<br> $ make flash-only</code></p>
<p><a class="external" href="http://2.bp.blogspot.com/-Cw8CGBVxAbM/TydgXiJA5hI/AAAAAAAAAM0/qbV_5QapWi4/s320/flashing+OS.tiff"><img alt="" class="default" src="http://2.bp.blogspot.com/-Cw8CGBVxAbM/TydgXiJA5hI/AAAAAAAAAM0/qbV_5QapWi4/s320/flashing+OS.tiff"></a></p>
<h4><br> Building and flashing Gaia frontend</h4>
<p>Assuming you're in the root of B2G repo:<br> <code>$ cd gaia</code></p>
<p>Pull files from the remote repo and merge them to your local repo:</p>
<p><code>$ git pull origin master<br> $ cd ..</code></p>
<p>Install Gaia (by copying files from repo to your device).</p>
<p><code>$ make install-gaia<br> $ make kill-b2g</code></p>
Revert to this revision