Idiots Guide to Rooting and Custom ROMs, Optimus S Edition

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
...the tutorial for the rest of us!

First, I do not take credit for any of the information contained here. A great big shout out to Beezy, KsmithinNY, drellisdee and all the others who have spent countless hours sharing their intimate knowledge of the inner workings of our devices. Without them, none of this would be possible.
In fact, most of this post is the result of copy and pasting their respective threads, and I highly recommend you visit the original source for more detailed information (I will try to make sure to link all sources in the text).

I'm writing this because I felt like newbies have a lot to take in the first time, especially if this is their first Android handset. I'm no expert and I'll be the first to admit that I'm still learning this myself. So, if any of you seasoned Android veterans find anything to be incorrect here, please let me know!

Now, on to the good stuff!


So, you want to flash a custom ROM, but don't even know where to start? No problem. This tutorial is for YOU.
Throughout the tutorial I will try to explain in detail what each thing is and why it is necessary, but it is not important for you to understand in order to perform the process. These details will be written in red italics, and don't worry if you don't get it. You won't have to- its just FYI and good to understand.

----------------

Here is the process in a nutshell (I will go into more details in the posts that follow if you find the original threads too daunting):
1)Root your phone. (original thread here) Needed to allow access to critical system areas.

2)Back up any user data you wish to save and/or restore to new rom (App data, such as what Angry Birds level you're on, call logs, etc. are going to be cleared. If you want to keep them, there are plenty of apps to choose from. I recommend Titanium Backup, there is an excellent free edition in the Market).

3)Install custom recovery (original thread here) This is a modified system menu that allows you to "recover" a rom that never actually existed on your phone before. That is, to install a custom rom, this tool is used to trick the system into thinking its recovering to an official release. Aside from ROM flashing, it also allows you to save the entire contents of your phone, user data and all, to an image that can be restored later if you get cold feet and want to turn back. Cool, huh?

4)Put ROM on SD card and reboot the phone into custom recovery to install it.

5)If you backed any data up (user data, etc), you can start restoring it now.

----------------

That's really all there is to it. If you've already visited those threads and still not sure what you're getting into, relax!
In the next couple of posts I will explain in great detail what you need to do!
 
Last edited:

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
The detailed version...

NOTE: I WILL NOT BE HELD RESPONSIBLE FOR BRICKING YOUR PHONE. Proceed at your own risk.

---------------

Section 1: Root your phone.
This is needed because we will be running code that will modify the protected areas of the system. The only way to access those areas is to do it with root access.
For more information on this process, you can find the original thread by KSmithinNY here (http://forum.androidcentral.com/lg-optimus-s/43108-how-root-lg-optimus-s.html). There is also a video walkthrough link from iamlilysdad in that thread as well.
Also interesting to note that there is an easy one-click way to do this called Z4root, which doesn't require any shell commands or tools installed on the desktop (It used to be in the market, but appears to have been recently pulled- original XDA thread containing file can be found here). However, you'll need to use the shell and have all this installed for the next steps, so you might as well install them now and root the old fashioned way to get a feel for it.

Note: For the purposes of this tutorial, I assume you are using a Windows PC. If using a Mac, I recommend mfldmike's excellent tutorial for rooting on his mac (with screenshots), found here.

1) You'll first need to install all of the following (if you haven't already):
1.a) Java Runtime Environment Link
1.b) Google's Android Software Development Kit Link. We recommend you install this on the root of your computer so the path is C:\android, since that will be important to the commands entered later.
1.c) Drivers for the LG phone installed on your computer. Instructions from gbhil to do that can be FOUND HERE.
These are basically the tools needed to connect to your phone as a developer. In other words, if you were to develop your own Android apps, you'd use these tools to test and debug a real world example on your phone. No, you're not going to have to become a developer to flash roms! The reason we do this is because you will need to issue commands directly to the phone, using a nifty little command line tool called Android Debug Bridge (ADB). Think of it like a remote command line to the linux system driving your phone. Pretty useful stuff.

The next set of steps are from the original thread by KSmithinNY, found here.


1.d) Download the root exploit files found at the bottom of the original thread here (called OptimusRoot.zip).
Download it, unzip it, and put the 3 files inside in your android-sdk-windows\tools folder created from installing the SDK in 1.b above.

2) Once everything from step 1 is installed, plug your phone into your PC with the USB cable.

3) Make sure the phone is charge only (don't mount as USB drive) and USB debugging is enabled. (Find this in Menu > Settings > Applications > Development > check mark USB debugging)

4) Launch the SDK manager, should be something like C:/Android-sdk-windows SDK Manager

5) Open a CMD window and type each of the following lines, one by one:
(Tip: You can paste text into a cmd window in most versions of windows by right-clicking anywhere inside the window)

