[GUIDE] [INTRO] Getting started with Android and rooting

Search This thread

Bleelas

Senior Member
Oct 10, 2010
84
325
Introduction to Rooting:


This is meant as a very basic discussion for people relatively new to rooting and Android or people that go through the steps but don't have a good idea of WHY. As a result, it will omit many details and simplify others. Also, it's not meant to be a rooting guide (as there are excellent ones out there already) so much as an explanation of concepts most of us take for granted, but noobies don't. All of this info is out there, but when you're new you may not know how to find it or even that you should be looking for it.

DISCLAIMER: I, nor anyone else, am not responsible for what you do with your phone. Rooting and otherwise altering your phone has the potential to brick your device, void your warranty, and many other bad things. Perform these actions at your own risk.

Post 1: before you root
What is rooting?
Phone Partitions
Intro to ROMS and kernels

Post 2: rooting and flashing
Steps of rooting
How to flash ROMs



What is root/rooting?
In Unix-style operating systems, "root" is the name of the user who has all permissions and is therefore able to run/modify/change/delete just about anything. If you're familiar with Windows, this account is called Administrator. The default account (that's you!) on an Android phone does NOT have these privileges. Rooting is the process of obtaining them (i.e. obtaining root access). Once you root, you can "flash" new software onto your phone without (much) restriction. This is great because you now have control over what programs are on your phone, how your phone handles resources, what kernels you run, and more!
Once your phone is rooted, you don't always wield all of that power. You control your access to all these new abilities with a program called SuperUser (available on the market and baked into ROMS). This program can grant these special rights to any other program that requests them. So let's say a program wants to write data to a place it's not normally allowed. It will ask SuperUser to up its privileges and then BAM! it can write where it wants to. You yourself can gain SuperUser privileges in a shell by typing su. Then YOU can read, write, and execute to your hearts desire.



Before you root:
Before rooting, there are some basic things you should know.


Phone partitions: Your phone has a number of partitions. The important ones to know at first are:

1. System - this partition is essentially what you think of when you think of the operating system, the Android UI, and preinstalled apps. When people talk about flashing ROMs (e.g. CyanogenMod, Synergy, etc), they are talking about flashing a new system partition...with some exceptions to be discusse later.

2. Boot - this is the kernel and ramdisk. The kernel is responsible for managing the interactions between the phones software (including the ROM) and the hardware. Altering the kernel can increase/decrease performance, battery life, and more because it manages applications and system resources. When you flash a new kernel, it flashes to the boot partition. You may not notice a big difference like you do when changing ROMS, but behind the scenes, your phone's performance can be drastically altered. A *LOOSE* analogy is that the ROM is like the body and interior of your car (including color, AC, stereo, heated seats, TV in headrests, etc.) and the kernel is like the engine. You may not see it, but you'll know it's there if it's awesome or it sucks.

