How to rescue your SGS2 from a bad download

This post is based on Cyanogenmod 9 and the samsung Galaxy S2. I also now do all my flashing under Linux using heimdall. If you do not know what that is or do not feel comfortable on the command line, you shall look elsewhere

I had fun tonight with a firmware that I downloaded and even though it flashed right, my phone got stuck in a boot loop. I considered my options as I realised that a full flash would pretty much mean to kiss my data goodbye. Recovery no longer worked, meaning that clockworkmod was unaccessible. On the upside, download mode still worked. So I decided to grab the resurrection edition of the nightly CM9. This build is supposed to be able to flash any SGS2 which is not on cm9 already. Once you get the tarfile, untar and look at all the files inside.

I then tried first to flash the kernel, unfortunately, a reboot later, it didn’t boot the device, here is the command I used:

heimdall flash --kernel zImage

After this I remembered reading on the 2500+ posts thread on the cm9 nightly about bootloaders, so I gave it a try:

heimdall flash --primary-boot boot.bin --secondary-boot Sbl.bin

And voila! My phone came back to life, I was able to access recovery and flash the previous image which I knew worked. I will post on Cyanogen 9 soon again, once I have more time.