Friday, 1 September 2017

How and Why to Root an Android

Android is a great OS. It gives it's users full control over the device, unlike IOS, where the access is limited. But even in android, you can only access limited things, if you are using it in the same condition as you bought it in. None of the OEMs gives full access to the device by default as it can cause damage to device at hardware level. Also when you search for rooting related stuff, first thing you see is the warning saying that "it might cause cause damage to your device". As much as I hate to say it but it's true. Because rooting gives you full access to your phone, you can change operating frequencies, change OS, uninstall any service or app from your phone. Which, if not done with precaution, may cause damage.

But If you are among those, more than average users, who are willing to take a small risk for the sake of technology and want to use your phone to it's full potential,  rooting is the right thing for you.
In this article, we are going to cover What is rootingWhat are the various ways to root your device, and What can you do after you have successfully rooted your device. So let's get started..

What is Rooting ?

Well Rooting is basically getting superuser access by altering some code in the system. It allows you to access phone's subsystem and modify your device according to your need. A superuser account has more access than a normal user for example If you are using your phone normally, you can not access root folder (/)  or system  folder (/system)  in your phone, Or let's say you can (with some new file browsers now a days...) but you can edit, add or delete any file to/from it. You are only allowed to modify storage folder (/sdcard). On the other hand, If you have a superuser access, you can easily modify those folders, even delete some of them (just saying Don't do it).

Mostly people do root their phone to get rid of the bloatwares (apps that come pre installed and no one uses them), yes you heard it right, you can uninstall those apps in just a click. I remember when I stumbled upon rooting, back in Froyo era, I was searching to get rid of Samsung apps (due to storage and RAM problem), one thing led to another and finally I realised that rooting is the only way. I did it and successfully removed the unwanted apps.

Removing apps is not the only thing you can do here. I mean now a days we have good internal storage, good amount of RAM but still, if those apps run in the background, it will consume more power and slow down your phone. take for example, If you are using google calendar, you don't need Samsung or Sony calendar, but there is no option to uninstall those apps. With root, you can uninstall them or freeze them (better).

various ways to root your device

The best and most reliable way to root your phone is by flashing Superuser.zip file from the recovery.
This method involves installing device drivers and adb and fastboot drivers (download them here)
You need to verify that the drivers are installed. Go to adb folder in your pc and right click anywhere with shift button press. In the option menu, select 'open command window here'. Turn on usb debugging and bootloader unlocking  in your device (setting > developer options  > usb debugging, unlock bootloader).
Connect your device to pc and write the following command
adb devices



This verify that adb is connected. Now you have to boot to fastboot mode. you can do that by either powering off your device at first and than power it on by pressing some combination of keys (Combination varies with device) or by writing the command
adb reboot bootloader

This will boot your device to fastboot mode.
you can verify the fastboot mode by writing the command 
fatboot devices


Once it is verified that the device is connected, you are good to go. The process involves the following steps:-
1. Unlock the bootloader by writing the command 
fastboot oem unlock

This will wipe your entire phone so make sure you backup before doing this.
Your device screen will now show instructions to continue this step. Press yes and wait for it to finish.

2. Flash custom Recovery
To flash any mods or custom Rom, you need to have custom recovery installed. The default recovery, that comes pre installed in your device, isn't going to support these installations. To download recovery for your device, just google it. It's very easy to find these things now a days. I recommend using TWRP recovery as it supports wide variety of ROMs and it's easier to backup and restore using this.
To flash a custom recovery, first download the file (like I said google it), if you have .img file it's good or extract the IMG file from the zip. Move this IMG file to adb folder and rename it (to whatever you want). Now in the FASTBOOT mode, write the following command
fastboot flash recovery name.img

replace name with your recovery name.

3. Flash the Supersu.zip


To download Supersu.zip, which works with your device, I recommend you go to XDA 
Search for your device, and goto guides section. There will definitely be a thread for rooting. Just download Supersu.zip from there.


Put the downloaded file (Supersu.zip) in your sdcard. You can use MTP from TWRP (one of the big advantages of using it).
Now go to install > supersu.zip. Swipe at the bottom of the screen (if prompted).
That's it your device is rooted. Now just reboot the device and you will see an app SU (SuperUser) installed.

Other Ways to root

Above method may look complex but as I said it's most reliable one. If you think, yo can't go through all this trouble, there are some apps available now a days, you can use to root your phone without involving computer. These apps are:-

  • KingoRoot
  • One click Root
  • Towel root

It's easy to use these apps. Just follow the instructions and you will be done in 5 minutes. But they don't support majority of the devices also root is not guarantied. I remember once I did use Towelroot and One click Root, process completed successfully but it couldn't root my device.
As the device is yours, so does the choice. Use whatever method you want, end result is same.
NOW as you have successfully rooted your device, we will see

what can you do with a rooted device

Let's see from the very basic thing people do --> Remove unwanted apps

You can download apps like uninstaller, remove system apps and give them root permission (it will be prompted when you will try to remove a system app) and they will do the job for you. However if you do not want to download a new app to remove old apps, just go to setting of your file browser and turn on root browser or root mode. Then go to /system/app and delete whatever you want. Remember this can cause issue if you delete some essential service so make sure you know what you are deleting. You can delete apps like calendar, calculator, messaging etc..

Change Operating Frequency
Yes you read it right, you can alter frequencies, your device operating in. But this can also be dangerous, but it can improve processing speed of your device. Download any kernel tuning app and go to cpu section. You can change minimum and maximum frequency here for eg - if you want to save some battery decrease the max frequency, this will improve battery life but will decrease the performance.

Install Mods
Mods can add/remove things from system setting. For eg- If you want to have double tap to wake,  3D touch (pressure sensitive) like IOS, dimmer backlight level, change battery icons, etc. These features are not provided by every OEM by default but with mods you can implement these. 
Mod generally comes as a zip file, which you have to flash just like you did the superuser.zip. It is highly recommended that you make a backup of the entire rom (including system, data, ... everything) before flashing any mod. 

Install Custom ROMs
This is the best part of having an android device. You don't need root to do this but custom recovery is required. Custom ROM (OS) is an android OS but modified for better performance and battery life. Other than this you also get a large number of  options for customization or in better words 'tweaking your device'. Custom ROMs open the possibility of getting unique features of other devices, into your device. For eg- Moto display, traffic indicators, battery bar, etc. The list is huge here, I will discuss features in some other  article. 

Another advantage of custom ROM is that you can upgrade your OS to a newer android version. Specially if you have an old phone, or you can not wait for your OEM to push update after 3 months. With custom ROM you can run android Marshmallow or Nougat  on NOTE 3, yes it's pretty old, but it's possible. 

Custom ROMs open up new possibilities for your device. There is a huge community of people who flash (install) these ROMs on daily basis, including me. To download custom ROMs, go to XDA forum and search for your device. And than go to development section. Here you will find all sorts of ROMs available for your device.

I personally recommend not to use ROM manager to flash ROMs, trust me, as easy as it might sound, the more risky it is. You should do a little research before flashing a new ROM for eg- what are the features, bugs, how frequent is the update, response of other people etc.

Should I Root?
Well the device is yours, YOU paid for it so don't you want it to work according to your need ? I mean what if you don't want to use two swipes for the quick setting, or you want always on display like Samsung have, or navigation buttons looks too big for your screen, or want to customize notification slider in oneplus phones, or want off screen gestures to access an app directly from lockscreen, or Knock codes like LG. Everything is possible if are willing to go in the world of rooting and custom ROMs.

Servo motor with STM32

I have already covered a tutorial about Pulse Width Modulation in STM32  HERE  and in this tutorial i am going to cover one of its applicat...