Have you ever ran into the problem where you try to restore 3.1.2 the iPhone refuses to boot in normal mode and starts in Recovery mode. A google search taught me that this as recovery mode loop.
To fix recovery mode loop, a script called iRecovery is your save, iRecovery is a libusb-based command line utility for Mac OS X and Linux (perhaps Windows too). It is able to talk to the iBoot/iBSS in Apple’s iPhone/iPod touch via USB.
This is however instruction for Mac OSX
Download I recovery here
1. Open Terminal and start iRecovery by typing ./iRecovery -s
3) Then execute the following commands:
setenv auto-boot true
3) Reboot your iPhone (hold home & sleep until apple logo appears).