3. Aboot - this was largely unimportant for newbies until the bootloader lock/unlock situation. The short story is that aboot contains functions which authenticate the boot partition (that's the kernel, remember?). It checks to see if your boot partition is Verizon legal and if not, it aborts the boot process and politely tells you to contact Verizon. This authentication is what is referred to as a "locked" bootloader. It prevents you from completely booting the phone with a custom kernel. The bootloader is "unlocked" by replacing the stock aboot partition with one that does NOT check up on the boot partition. This is important because it allows us to run whatever kernel we want without bothering with kexec.

4. Data - this contains user installed apps, settings, contacts, bookmarks, etc, etc, etc. You can wipe this partition (as opposed to the above partitions) and still boot into the operating system. However, you will have lost all your setting and user installed apps. This is also called a factory/data reset.

5. Cache - this is stuff that you frequently use so it's kept available by Android. You can wipe it without much consequence and SHOULD wipe it when flashing new ROMs.

6. Recovery - this partition contains a separate operating system that allows you to recover from a corrupted/absent/otherwise jacked up Android operating system. It has a number of other functions as well. The big ones are to backup your device and restore said backups, to wipe certain partitions, and to flash things to your phone (i.e. install new ROMs, recoveries, or other programs). The stock recovery is limited so you will definitely want a custom recovery, created by the fine devs in the community, on your device.




What is a ROM and what is a kernel?

I touched on this above. A ROM is what goes on the system partition. It contains what you think of as the Android OS including the UI and preinstalled apps. It controls how programs interact with you, the user. A kernel controls how those programs interact with the phones hardware. You need both a ROM and a kernel to have a functional phone. Not only that, but not all ROMs and kernels are compatible. A ROM based on Touchwiz (TW) needs a TW kernel and an AOSP (Android Open Source Project) ROM needs an AOSP kernel.

Kernels come as standard kernels, as described above, and kexec kernels. As the bootloader is unlocked, there's really no need for kexec on OUR device. However, it does bear mentioning...sooooo, kexec is a method of getting a custom kernel running without having it reside on the boot partition. Once the kernel is loaded, the phone doesn't care where it came from. Your phone has already checked the boot partition, OK'ed it, and loaded the kernel. The custom kernel that you actually WANT running is waiting patiently on your SD Card. The phone boots into a kexec enabled recovery, which loads the custom kernel while the over the current one (the boring stock kernel) while it is still running. The old bait and switch.




What is a recovery and which one should I use?
A recovery, as mentioned above, is a separate operating system that loads from the recovery partition and allows you to make changes to your phone should it need to be "recovered". It goes beyond this though, allowing you to backup and restore your phone, flash ROMs, flash a different recovery, install programs, mods, etc. On the d2vzw, you can enter recovery by powering down your phone and holding down volume up, home, and power. There are also ways to reboot into recovery easily through programs and mods commonly found in custom ROMs.

Backups of your phone are called nandroids and they contain the contents of the system, data, cache, recovery, and boot partitions. This means when you create a nandroid, you are backing up all that stuff.

I'm not going to tell you which one to use because for the most part it's a matter of preference. There are anecdotal stories about one recovery or another causing issues, but I've personally never had those issues and each recovery has its die hard supporters. I WILL say that if you want to use a ROM with a kexec kernel, you need a kexec enabled recovery. Lastly, if you decide to use kexec, your phone will look like it's bootlooping. That's normal.
 

Bleelas

Senior Member
Oct 10, 2010
84
325
I'm ready to start rooting/flashing!

There is an excellent guide stickied in the development thread here http://xdaforums.com/forumdisplay.php?f=1672 (big thanks to droidstyle). However, many of us forget what it's like to be a COMPLETE newbie and to someone who has no idea about anything, even that guide can be a little intimidating. You can follow the instructions, but may not understand what you're doing. The steps to take to start out with are:

1. Make sure you understand what I've written above. Make sure you are comfortable with the possibility of bricking your phone.

2. Root your device. As I said above, this is simply gaining root/Admin/whatever you want to call it access on your phone. In and of itself, it does NOT alter the ROM or kernel. However, there are many different ways to obtain root and some of them DO alter these things. The easiest and safest way to root (IMO) is to use Noxious Ninjas excellent tool. http://xdaforums.com/showthread.php?t=1792342. If you like it, I encourage you to donate or at least "Thanks" him. It works by taking advantage of debugfs permissions to get the su binary (remember this from above??) onto your phone with permissions set so you can run it. It therefore doesn't change ROMs or anything else. You won't lose data, apps, or anything else. It just sneaks su right onto your current setup.

3. Install a custom recovery. This will allow you to do all the fun stuff I talked about above. I recommend installing EZ-recovery from the market and flashing CWM 6.0.1.0.
-- Install EZ-recovery
-- Under the "Recovery" heading, click the Recovery radio button and select CWM 6.0.1.0
-- Click flash

4. Backup everything as if your life depended on it. This means backing up your NV/IMEI as shown here http://rootzwiki.com/topic/32397-tutorial-imei-backup-nv-with-qpst-us-variants/ and making a nandroid (see above). You can restore a nandroid backup and you'll be right back where you were before flashing or changing things around. You should also back up texts, anything on your internal sd card, and programs SEPARATELY from a nandroid (see below) so that you can easily replace them after flashing a new ROM. The steps to making a nandroid are (similar steps to restore):
-- Turn off your phone.
-- Hold down volume up, home, and power until recovery appears.
-- Use the volume rocker to go to "backup and restore" and hit the power button
--- Select backup and then select the external or internal SD card

5. Unlock the bootloader. See the aboot partition discussion above for what this means. You must do this seperately from flashing ROMs and kernels. Refer to this thread http://xdaforums.com/showthread.php?t=1839791 and give appropriate thanks! A warning...if you mess up your aboot partition, there's really nothing (that I know of) you can do to revive your phone besides sending it to someone with JTAG.

A quick note about backing up apps. Personally, I use Titanium backup because I've used it forever...and I think it's a great app. I'm not going to go into details, because it's not too tough to do a few basic things with it and because I want to stick to things that will help prevent bricks.



You're now ready to start flashing ROMs!


As a precursor, there are ROMS that are based on TouchWiz modified Android from Verizon/Samsung and there are ROMS based on AOSP (e.g. CyanogenMod). TW roms need a TW kernel and AOSP roms need an AOSP kernel. Until you get comfortable with everything, I would stick with TW, but that's just my opinion. Don't worry, you'll get comfortable pretty quickly.
Also, some roms come with kernels and will flash the kernel to your boot partition in addition to flashing the ROM to your system partition. Some ROMs don't come with kernels. If the ROM you choose comes with a kernel, that's great. If not, you'll still have the kernel you are currently running and you need to make sure there are no incompatibilities with your new ROM. ALWAYS ALWAYS ALWAYS read the OP of a rom you want to flash to find out kernel information as well as how to install the rom and anything else you may need to know. The general steps to flashing a ROM are (remember to read the OP for specifics):

1. Backup apps, data, call log, contacts, messages, etc. My program of choice for much of this is Titanium Backup available on the market. If you choose to use it, buy it as you'll use it a billion times.

2. Download the ROM you want and check the MD5

3. Place the ROM on the root of your SD card. Do NOT unzip it.

4. Reboot into recovery and make a nandroid backup

5. Wipe data/factory reset and wipe cache. Wipe it more than once if paranoid. People sometimes talk about wiping Dalvik cache. It's an option in your recovery, but it's not necessary IF you did a factory/data reset because the Dalvik cache is on the data partition which is wiped in the reset. You may want to wipe the Dalvik cache for some other purpose however.

6. Go to "install zip from sdcard" and select the ROM you want

7. If you want/need to flash a kernel, install that zip from the sdcard too.

8. Reboot and restore all that you backed up

If you want to flash a kernel without flashing a ROM, all you need to do is reboot into recovery, make a nandroid, wipe cache and Dalvik cache, and install the zip from your sd card.

Remember:
-- ALWAYS read the OP before installing anything
-- backup before making changes
-- verify MD5 checksums
-- wipe data and cache when flashing a new ROM (unless told not to by the ROM dev...sometimes referred to as a dirty flash)
-- NEVER accept an OTA (having a custom recovery should block OTAs anyway)

That's it for now. If people like this or have requests about other good noob topics, I'll consider adding to it. If not, then screw you! :)
 

