CM9-Unstable (Android 4.0.3) on Samsung Galaxy S2 (GT-I9100) using Fedora 16

| 0 Comments | 0 TrackBacks
Luckily one of my friends had a Samsung Galaxy S2 laying around and gave it to me a while ago. After playing around with Gingerbread on it I decided I might as well try and flash it with some ICS goodness. 

I've had a Motorola Atrix sporting CM7 for some time now but was pretty jealous of the nicer screen that the Galaxy S2 has, and the lure of ICS was pretty hard to resist.

So all of these instructions are for Linux, you'll find tons of examples using Odin for Windows. Be warned that you are doing this at your own risk, and that you should have a fully charged battery before attempting.

Ready? Lets dive in.


Step One: Download Required Firmware and Applications

We will be requiring the following:

1. CM9-unstable build for the Galaxy S2 (courtesy of CyanogenMod)
2. Google Apps for ICS
3. CM-Root
4. Heimdall to flash the CM-Root kernel

You can download the CyanogenMod files here: and the Google Apps for ICS here.

For CM-Root we need to get the kernel information from your phone.
To do this you can go into "Settings > About Phone > Kernel Version" where you will see something like the following "2.6.35.7-I9100XXKG2-CL243155"
I have bolded the important part above, "KG2", as you will need this do download the proper CF-Root kernel.

Head over to http://forum.xda-developers.com/showthread.php?t=1103399 and scroll down until you see a kernel that closely matches your version. There are lots of instructions in the thread there that will tell you more about what to do if you don't find an exact match.

The last thing to download is Heimdall, but before we can we need to install some pre-requisites.

I'm using root here, but give yourself sudo access if required. Fire up a shell and run :

[root@tclarrltp ~]# yum install -y libusb-devel libusb1-devel

Now we can head to the Heimdall github repository and download the source files (there is no binary package for Fedora).

Once you have the source we can begin the build. I'm calling the source directory "heimdall-source"
You may notice me changing some files to executable but thats due to certain files not being marked that way when I extracted them.

[root@tclarrltp ~]# cd heimdall-source
[root@tclarrltp heimdall-source]# cd libpit
[root@tclarrltp libpit]# chmod +x configure 
[root@tclarrltp libpit]# ./configure --prefix=/usr
<truncated>
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

[root@tclarrltp libpit]#  make
make  all-am
make[1]: Entering directory `/root/heimdall-source/libpit'
depbase=`echo Source/libpit.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT Source/libpit.o -MD -MP -MF $depbase.Tpo -c -o Source/libpit.o Source/libpit.cpp &&\
mv -f $depbase.Tpo $depbase.Po
rm -f libpit-1.3.a
ar cru libpit-1.3.a Source/libpit.o 
ranlib libpit-1.3.a
make[1]: Leaving directory `/root/heimdall-source/libpit'

[root@tclarrltp libpit]# make install
make[1]: Entering directory `/root/heimdall-source/libpit'
test -z "/usr/lib" || /bin/mkdir -p "/usr/lib"
 /usr/bin/install -c -m 644  libpit-1.3.a '/usr/lib'
 ( cd '/usr/lib' && ranlib libpit-1.3.a )
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/root/heimdall-source/libpit'

[root@tclarrltp libpit]# ldconfig
[root@tclarrltp libpit]# cd ../heimdall
[root@tclarrltp heimdall]# ./configure --prefix=/usr
<truncated>
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

[root@tclarrltp heimdall]# make
make  all-am
make[1]: Entering directory `/root/heimdall-source/heimdall'
/bin/sh ./libtool --tag=CXX   --mode=link g++  -g -O2   -o heimdall source/BridgeManager.o source/Interface.o source/main.o -L/lib64 -lusb-1.0   ../libpit/libpit-1.3.a 
libtool: link: g++ -g -O2 -o heimdall source/BridgeManager.o source/Interface.o source/main.o  -L/lib64 -lusb-1.0 ../libpit/libpit-1.3.a
make[1]: Leaving directory `/root/heimdall-source/heimdall'

