The process is extremely simple, but not without dangers, act only if you are conscious, what you are doing.
You have to flash a modified kernel, containing root, busybox, and ClockworkMod (CWM3) recovery.
The procedure is usually that we have seen Previously in Flashing ROM on Galaxy S2.
1.Go to settings>about and check your firmware version it is like XX*** format , note down last three alphabets . For example we have XXKG3 firmware then we have to download this file “CF-Root-SGS2_XX_OXA_KG3-v4.1-CWM4.zip”
2.You can Find and download CF ROOT Kernel file from here regarding to your firmware version
3.Unzip it and you will see a .tar file, it is possible that your pc shows .tar file as extractable archive but dont extract it further. save this .tar file on safe place like desktop
4.Once done, download ODIN3-v1.85 from here [use only this version otherwise it can bring serious problems]
5.Unzip it and you will see two files first is .exe and second .ini
6.launch ODIN by double clicking on Odin3 v1.85.exe, click on PDA button and select CF-Root-xxx-vX.X.tar file.
7.Check Auto Reboot ,F.Reset Time and leave Re-partition unchecked.
8.After this, put your Samsung Galaxy S 2 in download mode. to do that press and hold volume down andmiddle key ,while holding both press power on key (dont leave until it boots in download mode)
9.Once your are done with putting your phone in download mode, connect your phone to the computer via USB.
10.Now in ODIN, click on the Start button and wait for the kernel flashing process to complete.
11.Once the process is over, your phone will automatically reboot.
When you restart your ROM will remain intact, but you will have root permissions with the recovery . Thanks to the recovery ,now you can make a full backup of your ROM and push towards the cooked ROM installation.
The procedure is always the same for any firmware version but you need to download CF-Root-xxx-vX.X.tar file according to your firmware version.
Regarding the warranty, Samsung will know how many times you used to flash the ROM odin , with this gauge inside the download mode.
However, there is a way to reset it.
Some considerations and FAQ
Everything made on the Device you do so at your own risk.
In the case your phone hang during process, remove the battery and reinsert it.
If you do not recognize your ODIN S Galaxy II, Samsung launched Kies, close it and try again.
KIES only works with USB debugging turned off.