It is assumed you've already setup your build environment and cloned the repositories.
Backing up the native OS
Unlike with other devices, ROMs for the Nexus S are provided by Google. It is therefore not necessary to back up your device.
Building for Samsung Nexus S
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. This step will download the blobs from Google and clone the ICS version of Gonk?
Now, build gonk backend and the system itself:
$ make gonk
Flashing to Samsung Nexus S
The following step reboots the phone into the bootloader and
$ 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
Sometimes it's necessary to do this -- but cloning a fresh repo and running
make sync takes too much time
$ make mrproper