[root@tclarrltp heimdall]# make install
make[1]: Entering directory `/root/heimdall-source/heimdall'
test -z "/usr/bin" || /bin/mkdir -p "/usr/bin"
test -z "/lib/udev/rules.d" || /bin/mkdir -p "/lib/udev/rules.d"
 /usr/bin/install -c -m 644 60-heimdall-galaxy-s.rules '/lib/udev/rules.d'
  /bin/sh ./libtool   --mode=install /usr/bin/install -c heimdall '/usr/bin'
make  install-data-hook
libtool: install: /usr/bin/install -c heimdall /usr/bin/heimdall
make[2]: Entering directory `/root/heimdall-source/heimdall'
sudo service udev restart
Redirecting to /bin/systemctl  restart udev.service
make[2]: Leaving directory `/root/heimdall-source/heimdall'
make[1]: Leaving directory `/root/heimdall-source/heimdall'

If there are no errors, heimdall should be successfully installed and we can move onto the next step.

Step Two: Flashing CF-Root using Heimdall

Now that Heimdall is installed, we need to put the phone into download mode. To do this, power it off then hold Home Key + Volume Down + Power Key until you see an intro screen. Let go of the buttons and press Volume Up, the screen should now say "Downloading".

Connect your phone to your computer and do the following:

[root@tclarrltp ~]# heimdall detect
Device detected

If it says "Failed to detect compatible download-mode device." try reconnecting.

Now we can flash the CF-Root kernel you downloaded in the previous step above. Unzip and untar the file (replace the zip file below with the proper one you downloaded for your kernel version).

[root@tclarrltp ~]#  unzip CF-Root-SGS2_XX_XXX_VER-vX.X-CWM4.zip
Archive:   CF-Root-SGS2_XX_XXX_VER-vX.X-CWM4.zip
  inflating:  CF-Root-SGS2_XX_XXX_VER-vX.X-CWM4.tar
[root@tclarrltp ~]#  tar xvf CF-Root-SGS2_XX_XXX_VER-vX.X-CWM4.tar
zImage

Now we have the kernel ready for flashing. You need root privileges, so either as root or with sudo access run the following.

[root@tclarrltp ~]#  heimdall flash --kernel zImage
Heimdall v1.3.1, Copyright (c) 2010-2011, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au
 
This software is provided free of charge. Copying and redistribution is
encouraged.
 
If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

<truncated>
 
Uploading KERNEL
100%
KERNEL upload successful
Ending session...
Rebooting device...
Re-attaching kernel driver...
[root@tclarrltp ~]# 

The phone is going to reboot, once it finished you will notice SuperUser and CWM are now installed. We can proceed to the next step.

Step Three: Flashing CM9-unstable using CWM

You will need to get the CM9 and Google Apps zip downloads onto your phone to do it this way. The easiest way is to head to the Market (Google Play now) and download an app called Dolphin Browser (it allows you to download files even without recognizing or having support for the extension). Then setup a web server on your linux PC to serve the files to your phone. Connect your phone to your WiFi network then using Dolphin, browse to your server that has the files and download them.

Once the files are on your phone, reboot it into recovery mode. Power off the phone then start it up again, this time holding Volume Up + Home Screen + Power Buttons at the same time. After booting into CWM, you will see a bunch of options on the screen. To scroll through them use the volume keys and the home key to select them.

Before flashing you will need to do the following:

Select "wipe data/factory reset" > Yes
Select "wipe cache partition" > Yes

Now we can install the CM9 zip file.

Select "install zip from sdcard" and scroll through until you find the CM9 zip file you downloaded (check the downloads folder).
Then hit yes and it will install. After it completes you should do the same thing with the Google Apps zip file.

When you are done. Reboot your device and you can enjoy all the ICS glory. It might take a while to reboot the first time, but be patient.

Please remember, this is at your own risk. Bricking your phone can happen and is not a fun thing. If you aren't confident you can follow the steps above, reconsider doing it (ICS will be officially released in almost all geographic locations for the Galaxy S2 very soon!).





No TrackBacks

TrackBack URL: http://www.taiter.com/cgi-bin/mt/mt-tb.cgi/21

Leave a comment