cd c:\wherever-your-sdk-tools-folder-is (mine for example is C:\android\tools however in the new SDK, I think for gingerbread 2.3, the correct directory would be "Platform Tools", and not just "tools". See what you have on your directory))
adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage
adb push su /data/local/tmp/
adb push busybox /data/local/tmp/
adb shell
chmod 4755 /data/local/tmp/rageagainstthecage
chmod 4755 /data/local/tmp/busybox
cd /data/local/tmp
./rageagainstthecage (let things sit a couple minutes (2), your phone will disconnect from the computer and you'll be removed from your ADB session)
adb shell This should return a "#" symbol instead of a "$" symbol. If it does you're good. If not go back and start from the beginning of step 5
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
cd /data/local/tmp
./busybox cp su /system/bin
./busybox cp busybox /system/bin
cd /system/bin
chmod 4755 su
chmod 4755 busybox
exit
exit

Congratulations, you just used the ADB command line tool to load the software needed to root your phone. That's wasn't so scary now was it? In the future, if you would like to enter some ADB commands, all you have to do is plug in the phone like this again, navigate to the directory that houses the SDK, and type ADB again.
Now that the exploit is in place, all you have to do is designate who/what has root access, which brings us to the next bit:

If you are unable to get the # and finding yourself frustrated, you could always download z4root and do it the one click way. It was important that you have all this stuff installed and setup working for later.

6) Go to the android market on your phone and download "Superuser"(free). The developer will be listed as ChainsDD.

DONE! Your phone is rooted! And you used the ADB command line to do it! On to part 2, Backing up!

----------------

Section 2: Backing up user data
As I mentioned above, the custom recovery tool (explained in the next section) will allow you to do a dump of the entire contents of your phone's memory (also known as a NAND backup). This is great because you'll be able to revert back if you decide to go back to a stock ROM. The problem, however, is that you can't recover user data into a new ROM with that backup. That backup can only restore the entire contents of your old NAND, including the original ROM. So, if you want to take anything with you, call logs, text messages, user data in apps, you need a specific program to do that. I personally used the free edition of Titanium Backup, which will allow you to do a full backup of your apps and data, and restore them one by one afterwards. There are also specific apps you can use to backup/restore your call logs or SMS, but I found that Titanium can handle most of the data I was interested in.

This entire section is optional, as you can choose to start with a fresh slate and that is your own prerogative.

On to Section 3, Custom Backup!
 
Last edited:

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
Section 3: Custom Recovery
The original thread for this can be found here.

1) You need two files, flash_image.zip and recovery-RA-GNM-thunderc-s-1.1.0.img.zip, both of which can be found towards the bottom of the original thread. Copy them to the root of your SD card.

2)Plug in the phone like we did in Section 1, and open up the ADB shell (like we did before- enter the cmd, navigate to where your SDK is installed, and type adb shell).
Check your display to see if Superuser is asking you to grant permission to have root access to the commands coming in. Make sure you click to allow it if it asks. You should be greeted with a # prompt (If not, the prompt is not being granted root access and something is wrong).

3)Enter the following commands:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock5 /system
cat /sdcard/flash_image > /system/bin/flash_image
chmod 755 /system/bin/flash_image
mv /system/etc/install-recovery.sh /system/etc/install-recovery.sh.bak
mount -o remount,ro -t yaffs2 /dev/block/mtdblock5 /system
flash_image recovery /sdcard/recovery-RA-GNM-thunderc-s-1.1.0.img
reboot recovery

That's it! You've replaced LG's default recovery menu with a custom one. This custom one will allow you to backup/restore nand and flash custom roms made by the users. Great. Now what? Well, lets a pick a ROM and load it up in the next section!

-------------

Section 4: Copying ROM file and using Custom Recovery

The most popular rom for our device so far is the ThundeROM, which can be found here.

4)Pick a ROM you would like to flash, for example ThundeROM, and copy the entire zip file to your storage card root (do NOT unzip it!).

5) Reboot phone into recovery by powering off, then press and hold vol_down + home + power and release keys at LG splash.
You should be greeted by something that looks like this:
393512721.jpg


6)Navigate the options on the custom recovery using the vol up and down keys, and menu button to select. It is recommended that you first select Backup/Restore and do a full Nandroid backup, so that if all else fails you can restore your phone to this point later.

7) Scroll down to WIPE and wipe each of the following clean:
-Data
-Cache
-Dalvik

7)After that, scroll down to Flash zip from SD card, and select the correct file using the menu key for enter again.

8) Reboot

Congratulations. You have successfully flashed a ROM.
You can now open up the market and download Titanium Backup again (or whatever you used for your user data backup), then use that to restore your other apps and user data.

If you have any questions about the process or get stuck, I'll help with whatever I can, but please keep in mind that the original threads are a much better source of information than I am. The purpose of this thread is simply to have everything you need in one place, so a newbie can read it linearly. I would recommend that appropriate questions go in their respective threads. Still, if I wasn't clear about any of the steps, let me know and I'll do what I can to make it more understandable.

Enjoy your phone!
 
