PwnageTool 5.1.1 allows to create custom firmware and preserve modem version for unlock with ultrasn0w or Gevey. PwnageTool 5.1.1 supports all A4 devices:
iPhone 3GS
iPhone 4
iPad 1
iPod Touch 3G
iPod Touch 4G
Apple TV 2G
You can download RedSn0w 0.9.12b1 here and PwnageTool 5.1.1 here.
Go to /private/var/root/Library/, delete original lockdown folder and put this lockdown folder after you extract it from the zip file
Restart phone
If you are not jailbroken:
Sherif Hashim discovered that you can activate your iPhone 4, iPhone 3GS or even iPhone 3G without the original carrier SIM card. You need a “phonebook sim card” or 02 simcard. You can buy these type of sim at radioshack, bestbuy or other mobile electronics store (for example here).
Once you get passed the Emergency Call screen, connect to Wifi, jailbreak using JailbreakMe.com and unlock using ultrasn0w. Once that is complete you should be passed activation and unlocked (able to use any sim). If you get a different simcard error, do the following final step:
Go to /private/var/root/Library/, delete original lockdown folder and put this lockdown folder after you extract it from the zip file
Restart phone
If you have itunes invalid response problem:
Connect to wifi and ssh to your phone (via winscp, putty, terminal, etc).
Navigate to your lockdown folder (/private/var/root/Library/).
Delete pair_records folder
Reconnect the cable and see that your invalid response problem is gone.
If you bought your iPhone 4 on ebay you will need the official sim (at&t) or a universal sim, like ones you can grab at bestbuy for $10 this will get you passed Emergency Screen.