Rory's Blog
Home
Blog
Projects
Facebook
Google+
Github
RSS

Fixing My Samsung Galaxy S III

09/06/15

This is a post about changing the firmware (often called a ROM) of an android phone from an outdated, vendor-provided ROM to an open-sourced one called CyanogenMod (CM).

I did all the computer-sided work with an ASUS C200 chromebook on a crouton chroot. I'm not covering how I setup Ubuntu 14.04 on crouton (though I guess I should at some point in the future), so this will detail how to flash CM onto an Android phone via the Ubuntu terminal command-line prompt. Specifically, I flashed CM11 onto a T-Mobile Samsung Galaxy S III. It's pretty likely anyone who wants to use this post to flash their own phone need only find the different files they need to download, which will probably be available on the same sites I used.

Switching to CyanogenMod (CM)

From their main page, I picked the devices link, and filtered down to T-Mobile device from a Samsung vendor and picked the Galaxy S III option. From there I just went to the installation instructions. Any device that can have CM installed on it can probably be found at the devices link.

My installation experience happened in three steps:

  1. Installing the ClockWorkMod ROM and Recovery Manager
  2. Flashing CM11 onto my Phone
  3. Fixing my Acess Point Network Connection

Installing the ClockWorkMod ROM and Recovery Manager

This step is more-or-less perfectly covered by the CM Wiki installation instructions.

I downloaded the relevant img from ClockWorkMod. I was a bit confused at the difference between touch and regular recovery. Touch just makes it so you can actually use the touch screen in recovery mode. Otherwise, controls use the phone buttons (Volume, Power, Home). Touch is preferable, as it has both touch and button controls, so you can pick whatever feels more intuitive.

To flash the recovery img onto my phone, I used heimdall which I believe is for Samsung devices only. To get hemidall, I ran:

> sudo apt-get install heimdall-flash

With heimdall installed, I booted up my phone into "Download Mode" by first shutting it off, and then holding Home, Volume Down, and Power. Once my phone told me it was download-ready, I plugged my phone into my computer and ran:

> sudo heimdall flash --RECOVERY recovery-clockwork-touch-6.0.4.5-d2tmo.img --no-reboot

sudo here may or may not be necessary. Apparently, it might also be --recovery (lower-case) or some other such thing. Depends on phone? I'm not sure, this command was the first command given to me to run, and it worked.

Now, here I got a little confused, because the instructions talked about a blue transfer bar appearing on "the device". Either my phone was special, or "the device" meant my computer, and the instructions were expecting me to use the GUI version of heimdall, not the command-line tool. In any case, if the command ran without printing out explicit errors, you're probably good to go.

It's time to flash the CM ROM onto the phone.

Flashing CM onto my Phone

This step is also more-or-less perfectly covered by the installation instructions. For various reasons covered below, I went with CM version 11 (CM11). Which meant going to the d2lte link. The only difference in the instructions for installation that I found was the download page here.

At this point, we need to boot the phone into recovery mode. Turn off the phone if it's on. Then, boot it up by holding Volume Up, Home, and Power.

Various stuff tripped me up here, so here's some pointers. When you see the start-up splash screen, let go of the buttons. Do not let go when the phone vibrates, that's too soon and the phone will boot normally. Do not press down the buttons too long, as holding Power will eventually shut the phone back down. The timing is fairly lenient, but I erred in both directions the various times I went into recovery mode. The initial splash screen should have recovery mode displayed somewhere. It's also easiest to boot into it when the phone is off and unconnected.

Once in recovery mode, reconnect the phone to the compter if necessary. From there, the first thing to do is back things up as they are now. The instructions say that backing up the phone is optional, but I legit had the experience of wanting to restore my old setup before doing this whole process over again for various reasons, and was glad that the backup is there. So back up your phone, it isn't optional.

[backup and restore] -> [backup to /sdcard]

Then, go ahead and wipe things to your heart's content:

[wipe data/factory reset] -> [Yes - Wipe all user data]
[wipe cache partition]
[mounts and storage] -> [format /system]
[advanced] -> [wipe dalvik cache]

Everything after the factory reset above isn't strictly necessary, but I ran into some problems where it was recommended to do those things. It didn't end up helping my particular problem, but it didn't hurt anything, so just do it.

From here, we're going to want to get the CyanogenMod package on the phone. For me, the right package was the d2lte package which had a filename of cm-11-20150831-SNAPSHOT-XNG3CAO3FN-d2lte.zip. For simplicity's sake, I'll refer to it as cm.zip.