anl2304

Senior Member
Feb 20, 2012
452
116
I didn't realize it was that easy to flash a custom kernel. Cool. The guide is very helpful.
 

kintwofan

Senior Member
Jul 1, 2011
5,114
2,825
Irmo, SC
OnePlus 7T
Sony Xperia 1 III
Nice writeup, a lot if good information. I think I've successfully graduated from noob but still like to read more. One minor problem I noticed. All your rooting, and unlocking links are for ICS I don't think anyone is still on it. You may want to link to open your eyes guide for JB.... which will probably require a whole post to explain what is going on.

Sent from my VS920 4G using xda app-developers app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Introduction to Rooting:


    This is meant as a very basic discussion for people relatively new to rooting and Android or people that go through the steps but don't have a good idea of WHY. As a result, it will omit many details and simplify others. Also, it's not meant to be a rooting guide (as there are excellent ones out there already) so much as an explanation of concepts most of us take for granted, but noobies don't. All of this info is out there, but when you're new you may not know how to find it or even that you should be looking for it.

    DISCLAIMER: I, nor anyone else, am not responsible for what you do with your phone. Rooting and otherwise altering your phone has the potential to brick your device, void your warranty, and many other bad things. Perform these actions at your own risk.

    Post 1: before you root
    What is rooting?
    Phone Partitions
    Intro to ROMS and kernels

    Post 2: rooting and flashing
    Steps of rooting
    How to flash ROMs



    What is root/rooting?
    In Unix-style operating systems, "root" is the name of the user who has all permissions and is therefore able to run/modify/change/delete just about anything. If you're familiar with Windows, this account is called Administrator. The default account (that's you!) on an Android phone does NOT have these privileges. Rooting is the process of obtaining them (i.e. obtaining root access). Once you root, you can "flash" new software onto your phone without (much) restriction. This is great because you now have control over what programs are on your phone, how your phone handles resources, what kernels you run, and more!
    Once your phone is rooted, you don't always wield all of that power. You control your access to all these new abilities with a program called SuperUser (available on the market and baked into ROMS). This program can grant these special rights to any other program that requests them. So let's say a program wants to write data to a place it's not normally allowed. It will ask SuperUser to up its privileges and then BAM! it can write where it wants to. You yourself can gain SuperUser privileges in a shell by typing su. Then YOU can read, write, and execute to your hearts desire.



    Before you root:
    Before rooting, there are some basic things you should know.


    Phone partitions: Your phone has a number of partitions. The important ones to know at first are:

    1. System - this partition is essentially what you think of when you think of the operating system, the Android UI, and preinstalled apps. When people talk about flashing ROMs (e.g. CyanogenMod, Synergy, etc), they are talking about flashing a new system partition...with some exceptions to be discusse later.

    2. Boot - this is the kernel and ramdisk. The kernel is responsible for managing the interactions between the phones software (including the ROM) and the hardware. Altering the kernel can increase/decrease performance, battery life, and more because it manages applications and system resources. When you flash a new kernel, it flashes to the boot partition. You may not notice a big difference like you do when changing ROMS, but behind the scenes, your phone's performance can be drastically altered. A *LOOSE* analogy is that the ROM is like the body and interior of your car (including color, AC, stereo, heated seats, TV in headrests, etc.) and the kernel is like the engine. You may not see it, but you'll know it's there if it's awesome or it sucks.

    3. Aboot - this was largely unimportant for newbies until the bootloader lock/unlock situation. The short story is that aboot contains functions which authenticate the boot partition (that's the kernel, remember?). It checks to see if your boot partition is Verizon legal and if not, it aborts the boot process and politely tells you to contact Verizon. This authentication is what is referred to as a "locked" bootloader. It prevents you from completely booting the phone with a custom kernel. The bootloader is "unlocked" by replacing the stock aboot partition with one that does NOT check up on the boot partition. This is important because it allows us to run whatever kernel we want without bothering with kexec.

    4. Data - this contains user installed apps, settings, contacts, bookmarks, etc, etc, etc. You can wipe this partition (as opposed to the above partitions) and still boot into the operating system. However, you will have lost all your setting and user installed apps. This is also called a factory/data reset.

    5. Cache - this is stuff that you frequently use so it's kept available by Android. You can wipe it without much consequence and SHOULD wipe it when flashing new ROMs.

    6. Recovery - this partition contains a separate operating system that allows you to recover from a corrupted/absent/otherwise jacked up Android operating system. It has a number of other functions as well. The big ones are to backup your device and restore said backups, to wipe certain partitions, and to flash things to your phone (i.e. install new ROMs, recoveries, or other programs). The stock recovery is limited so you will definitely want a custom recovery, created by the fine devs in the community, on your device.




    What is a ROM and what is a kernel?

    I touched on this above. A ROM is what goes on the system partition. It contains what you think of as the Android OS including the UI and preinstalled apps. It controls how programs interact with you, the user. A kernel controls how those programs interact with the phones hardware. You need both a ROM and a kernel to have a functional phone. Not only that, but not all ROMs and kernels are compatible. A ROM based on Touchwiz (TW) needs a TW kernel and an AOSP (Android Open Source Project) ROM needs an AOSP kernel.

    Kernels come as standard kernels, as described above, and kexec kernels. As the bootloader is unlocked, there's really no need for kexec on OUR device. However, it does bear mentioning...sooooo, kexec is a method of getting a custom kernel running without having it reside on the boot partition. Once the kernel is loaded, the phone doesn't care where it came from. Your phone has already checked the boot partition, OK'ed it, and loaded the kernel. The custom kernel that you actually WANT running is waiting patiently on your SD Card. The phone boots into a kexec enabled recovery, which loads the custom kernel while the over the current one (the boring stock kernel) while it is still running. The old bait and switch.




    What is a recovery and which one should I use?
    A recovery, as mentioned above, is a separate operating system that loads from the recovery partition and allows you to make changes to your phone should it need to be "recovered". It goes beyond this though, allowing you to backup and restore your phone, flash ROMs, flash a different recovery, install programs, mods, etc. On the d2vzw, you can enter recovery by powering down your phone and holding down volume up, home, and power. There are also ways to reboot into recovery easily through programs and mods commonly found in custom ROMs.

    Backups of your phone are called nandroids and they contain the contents of the system, data, cache, recovery, and boot partitions. This means when you create a nandroid, you are backing up all that stuff.

    I'm not going to tell you which one to use because for the most part it's a matter of preference. There are anecdotal stories about one recovery or another causing issues, but I've personally never had those issues and each recovery has its die hard supporters. I WILL say that if you want to use a ROM with a kexec kernel, you need a kexec enabled recovery. Lastly, if you decide to use kexec, your phone will look like it's bootlooping. That's normal.
    6
    I'm ready to start rooting/flashing!

    There is an excellent guide stickied in the development thread here http://xdaforums.com/forumdisplay.php?f=1672 (big thanks to droidstyle). However, many of us forget what it's like to be a COMPLETE newbie and to someone who has no idea about anything, even that guide can be a little intimidating. You can follow the instructions, but may not understand what you're doing. The steps to take to start out with are:

    1. Make sure you understand what I've written above. Make sure you are comfortable with the possibility of bricking your phone.

    2. Root your device. As I said above, this is simply gaining root/Admin/whatever you want to call it access on your phone. In and of itself, it does NOT alter the ROM or kernel. However, there are many different ways to obtain root and some of them DO alter these things. The easiest and safest way to root (IMO) is to use Noxious Ninjas excellent tool. http://xdaforums.com/showthread.php?t=1792342. If you like it, I encourage you to donate or at least "Thanks" him. It works by taking advantage of debugfs permissions to get the su binary (remember this from above??) onto your phone with permissions set so you can run it. It therefore doesn't change ROMs or anything else. You won't lose data, apps, or anything else. It just sneaks su right onto your current setup.

    3. Install a custom recovery. This will allow you to do all the fun stuff I talked about above. I recommend installing EZ-recovery from the market and flashing CWM 6.0.1.0.
    -- Install EZ-recovery
    -- Under the "Recovery" heading, click the Recovery radio button and select CWM 6.0.1.0
    -- Click flash

    4. Backup everything as if your life depended on it. This means backing up your NV/IMEI as shown here http://rootzwiki.com/topic/32397-tutorial-imei-backup-nv-with-qpst-us-variants/ and making a nandroid (see above). You can restore a nandroid backup and you'll be right back where you were before flashing or changing things around. You should also back up texts, anything on your internal sd card, and programs SEPARATELY from a nandroid (see below) so that you can easily replace them after flashing a new ROM. The steps to making a nandroid are (similar steps to restore):
    -- Turn off your phone.
    -- Hold down volume up, home, and power until recovery appears.
    -- Use the volume rocker to go to "backup and restore" and hit the power button
    --- Select backup and then select the external or internal SD card

    5. Unlock the bootloader. See the aboot partition discussion above for what this means. You must do this seperately from flashing ROMs and kernels. Refer to this thread http://xdaforums.com/showthread.php?t=1839791 and give appropriate thanks! A warning...if you mess up your aboot partition, there's really nothing (that I know of) you can do to revive your phone besides sending it to someone with JTAG.

    A quick note about backing up apps. Personally, I use Titanium backup because I've used it forever...and I think it's a great app. I'm not going to go into details, because it's not too tough to do a few basic things with it and because I want to stick to things that will help prevent bricks.



    You're now ready to start flashing ROMs!


    As a precursor, there are ROMS that are based on TouchWiz modified Android from Verizon/Samsung and there are ROMS based on AOSP (e.g. CyanogenMod). TW roms need a TW kernel and AOSP roms need an AOSP kernel. Until you get comfortable with everything, I would stick with TW, but that's just my opinion. Don't worry, you'll get comfortable pretty quickly.
    Also, some roms come with kernels and will flash the kernel to your boot partition in addition to flashing the ROM to your system partition. Some ROMs don't come with kernels. If the ROM you choose comes with a kernel, that's great. If not, you'll still have the kernel you are currently running and you need to make sure there are no incompatibilities with your new ROM. ALWAYS ALWAYS ALWAYS read the OP of a rom you want to flash to find out kernel information as well as how to install the rom and anything else you may need to know. The general steps to flashing a ROM are (remember to read the OP for specifics):

    1. Backup apps, data, call log, contacts, messages, etc. My program of choice for much of this is Titanium Backup available on the market. If you choose to use it, buy it as you'll use it a billion times.

    2. Download the ROM you want and check the MD5

    3. Place the ROM on the root of your SD card. Do NOT unzip it.

    4. Reboot into recovery and make a nandroid backup

    5. Wipe data/factory reset and wipe cache. Wipe it more than once if paranoid. People sometimes talk about wiping Dalvik cache. It's an option in your recovery, but it's not necessary IF you did a factory/data reset because the Dalvik cache is on the data partition which is wiped in the reset. You may want to wipe the Dalvik cache for some other purpose however.

    6. Go to "install zip from sdcard" and select the ROM you want

    7. If you want/need to flash a kernel, install that zip from the sdcard too.

    8. Reboot and restore all that you backed up

    If you want to flash a kernel without flashing a ROM, all you need to do is reboot into recovery, make a nandroid, wipe cache and Dalvik cache, and install the zip from your sd card.

    Remember:
    -- ALWAYS read the OP before installing anything
    -- backup before making changes
    -- verify MD5 checksums
    -- wipe data and cache when flashing a new ROM (unless told not to by the ROM dev...sometimes referred to as a dirty flash)
    -- NEVER accept an OTA (having a custom recovery should block OTAs anyway)

    That's it for now. If people like this or have requests about other good noob topics, I'll consider adding to it. If not, then screw you! :)