Tonight we were given an excellent well-prepared presentation on rooting an Android phone, given by member Joe Homza. His prepared paper that he used for his presentation follows:
What is S-Off and S-On?
This "feature" is found on some android phones including the HTC brand. These phones come from the manufacture with S-On and are sometimes called Simlocked.
It refers to whether or not the NAND memory on the phone is locked to prevent being written to.
S-On = Security On = it is locked.
S-Off = Security Off = it is unlocked and can be written to.
It is not necessary to have S-Off to root the phone, but if you want to make changes to the Radio or H-Boot files you need S-Off.
I did not change my phone to S-Off, it is still S-On.
At the end of this presentation is a helpful links section that includes a link to instructions on how to set S-Off. The S-Off instructions are a little more than 1 year old and refer to using a program called "Firewater". At that time it was free, but now it has been replaced by the program "Sunshine" which costs $25.
Software needed to root or flash a custom rom on your android phone:
ADB (Android Debug Bridge): ADB lets you send basic linux shell commands, plus developer commands to your phone (as long as debugging is enabled). You can send commands to the phone while it is turned on and booted, or when it is in recovery mode. ADB is often used in conjunction with modifying or rooting your phone, but it can also send commands to unrooted devices.
Fastboot: Is a tool that allows you to modify some of your phone's firmware. This allows you to send commands to the bootloader.
These 2 tools are generally available in standard linux repositories.
To install ADB and Fastboot in a terminal window, type:
For an Ubuntu distribution:
sudo apt-get install android-tools-adb android-tools-fastboot
For Fedora and Centos:
sudo yum install andriod-tools
sudo zypper install andriod-tools
I use openSUSE and instead of a command line install I used the graphical package manager. I assume the graphical package manager for the other distros has the same capability.
Note installing the ADB and Fastboot using either of the above methods saves you from having to edit the Path environment variable.
Also needed is a custom recovery program that gives includes commands for some administrative functions not available in the standard recovery program.
The 2 widely used custom recovery programs are TWRP (TeamWin Recovery Project), and CWM (ClockworkMod Recovery).
I have used both CWM and TWRP. I used TWRP to root and flash a custom rom to my phone. I downloaded TWRP version 126.96.36.199 (released June 22, 2015) from: https://twrp.me
Open the link and clink on TWRP 188.8.131.52 Released. This will take you to the release notes page.
The last sentence on that page has a link to the devices page, follow the link. Now, find your device and click on that link and on the new page the under the fourth subheading “Download Links” clink on “Primary” which leads you to a download link. Download twrp-184.108.40.206… Note: I saved this file and other files I downloaded for this presentation to ~/Downloads/Android
If we want to have root access to our phone we need to download SuperSU
With that done and stored in the ~/Downloads/Android directory
We should back up the phone, before changing anything.
To do this we need to turn USB Debugging on. This is done from the Developer Options section of your phone's settings.
On the HTC One this menu is hidden. To reveal it
Open the Settings menu
Select About -> Software information -> More
Start Tapping Build Number (about 7 times in total). You will get a count down messages followed by a message congratulating you on becoming a developer.
Go back to the Settings menu and select the newly revealed Developer Options
Make sure the Developer Options are enabled (top right)
and Check the box to enable USB debugging.
Now we are ready to backup our phone.
No need to turn the phone off.
Connect the phone to the computer with a USB cable.
To verify that we are set up correctly, in a terminal run the following command
Having verified it is working I ran the following command:
adb backup -apk -shared -all -f ~/Download/Android/backup.ab
This will store the backup in the ~/Download/Android directory. My backup (very little on the phone) was 1.4 GiB and took a few minutes to run.
If you need to restore the phone run the command:
adb restore ~/Download/Android/backup.ab
Now we are ready to root the phone:
First we must unlock the bootloader (this does not mean the phone will become S-Off)
For HTC phones this is easy but a little tedious.
Go to the HTC developer web site ( https://www.htcdev.com/ ) and register so you can get an unlock code.
They only need your real name, a user name and a password.
You will receive an email that you gives you a link to click to go back to the site and that completes registration.
Login to the site.
Turn off your HTC phone and then hold the volume down button while pressing the on button. This will put you in "HBOOT" mode.
Use the volume buttons to highlight the "Fastboot" option and select it using the power button.
Connect your HTC phone to the computer.
In a terminal window enter:
You should receive the a message like:
Android>fastboot devices 011aa0a1a01aaaa1 fastboot
On the HTC site choose Unlock Bootloader and click on Get Started
Accept the warning and agreements and keep clicking Next until you reach the step were it asks you to enter the following command:
fastboot oem get_identifier_token
Copy the response into the "My Device Identifier Token Box" and edit it to keep only the alphanumeric s (what is kept should resemble the example they show you).
<<<< Identifier Token Start >>>>
<<<<< Identifier Token End >>>>>
Submit the information and you will receive an email with a small file attached named Unlock_code.bin
With your command prompt still open, enter the following command:
fastboot flash unlocktoken Unlock_code.bin
After entering this command, a message on your HTC phone will ask if you really want to unlock the bootloader. Use the Volume key to highlight the YES option and press the Power button to select it.
At this point the phone's bootloader has been unlocked and it will restart automatically. The first boot could potentially take some time (several minutes). If this happens, it is normal. Be patient and wait for the reboot.
After the phone reboots, any previous settings that you may have saved will be lost owing to the unlocking of the bootloader.
Before reentering the lost data, it is a good time to do any more installs you have planned (like a custom rom or rooting your phone) this way you only have to deal with reentering data once.
Rooting your phone
To install TWRP using fastboot (no root required):
Run the following command:
adb reboot bootloader Note: I did not know about this feature of ADB until I did this presentation.
You should now be in fastboot mode. (I renamed the TWRP file I downloaded to twrp.img
Enter the following command:
fastboot flash recovery twrp.img
If everything goes well, you should see something similar to this:
sending recovery (8130 KB)
OKAY [ 0.510s]
OKAY [ 0.476s]
finished. total time: 0.987s
next run the command:
N.B. Some devices will replace your custom recovery automatically during first boot. To prevent this, use Google to find the proper key combo to enter recovery. After typing fastboot reboot, hold the key combo and boot to TWRP. Once TWRP is booted, TWRP will patch the stock ROM to prevent the stock ROM from replacing TWRP. If you don't follow this step, you will have to repeat the install
To gain root access we will use TWRP and flash the file SuperSU.zip
Since the phone does not need to be connected to a computer at this point, I put the SuperSU.zip fileon an external micro SD card I loaded into the phone.
Turn off the phone and boot into recovery.
Select the recovery option (TWRP will now load instead of the stock recovery)
With TWRP loaded, follow the prompts to find and select the SuperSU.zip and then flash it.
Now select Reboot System and once the phone restarts you will have a rooted phone.
Apps to Improve Your Rooted Android Device's Performance:
ICE (In Case of Emergency) Lets EMTs have access to your medical and emergency contact information even if your android device is locked.
JuiceDefender – helps manage battery drain (like the radios 3g/4g/LTE/WiFi)
Greenify -- another power management app
Titanium Backup – besides backing up apps and data also allows to to either keep an appfrom running or remove the app(removing sometimes causes phone to crash)
NoBloat – deletes apps from your phone, including the pre-installed ones.
Tasker – Helps you automate your phone use.
Helpful Links and Sites Used In Preparing This Presentation.
I find xda-developers.com to be one of the best sites for information on how to customize Android devices. In addition, the developers there provide custom roms and kernels.
How to set S-Off: http://forum.xda-developers.com/showthread.php?t=2708464
Program Sunshine at: http://theroot.ninja/
TWRP can be downloaded from: https://twrp.me
SuperSu (latest version as of Sept 10, 2015)
Backup your phone:
HTC developer web site: https://www.htcdev.com/
Guide to unlocking and rooting the HTC one:
Thanks to Joe Homza for the excellent presentation! Also, thanks to Taos for hosting our meeting as well as supplying the pizza, cookies, and soda!
After Joe's presentation, we had some open discussion time. Member Darin mentioned that he was starting his Linux Beginner's class this coming Thursday with approximately 24 students and asked for help with this large class, also being held at Taos, at 6:30. A couple of members volunteered to assist htim that night.
Our next meeing will on Tuesday, Octorber 20th, at 6:30, at Taos. Meeting topic to be determined.