mozilla

Revision 13990 of 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: 13990
  • Created:
  • Creator: philikon
  • Is current revision? No
  • Comment 2 words added, 259 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.

Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.

Backing up your Galaxy S2's vendor 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/recovery-clockwork-4.0.1.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.

After creating the backup image, reboot into Android and backup the system files to your local machine for use later. 
$ mkdir sgs2-android
$ cd sgs2-android
$ adb pull /system system
$ adb pull /vendor vendor

Building

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

Important: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.

Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:

$ export ANDROIDFS_DIR=sgs2-android
$ make config-galaxy-s2

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

 

Flashing

Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)

$ 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, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device):
$ cd gaia
$ git pull origin master
$ cd ..
$ make install-gaia
$ make kill-b2g

Building and flashing Gecko only

$ make install-gecko
$ make kill-b2g

Forcing GIT repo into clean state

body

Revision Source

<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">It is assumed you've already </a><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><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">.</a></p>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">It is advisable to follow the instructions in the order presented.</a></p>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><strong>Note:</strong> There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.</a></p>
<h2><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Backing up your Galaxy S2's vendor OS</a></h2>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">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><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><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">.<br> <br> From some other directory than where you have B2G installed:<br> <code>$ cd /tmp<br> $ wget http://cmw.22aaf3.com/c1/recovery/recovery-clockwork-4.0.1.4-galaxys2.tar<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.</a></p>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">After creating the backup image, reboot into Android and backup the system files to your local machine for use later. <br> <code>$ mkdir sgs2-android<br> $ cd sgs2-android<br> $ adb pull /system system<br> $ adb pull /vendor vendor</code></a></p>
<h2><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Building</a></h2>
<p style="margin-left: ;"><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">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></a></p>
<p style="margin-left: 40px;"><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><strong>Important:</strong> Do not proceed until the <code>adb pull</code> commands from the previous section have completed.  You can run the <code>make sync</code> command in parallel with <code>adb pull</code>, but the <code>make config-galaxy-s2</code> command below kills the <code>adb</code> server, which will cause the pulls to abort prematurely.</a></p>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:</a></p>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><code>$ export ANDROIDFS_DIR=sgs2-android</code><br> <code>$ make config-galaxy-s2</code></a></p>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Now, build gonk backend and the system itself:<br> <code>$ make gonk<br> $ make</code></a></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><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><strong>Flashing</strong></a></h3>
<h4><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)</a></h4>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><code>$ make kernel<br> $ adb reboot download<br> $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImage</code></a></p>
<h4><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Flashing B2G</a></h4>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><code>$ adb reboot recovery<br> $ make flash-only</code></a></p>
<h4><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><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><br> Building and flashing Gaia frontend</a></h4>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Assuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device):<br> <code>$ cd gaia</code><br> <code>$ git pull origin master</code><br> <code>$ cd ..</code><br> <code>$ make install-gaia</code><br> <code>$ make kill-b2g</code></a></p>
<h4><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Building and flashing Gecko only</a></h4>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app."><span style='font-family: "Courier New",Courier,monospace;'>$ make install-gecko</span><br> <span style='font-family: "Courier New",Courier,monospace;'>$ make kill-b2g</span></a></p>
<h4><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20flashed%20using%20Odin%20protocol.%20To%20Flash%20Clockworked%20(and%20backup%20image)%3A%20With%20your%20phone%20in%20%22download%22%20mode%2C%20run%20the%20following%3A%20%24%20heimdall%20flash%20--kernel%20zImage%20Next%2C%20reboot%20the%20phone%20to%20recovery%20mode.%20%24%20adb%20reboot%20recovery%20With%20the%20phone%20in%20recovery%20mode%2C%20follow%20the%20on-screen%20instructions%20to%20make%20a%20backup%20image.After%20creating%20the%20backup%20image%2C%20reboot%20into%20Android%20and%20backup%20the%20system%20files%20to%20your%20local%20machine%20for%20use%20later.%C2%A0%20%24%20mkdir%20sgs2-android%20%24%20cd%20sgs2-android%20%24%20adb%20pull%20%2Fsystem%20system%20%24%20adb%20pull%20%2Fvendor%20vendorBuilding%20for%20Samsung%20Galaxy%20S2Do%20NOT%20run%20any%20of%20the%20following%20commands%20as%20root!%C2%A0%20From%20the%20directory%20to%20where%20you've%20cloned%20your%20git%20repositories%3A%20%24%20cd%20B2G%20%24%20make%20syncImportant%3A%20Do%20not%20proceed%20until%20the%20adb%20pull%20commands%20from%20the%20previous%20section%20have%20completed.%C2%A0%20You%20can%20run%20the%20make%20sync%20command%20in%20parallel%20with%20adb%20pull%2C%20but%20the%20make%20config-galaxy-s2%20command%20below%20kills%20the%20adb%20server%2C%20which%20will%20cause%20the%20pulls%20to%20abort%20prematurely.Next%2C%20you%20will%20setup%20your%20build%20directory%20with%20the%20binary%20blobs%20necessary%20for%20building%20for%20your%20device.%20ANDROIDFS_DIR%20should%20be%20set%20to%20the%20path%20you%20saved%20the%20Android%20system%20files%20to%20above.%20With%20your%20device%20connected%20via%20USB%20and%20running%3A%24%20export%20ANDROIDFS_DIR%3Dsgs2-android%20%24%20make%20config-galaxy-s2Now%2C%20build%20gonk%20backend%20and%20the%20system%20itself%3A%20%24%20make%20gonk%20%24%20makeFlashing%20to%20Samsung%20Galaxy%20S2Making%20and%20flashing%20the%20kernel%20(first%20time%2C%20or%20if%20installing%20after%20a%20Clockworkmod%20restore%2C%20of%20if%20kernel%20isn't%20working)%24%20make%20kernel%20%24%20adb%20reboot%20download%20%24%20heimdall%20flash%20--kernel%20boot%2Fkernel-android-galaxy-s2%2Farch%2Farm%2Fboot%2FzImageFlashing%20B2G%24%20adb%20reboot%20recovery%20%24%20make%20flash-only%20Building%20and%20flashing%20Gaia%20frontendAssuming%20you're%20in%20the%20root%20of%20B2G%20repo%2C%20pull%20files%20from%20the%20remote%20repo%20and%20merge%20them%20to%20your%20local%20repo.%C2%A0%20Next%20install%20gaia%20(by%20copying%20files%20from%20remote%20repo%20to%20your%20device)%3A%20%24%20cd%20gaia%20%24%20git%20pull%20origin%20master%20%24%20cd%20..%20%24%20make%20install-gaia%20%24%20make%20kill-b2gBuilding%20and%20flashing%20Gecko%20only%24%20make%20install-gecko%20%24%20make%20kill-b2gForcing%20GIT%20repo%20into%20clean%20stateSometimes%20it's%20necessary%20to%20do%20this%20-%20but%20cloning%20a%20fresh%20repo%20and%20running%20make%20sync%20takes%20too%20much%20time%20%24%20make%20sync%3B%20git%20clean%20-xfd%3B%20git%20submodule%20foreach%20%22git%20clean%20-xfd%22Alternately%2C%20you%20can%20try%3A%24%20make%20mrproperA%20testing%20approach...Once%20your%20system%20is%20up%20and%20running%20on%20your%20device%2C%20you%20can%20begin%20to%20use%20and%20debug%20very%20much%20like%20an%20Android%20phone.%C2%A0%20You%20may%20have%20noticed%20that%20we%20use%20the%20Android%20Debug%20Bridge%20adb%C2%A0%20for%20many%20purposes.%C2%A0%C2%A0%C2%A0%20For%20example%2C%20if%20I%20wanted%20to%20debug%20telephony%20or%20SMS%20on%20my%20device%2C%20and%20I%20had%20incoming%20calls%2FSMSes%20coming%20from%20a%20number%20with%20area%20code%20%22216%22%C2%A0%20I%20could%20monitor%20that%20with%20a%20command%20such%20as%3A%20%24%20adb%20logcat%20%7C%20grep%20216%20To%20be%20sure%2C%20%24%20adb%20logcat%20with%20no%20params%20will%20simply%20output%20everything%20until%20you%20ctrl%2Bc%20to%20close%20the%20adb%20session.%20How%C2%A0%20to%20enable%20debugging%2C%20for%20example%2C%20of%20radio%20component%3A%20First%2C%20change%20DEBUG%20to%20true%20in%20gecko%2Fdom%2Ftelephony%2Fril_worker.js%20Next%2C%20rebuild%20gecko%20and%20reflash%20at%20least%20gecko%20on%20the%20device%3A%20%24%20make%20install-gecko%20and%20then%20provide%20%24%20adb%20logcat%20output%20as%20well%20as%20%24%20adb%20logcat%20-b%20radio%20while%20performing%20the%20affected%20operation%2C%20e.g.%20trying%20to%20initiate%20a%20phone%20call%20from%20the%20dialer%20app." title="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.Note: There are several models with the name Samsung Galaxy S2. The one that works with these instructions is the GT-i9100. Other variants, including GT-i9100G are not supported (yet) as the hardware is different.Backing up your Galaxy S2's native OSYou'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/recovery-clockwork-4.0.1.4-galaxys2.tar $ tar xvf recovery-clockwork-*tar $ adb reboot download When your phone is in &quot;download&quot; mode, it's ready to be flashed using Odin protocol. To Flash Clockworked (and backup image): With your phone in &quot;download&quot; 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.After creating the backup image, reboot into Android and backup the system files to your local machine for use later.  $ mkdir sgs2-android $ cd sgs2-android $ adb pull /system system $ adb pull /vendor vendorBuilding for Samsung Galaxy S2Do NOT run any of the following commands as root!  From the directory to where you've cloned your git repositories: $ cd B2G $ make syncImportant: Do not proceed until the adb pull commands from the previous section have completed.  You can run the make sync command in parallel with adb pull, but the make config-galaxy-s2 command below kills the adb server, which will cause the pulls to abort prematurely.Next, you will setup your build directory with the binary blobs necessary for building for your device. ANDROIDFS_DIR should be set to the path you saved the Android system files to above. With your device connected via USB and running:$ export ANDROIDFS_DIR=sgs2-android $ make config-galaxy-s2Now, build gonk backend and the system itself: $ make gonk $ makeFlashing to Samsung Galaxy S2Making and flashing the kernel (first time, or if installing after a Clockworkmod restore, of if kernel isn't working)$ make kernel $ adb reboot download $ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImageFlashing B2G$ adb reboot recovery $ make flash-only Building and flashing Gaia frontendAssuming you're in the root of B2G repo, pull files from the remote repo and merge them to your local repo.  Next install gaia (by copying files from remote repo to your device): $ cd gaia $ git pull origin master $ cd .. $ make install-gaia $ make kill-b2gBuilding and flashing Gecko only$ make install-gecko $ make kill-b2gForcing GIT repo into clean stateSometimes it's necessary to do this - but cloning a fresh repo and running make sync takes too much time $ make sync; git clean -xfd; git submodule foreach &quot;git clean -xfd&quot;Alternately, you can try:$ make mrproperA testing approach...Once your system is up and running on your device, you can begin to use and debug very much like an Android phone.  You may have noticed that we use the Android Debug Bridge adb  for many purposes.    For example, if I wanted to debug telephony or SMS on my device, and I had incoming calls/SMSes coming from a number with area code &quot;216&quot;  I could monitor that with a command such as: $ adb logcat | grep 216 To be sure, $ adb logcat with no params will simply output everything until you ctrl+c to close the adb session. How  to enable debugging, for example, of radio component: First, change DEBUG to true in gecko/dom/telephony/ril_worker.js Next, rebuild gecko and reflash at least gecko on the device: $ make install-gecko and then provide $ adb logcat output as well as $ adb logcat -b radio while performing the affected operation, e.g. trying to initiate a phone call from the dialer app.">Forcing GIT repo into clean state</a></h4>
<p><a href="/./It%20is%20assumed%20you've%20already%20setup%20your%20build%20environment%20and%20cloned%20the%20repositories.It%20is%20advisable%20to%20follow%20the%20instructions%20in%20the%20order%20presented.Note%3A%20There%20are%20several%20models%20with%20the%20name%20Samsung%20Galaxy%20S2.%20The%20one%20that%20works%20with%20these%20instructions%20is%20the%20GT-i9100.%20Other%20variants%2C%20including%20GT-i9100G%20are%20not%20supported%20(yet)%20as%20the%20hardware%20is%20different.Backing%20up%20your%20Galaxy%20S2's%20native%20OSYou'll%20want%20to%20back%20up%20your%20phone's%20factory%20image%20before%20attempting%20to%20build%20or%20flash%20anything%20to%20it.%C2%A0%20As%20it%20happens%2C%20the%20builds%20or%20flash%20process%20itself%20can%20be%20unstable%20and%20you%20don't%20want%20to%20end%20up%20with%20a%20brick.%20These%20instructions%20assume%20that%20you%20have%20already%20installed%20heimdall.%20From%20some%20other%20directory%20than%20where%20you%20have%20B2G%20installed%3A%20%24%20cd%20%2Ftmp%20%24%20wget%20http%3A%2F%2Fcmw.22aaf3.com%2Fc1%2Frecovery%2Frecovery-clockwork-4.0.1.4-galaxys2.tar%20%24%20tar%20xvf%20recovery-clockwork-*tar%20%24%20adb%20reboot%20download%20When%20your%20phone%20is%20in%20%22download%22%20mode%2C%20it's%20ready%20to%20be%20&lt;/body">body</a></p>
Revert to this revision