December 14, 2009

iRecovery Fedora Howto

Some time while jailbreaking and unlocking process iPhone refuses to boot in normal mode and every time you restart your iPhone it enters in Recovery mode. This situation is named as recovery mode loop. If you are in a recovery mode loop (i.e. your phone enters recovery mode on every reboot).
To get the rid of recovery mode loop we use iRecovery, 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. If you are on Windows then you need to install LibUsb-Win32 in order to run iRecovery.LibUsb-Win32 is a port of the USB library libusb the Windows operating system. The library allows user space applications to access any USB device on Windows.
There are a few gotchas on Fedora so here are step by step instrucions.

su - yum install readline-devel git exit git clone git:// cd irecovery/

There is a bug in irecovery.c code so in order to make it compile I needed to delete line 323 containing this code:
signal(SIGINT, irecv_quit); // Close USB on ^C
Use vim, gedit or any other text editor or your choice and delete this line, because it won't compile if you don't remove it, and you will get this error:
irecovery.c:323: error: ‘SIGINT’ undeclared (first use in this function)
Now we can continue the compilation process:

ln -s /usr/include/readline . make linux
  Now you have iRecovery installed and can use the instructions on how to use it to Get Rid of iPhone from Recovery Mode Loop on Restart.