I did this with the Cyanogenmod 9 ROM on my Samsung Galaxy S2. But it should work similarly on all Android devices.
First, you will need to download Odin for your computer. You will use Odin to flash Siyah kernel.
Next, download Siyah kernel.
Ensure your phone has enough battery life (more than 50%, just to be safe). Also ensure you have enough free storage space (about 1Gb).
Switch your phone off and boot it into Odin mode. This can be done by pressing the following key combination when your phone is off: The volume-down button + the home button + the power button. It will display a warning, and you have to press volume-up button again to continue. Once in Odin mode, open Odin on your computer and connect your phone via USB.
Odin will pick up that your phone was connected. Next, click on PDA and browse to the Siyah kernel you downloaded earlier.
Now flash the PDA. Odin will display a ‘success’ status. Now you’ve got a rooted phone. If that is all you want, you’re done.
But if you’d want a custom ROM, like Cyanogenmod, read on.
The Siyah kernel replaced your default bootloader. Now you can dual boot with stock ICS and a custom ROM if you want.
Next, download the latest Cyanogenmod build for your device on your PC. Now you have to move that .zip file to your phone’s memory to be used later by Siyah kernel. You can put your phone into USB file transfer mode to transfer the Cyanogenmod ROM to your phone’s memory.
When you have the .zip file on your phone, go to the CWM app on your phone. This app was added by Siyah kernel. Select Boot Recovery to reboot your phone into Siyah kernel’s bootloader. This is where the magic will happen.
Now we are going to flash Cyanogenmod (or other ROM compatible with Siyah kernel) as the secondary ROM. This way, you keep your original ROM (stock ICS), and dual boot with Cyanogenmod ROM, allowing you to use CM and see if you like it first, before making it your primary.
In CWMR Touch (the Siyah kernel’s recovery loader) menu, select “dual-boot options”. Next, select “Install zip to 2ndROM from internal SD”, or external SD, depending on where you stored the previously downloaded Cyanogenmod zip file.
Browse to the .zip file and select it. Choose Yes to flash. It may take a while to install. CWMR Touch (Clockword mod) will display a “success” message when done. Now you have Cyanogenmod as your second ROM!
Every time you power on your phone, the boot loader will allow you to choose which ROM you’d like to use (currently stock ICS is default, CM9 is secondary).
If you like your newly installed ROM and would like to make it your primary ROM, you can do the following. Reboot into CWMR Touch (Siyah kernel’s recovery mode), and select “Dual-boot options” again. Now select “Swap 1stROM and 2ndROM”. It will take a while to back up your primary ROM, move your secondary ROM to your phone’s primary ROM position, and restore your original primary ROM (stock ICS) to the secondary ROM position. Now your phone will automatically load the Cyanogenmod ROM when it boots, but you still have the option to load the original stock ICS ROM if you prefer at boot time..
How to update custom ROM
To update your custom ROM when a newer version is released requires that you first swap your primary and secondary ROM again (making stock ICS primary and Cyanogenmod secondary). If you kept ICS as your primary ROM from the start, this step isn’t necassary.
Next, you have to save the .zip file of the updated ROM you’d like to install to your phone’s memory and load it with Siyah kernel’s recovery bootloader, just like done previously. You will be overwriting the current Cyanogenmod version on your phone with the new version. The update will be non-wipe, so you won’t loose any of your apps or settings.