From here, that file needs to get from the computer to the phone. To do that, we'll be using adb (Android Debug). To get adb:

> sudo apt-get install android-tools-adb

And now, we need to make sure we're connected to the phone, that adb can connect to the phone, and that the place we'll be storing the file is properly mounted so adb can successfully push the file to the desired area.

To connect adb to the phone, just run:

> sudo adb usb

This should print out something like:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
restarting in USB mode

It may just print out that last line. As long as it doesn't print out an error, it should be good. Now's a good time to decide where to put the package files on the phone. I recommend going through the install process and see what directory looks good.

[install zip] -> [choose zip from /sdcard]

Doing this will also properly mount /sdcard, making it possible to push things to that area. This is another confusing thing, because the command to move files to the phone doesn't report any errors when it doesn't actually push the file.

Anyways, one of the directories available was called "files", which seemed perfectly fine for me, so that's what I used. At first, I tried to just push it to /sdcard itself, but that didn't work, so actually pick a directory within to use.

And now we need to copy the file on the computer into that directory:

> sudo adb push cm.zip /sdcard/files

Note: another thing that tripped me up here. Don't put /sdcard/files/. That trailing slash will resulting in an unhelpful error stating:

Cannot push to /sdcard/files/, is a directory.

And now, on the phone, we can load up the subdirectory we pushed the file to and install it.

[install zip] -> [choose zip from /sdcard] -> [files] -> [cm.zip]

You might still be in the [choose zip from /sdcard], so just pick files and then whatever you named the cm package.

Again, this is optional, but unless you want to install exclusively outside of Google's app store (why?), might as well install it for simplicity's sake. A list of link's to the appropriate Google Apps package is here, and CM11 specifically is here. I saved the download as gapps.zip.

> sudo adb push gapps.zip /sdcard/files
[install zip] -> [choose zip from last install folder] -> [gapps.zip]

Again, you might be in the install area already, the above is instructions from the main menu area. You might just need to [Go Back] and then come back into the directory to see the newly added file.

After that's installed, it's time to reboot the system, and set up the phone per its instructions.

[reboot system now]

The instructions on the phone should suffice here: picking language, logging onto local WiFi, logging onto the Google account, etc. I won't cover this stuff, but I will cover the problem I had getting phone reception.

Fixing my Acess Point Network Connection

So, once I had set up my phone, I had a problem with my reception. Where it should say the phone provider, it said, "Emergency Calls Only". Interestingly enough, I could receive both texts and calls, I just couldn't send them out.

I thought that I would just have to setup the Ting network APN on my phone, and so I followed the Ting instructions for my phone's sim card. However, once I tried to save the setup... there was nothing in the network list. It didn't save anything, and there wasn't anything there to begin with.

After a lot of searching for solutions to this problem, I discovered that I probably needed to update my phone's baseband/radio/modem firmware. I then looked up my phone's model number:

[Apps] -> [Settings] -> [System] -> [About phone] -> [Model Number]

Now, my phone said "SGH-T999", so I promptly searched "updating modem t999". The first result was this developer's forum with a list of download options for T999, T999L, T999N, and T999V phones. I'm pretty sure any searching of "updating modem <model number>" will lead to a similar post on the same website.

So, my model number said "SGH-T999", so I thought that meant my model was the T999 and not any of the others. This is not the case. Luckily, the "About phone" area also had a "Baseband version", which said "T999L[...]" which gave me the major clue that I needed the most recent T999L modem which was available here. Another major clue was installing the most-recent T999 modem and it not working. Luckily, that did no damage, and installing the right T999L modem afterwards worked just fine.

The file I downloaded was called TMOGalaxyS3LTE_UVUBNC1_Modem.zip, but I'll refer to it as modem.zip.

Reboot the phone to recovery mode, and make sure the install directory being used is mounted and can be pushed to. Then:

> sudo adb usb
> sudo adb push modem.zip /sdcard/files
[install zip] -> [choose zip from last install folder] -> [modem.zip]

Then reboot and see if reception is working. For me, it now said "T-Mobile" instead of "Emergency Calls Only". I needed to change that to Ting, so I went to:

[Settings] -> [Wireless & Networks] -> [Mobile networks] -> [Access Point Names] -> [Ting]

I thought I would have to actually add Ting as an access point name, but it turns out that the modem package came with it setup for me. Thanks, open-source community!

Several Steps Backwards