Last edited:

cmags

Well-known member
Nov 29, 2010
256
27
0
Visit site
Great timing with this. It will be very helpful later today when I tackle this. Thanks for taking three time to put it together!
 

wade70592

Member
Dec 10, 2010
24
0
0
Visit site
well, I've gotten to the command prompt part. i copy and paste [adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage] and all I get is error: device not found.

yeah, I need help :/ I reinstalled the drivers also, so Idk whats wrong..
 
Last edited:

mfldmike

Well-known member
Nov 16, 2010
159
44
0
Visit site
well, I've gotten to the command prompt part. i copy and paste [adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage] and all I get is error: device not found.

yeah, I need help :/ I reinstalled the drivers also, so Idk whats wrong..

Look at my reply in the "Sticky"
 

wade70592

Member
Dec 10, 2010
24
0
0
Visit site
it didnt help that much at all really, It still says devices not found, and I've uninstalled and reinstalled the drivers so many times already
 

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
it didnt help that much at all really, It still says devices not found, and I've uninstalled and reinstalled the drivers so many times already

Ah, new SDK moved that stuff in Platform-tools instead of just tools, huh? Updating rooting instructions above. Ksmith should update his as well, I'll send him a note.

Get it working now?
 

wade70592

Member
Dec 10, 2010
24
0
0
Visit site
Well, I got all the way past the $ signs, but then i entered adb shell and kept getting the $ instead of # so now idk what to do besides start over again
 

KSmithInNY

#winning
Oct 7, 2009
3,538
1,441
0
Visit site
Well, I got all the way past the $ signs, but then i entered adb shell and kept getting the $ instead of # so now idk what to do besides start over again

I'm not going to chase you from thread to thread to thread lol.

Please use and stick to 1 thread for this process and I'll continue to assist.
 
  • Like
Reactions: dishe

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
Well, I got all the way past the $ signs, but then i entered adb shell and kept getting the $ instead of # so now idk what to do besides start over again

Yes, it took me probably 4 attempts before the $ turned into a #. I did the same commands over and over, finally it took. I think it helps to keep the SDK manager window open in the background.

If all else fails, you can try the one-click Z4root app in the market, and then continue with section 2 of my guide. The point of doing the root the long way was just to make sure you have the drivers and SDK working so that you can ADB shell, and to familiarize yourself with the process. You don't have to actually complete it this way if you got that far, IMO.

Good luck!
 

wade70592

Member
Dec 10, 2010
24
0
0
Visit site
I'm just gonna stay on this one lol, there should really be a chat system of some sort? but yeah, I've done all the steps and I still get $ ?
 

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
I'm just gonna stay on this one lol, there should really be a chat system of some sort? but yeah, I've done all the steps and I still get $ ?

Off topic, but agreed. On XDA and PPCGeeks, the most useful day for me was the day I found the developers' IRC chat. As I understand it, KSmith and Beezy don't really do chat. :/
They do enough for us already, though. I think asking them to sit all day in a chat room might be much.
 

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
yeah, I see what you mean. well, i dont really know what to do about these "$" I'm trying everything!

Look at my suggestions from 2 posts ago. It doesn't always work the first time, keep starting the commands over and eventually it should take. Or, cheat and do it the short way now that you get how it is supposed to work.
 

Bone_Enterprise

Well-known member
Nov 12, 2010
95
33
0
www.digital-ops.net
An mIRC/Chat client would be way more complex to deal with than something that is threaded and topic centralized like forums are.
In a scenario like that you would have multiple dozens of people in one place all going on with diffrent conversations and someone asking for help about something would just get lost in the wall of text that would constantly be passing by, and make it more so confusing for the person seeking assistance.
 

wade70592

Member
Dec 10, 2010
24
0
0
Visit site
Look at my suggestions from 2 posts ago. It doesn't always work the first time, keep starting the commands over and eventually it should take. Or, cheat and do it the short way now that you get how it is supposed to work.

I already rooted w/ z4root i just wanted to check to see if it really worked. but yeah now on to custom recovery I guess :D
 

dishe

Well-known member
Nov 10, 2010
245
61
0
Visit site
I already rooted w/ z4root i just wanted to check to see if it really worked. but yeah now on to custom recovery I guess :D

Don't forget to install the Superuser app in the last step of rooting. I'm not sure if z4root does this for you or not. Make sure when you type into the shell, you grant it superuser access via the app. It should prompt you.


An mIRC/Chat client would be way more complex to deal with than something that is threaded and topic centralized like forums are.
In a scenario like that you would have multiple dozens of people in one place all going on with diffrent conversations and someone asking for help about something would just get lost in the wall of text that would constantly be passing by, and make it more so confusing for the person seeking assistance.

Actually, it works really well for them and was a great way for all the great minds to collaborate together when someone is having a specific problem. If it pertains to other people, the threads were updated. But it IS time consuming, and I lost many a work day just chatting with other devs.