Unlock Android Nexus S bootloader
It’s only possible to flash a custom system if the bootloader allows it. On Nexus One, Nexus S, and Nexus S 4G, the bootloader is locked by default. Next it is described the way to unlock it.
Before going any further I highly recommend to read the CyanogenMod Wiki on fastboot as it includes information about it uses, options, etc.
Note: After unlocking all the data already installed is deleted and the mobile phone is wiped.
Option A: Using prebuilt fastboot
The current version of Android SDK (r12) doesn’t include the fastboot as it was in former versions.
Searching on Google it is quite easy to find prebuilt version. A fastboot for an 64 bits can be downloaded from xda-developers forums [2].
In order to easy the use of fastboot, it is recommended you move the file to your platform-tools directory (android-sdk-linux_x86/platform-tools).
Now reboot the phone to the bootloader/fastboot mode. On a Nexus S, you can use VolUp + Power buttons combination or alternatively using the adb tool.
$ adb reboot bootloader
Run fastboot to unlock the device
$ fastboot device
0123456789ABCDEF device
$ fasboot oem unlock
... OKAY [ 28.831s]
finished. total time: 28.868s
Answer the questions on the phone screen after executing the fastboot unlock command.
Option B: Compiling your own fastboot command
This option requires creating a complete Android Build Environment, which is used for generating customized ROMs, compile new kernels, etc.
It requires downloading Android source code and compile part of it. If you are not a developer, just use Option A. Otherwise in INCLUDE POST how to build setup and build an Android system is described.
Summarizing the steps, you have to download the source from the Git repository using the repo tool and carry on some configurations (see [3]). To build fastboot utility it is not mandatory to download the complete source tree (it takes quite long). I think it would be enough it you just download the SDK (git://android.git.kernel.org/platform/sdk.git) and build (git://android.git.kernel.org/platform/build.git) projects (I haven’t tested it, I downloaded the whole lot).
After downloading it compile the fastboot and adb tool.
$ cd ~/mydroid
$ source build/envsetup.sh
including device/htc/passion/vendorsetup.sh
including device/samsung/crespo4g/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including sdk/bash_completion/adb.bash
$ make adb fastboot
Output files are placed in
$ cd ~/mydroid
out/host/linux-x86/bin/adb
out/host/linux-x86/bin/fastboot
This tools can be used to communicate with the phone and are valid for the system you compiled them (32 or 64 bits).
References
[1] Fastboot – CyanogenMod Wiki
[2] [HOWTO] fastboot for Ubuntu 64 bits – xda-developers
[3] Downloading the Source Tree | Android Open Source