I wanted to upgrade from iPhone OS 3.1.3 to 4.0 since it was released but I didn't as not Jailbreak and Unlock was available for it. I need to unlock my iPhone 3GS as I want to use it here in India and I got it from UK much before it was officially released here in India. And so, I need to Jailbreak it too. As Jailbreak and Unlock were released two days ago, I thought I should upgrade my iPhone now and today was that day. So I got up early (as I daily do) and started the process.
Why Jailbreak?
Jailbreaking your iDevice allows you to install applications that are not allowed by Apple at AppStore. Also, Jailbreaking is needed for Unlocking an iDevice. So even if you don't want to install any applications other than Apple ones, but want to use your iDevice with mobile carrier other then officially supported, then you need to Jailbreak it first.
Why Unlock?
Using your iPhone is restricted by Apple to only a few selected service providers in most countries (like At&T in US). If you want to use your iDevice with other service provider, you need to Unlock it first.
Upgrading from 3.1.3 to 4.0.1 on iPhone 3GS.
Before starting, You should keep a few things ready.
1. The official SIM which came with your iPhone. Or any SIM of same service provider may work.
2. The USB Cable of iPhone.
3. Latest iTunes.
iOS 4.0 or later needs newer iTunes version. Any version after 9.2 will work. I used iTunes 9.2.1.5. If you have older verion, you may download it from here.
Note: If you previously Jailbreak and/or Unlocked your iPhone, you should Backup your iPhone before installing newer iTunes. As newer version may break your Jailbreak and create malfunction on iPhone.
Even if you didn't Jailbreak and Unlocked your iPhone, you should take Backup of it before starting.
After downloading and installing iTunes, connect your iPhone to PC or Mac and in check for update. It will check and tell you that newer version of iOS 4.0.1 is available. Now click 'Download and Install' The firmware will be downloaded and installed on your iPhone. Do not disconnect your iPhone while this process is going on.
Now upgrading is done.
Now to Jailbreak iPhone, turn on Wi Fi or 3G (Connect to Internet in short) and go to www.jailbreakme.com
This Jailbreak version works on iPhone itself so you don't need to connect your iPhone to computer to Jailbreak. Once the site is open, slide across the "Slide to Jailbreak" are and Jailbreaking process will start. It will download and install the Jailbreak. It will install Cydia also.
Now reboot.
Now to Unlock your iPhone, Open Cydia and search for ultrasn0w (its zero not O for Olympic).
Install ultrasn0w. It will unlock your iPhone and will ask for reboot. Reboot and your iPhone is Unlocked.
Now you can use any SIM in your iPhone, download and install themes, third party software which are not allowed by Apple at App Store and much more.
Have Fun!
The same process above is to be followed for any other firmware of iPhone, iPod Touch or iPad.
Caution: Though Jailbreaking and Unlocking are legal in US, one thing you should keep in mind that as per the Apple policy, your iPhone warranty will be void if you Jailbreak your iPhone. So be careful.
Update #1 - A new update IOS 4.0.2 is released by apple which patches the hole used by jailbreakme.com Jailbreak. You are advised to backup your SHSH blobs before its too late and apple stops signing them. Read how to backup your SHSH blobs Here.