Since I couldn’t seem to readily find any useful instructions for building firmware images for the Nexus S I thought I’d publish some. In a clean directory this sequence of commands should result in a working set of application layer images. They assume you’ve already got all the Android build dependencies installed:
repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread repo sync MYDROID=$(pwd) export MYDROID . ./build/envsetup.sh make PRODUCT-full_crespo-user
The resulting images will be in the directory out/target/product/crespo. You can get this running on your device by flashing the boot, recovery and system images:
out/host/linux-x86/bin/fastboot flash boot out/target/product/crespo/boot.img out/host/linux-x86/bin/fastboot flash recovery out/target/product/crespo/recovery.img out/host/linux-x86/bin/fastboot flash system out/target/product/crespo/system.img
Note that using these firmware images will void any warranty you have on the phone – you’ll need to unlock the phone using fastboot oem unlock, but note that this is irreversible.
Similar instructions should work for Nexus One too, using passion instead of crespo in the make command above.