So, the above mentions the overall process of switching ROMs, and fixes a specific problem I encountered. Edited out a bit were all the hilarious mishaps and detours I encountered along the way. If you're interested in that process for whatever reason, you may want to continue reading, but the tutorial-esque nature of the post ends here. If you haven't found what you were looking for yet, it probably won't be found further below.

CM12!

So, when I first started this process, I grabbed the most recent version of CM: version 12. Everything installed fine, but I ran into that APN problem.

No, Wait, CM11!

Some of the first sources I found suggested it was the ROM I chose. CM12 is newer, and buggier, and maybe in beta and using the newer Android version which might also be buggy. I decided to downgrade to the more stable CM11.

No, No, CM12 is Good!

Once I got CM11 working, I shortly encountered the same APN problem. I tried various updates and stuff, and even "updated" my phone's CM recovery img, thus having a different recovery firmware.

Having the same problem, and noticing that CM11 just didn't feel quite as slick as CM12, I decided to go into recovery and reflash to that. But first, I needed some sort of strategy to fix my APN setup.

T-Mobile ROM Recovery Shenanigans

One, I wanted to make sure I didn't somehow break my phone, so I restored the backup I smartly made for my default T-Mobile setup. It restored just fine to the state before I first reset it, and it connected just fine with my Ting setup. Phone hardware was fine.

From here, I installed APN Backup and Restore, in the hopes that saving the current setup would fix the later ROM setup. It was able to save my APN setup just fine, but notified me that restoring an APN setup was impossible on Android 4 devices. I wasn't sure what version of Android CM12 was (it's 5), but I figured it was worth a try regardless.

d2tmo Recovery?

At this point, I had realized that I didn't like the recovery that my phone had updated to earlier. It wasn't quite as... slick? Yeah, slick's a good word. The menu was smaller, which was unnecessary, because even before it didn't take up the whole screen. Touch was fonky now as well.

I then noticed, while going to redownload the CM12 package, that there was a Samsung Galaxy S III (T-Mobile) recovery image available right below the CM12 package download on the build download page.

Curious, I promptly loaded up the bootloader on my phone and flashed that recovery. At first, it looked pretty great. Responsive and easy on the eyes. But... the menu was completely different. I couldn't even figure out how to install anything with it.

So, I flashed the original recovery that I had gotten back on the phone.

CM12 is not Good, CM11 it is

I reinstalled CM12 and ran into various really annoying problems. I don't really remember the specifics here, but one of the main problems was that I couldn't connect via adb while the phone was in its normal state. Usually, there's an option to turn on usb debugging in the settings menu, but I couldn't find it anywhere (and this version of CM had search functionality in its settings menu).

And really, the final nail was that APN Backup and Restore didn't work, so CM11 being Android 4 wasn't really a deal breaker, as the app solution didn't fix my phone.

The extra slickness just wasn't worth this nonsense, especially since I realized that I'd probably use adb as my main method of getting things (music, videos, random files, etc) from my computer to my phone in the future.

And so, finally, I got to the place where I had the recovery I wanted, the ROM I wanted, and I had found out that APN Restore wouldn't work and that I probably needed to install new modem firmware.

Some Background

I've had a T-Mobile Samsung Galaxy S III phone for about three years or so. Surprisingly, I'm one of those people who uses their phone as a phone. Well, a phone/text machine. I don't use it as a computer, even though that's what phones are nowadays, and even though I explicitly have a pretty awesome computer-phone.

So, you may be wondering why I did this, Stephan. It seems like a lot of work for a person who uses a phone as, well, a phone, yeah?

About three months ago, I switched from T-Mobile to Ting (if you end up using the link sign up for Ting, I'll get credit to my Ting account). Overall, it's been an excellent decision. My bill went from $60 a month to less than $20 a month. My next bill will be for $12 plus taxes. I may get that number to less than $10 (more on that in a later post, I think).

The problem? My battery suddenly started draining at a seriously unreasonable rate. From lasting 24-48 hours to lasting less than some 6 hours. The reason? Android phones in general come with bloatware from the phone service provider. Bloatware that can not be deleted and will reenable themselves (usually under reboot). Now that I didn't have a T-Mobile account and it couldn't connect to T-Mobile, it was constantly trying and failing to use apps I couldn't properly destroy.

And so, finally, after three months I finally got fed up with that nonsense. I looked into deleting the bloatware and decided that installing completely different firmware was the best course of action. I went with installing CyanogenMod.

What's interesting is now I'm actually interested in using my phone as the computer that it is. Ideas are floating around in my head as to how I can use it to legitmately improve my life. Such ideas may deserve future blog posts.