[REF] ★★★Understanding the Android world before rooting your LG Nexus 4★★★

Search This thread

abaaaabbbb63

Senior Member
Nov 19, 2011
3,898
3,423
Somewhere Over The Rainbow
[REF] ★★★Understanding the Android world before rooting your LG Nexus 4★★★

Understanding the Android world before rooting your LG Nexus 4

Here is a *noob friendly* collection of information every user that wants to root their phone should know. Many people blindly follow guides without even knowing what "Rooting" means. Hopefully, this will help new users (and old ones, why not?) understand what is happening with their phone, and what they will put up with.

This may seem as a lot to read, but there are no shortcuts. You either read and learn what you're dealing with, or find out the hard way.



Let's get started, shall we?


What does rooting mean?

To 'root' your phone means to gain administrative rights on the file system of your phone (in linux, root is the username of the master admin, kind of being an Administrator on Windows). With root access, you can install and uninstall anything you want on the phone.

Most phones come with limited access regarding what you can and can't do on it. This isn't necessarily a bad thing, because it can keep users from accidentally breaking something they shouldn't mess with on the phone, especially in regards to the operating system. However, many manufacturers limit your rights to things that aren't really so mission critical, too, and rooting the phone gets around this.

If you have a few unnecessary applications (bloatware) pre-installed on your phone that you cannot uninstall, rooting will give you this ability. It will also allow you to upgrade to newer versions of Android before your phone's manufacturer and/or cell provider make the updates available to you.



So now you know what rooting means. And I bet you are now thinking "Should I do it, or not?" Well, hope this helps you decide:


The advantages of rooting

-De-bloat your phone. Uninstall any unwanted system apps.
-More control over how the CPU acts. This can increase performance or battery life, depends on how you configure it.
-More control over power consumption. This implies undervolting your CPU, giving it less power, so it consumes less.
-More control over how apps start up. Prevent apps from starting up when they don't need to.
-Change your Baseband (Radio). Try different radio versions, with the purpose of reducing battery drain or improving your signal strength. This may also allow you to enable LTE, due to the fact that it's disabled on the latest radios.
-Flash custom ROMs. Bored of the stock ROM and look? Browse through the hundreds of custom ROMs provided by this community, each having different features and looks.
-Backups. The ability to completely backup your phone, and fully restoring it to the time of the backup. This is done with a Nandroid Backup (we'll talk about this later)
-Mods and Inovations. Use many mods, fixes, tweaks or features created by the community!
-Custom Kernels. As a Nexus device, the Nexus 4 has tons of kernels with different features, supporting better performance, or battery life! To see what a kernel is, keep reading.
-Run apps that need Root Permission. These apps can be very useful, like Titanium Backup, Root Explorer, Terminal Emulator and many others!

The disadvantages of rooting

-Rooting will void your warranty (Although reverting root is very easy)
-The process a bit dangerous. Something could (99.9% probably not, but still) go wrong, and end up bricking your phone. So, yes, the process is 0.1% risky. You can end up deleting everything on your phone. You'll have to handle this process gently and with care.
-You will be able to do a lot more mistakes. These may cause damage to your phone (But hey, that's why we have these kind of threads, eh?)
-No more over the air official updates. You'll have to update your phone manually, through your recovery. (Which isn't that hard)



Now that you fully know what rooting implies, let's continue exploring the Android world.

What about the internal memory? How does that work?

Now, as you might already know, each phone has an internal memory. In the Nexus 4's case, it's either 8GB or 16GB. This internal memory needs to hold a lot of things, not only your personal data. This is why you only have available to use 5.8 GB or 12.9 GB.
An Android's internal memory is partitioned into many chunks that have their separate purposes.
These are all the Nexus 4's partitions, and their names.
modem -> /dev/block/mmcblk0p1
sbl1 -> /dev/block/mmcblk0p2
sbl2 -> /dev/block/mmcblk0p3
sbl3 -> /dev/block/mmcblk0p4
tz -> /dev/block/mmcblk0p5
boot -> /dev/block/mmcblk0p6
recovery -> /dev/block/mmcblk0p7
m9kefs1 -> /dev/block/mmcblk0p8
m9kefs2 -> /dev/block/mmcblk0p9
m9kefs3 -> /dev/block/mmcblk0p10
rpm -> /dev/block/mmcblk0p11
aboot -> /dev/block/mmcblk0p12
sbl2b -> /dev/block/mmcblk0p13
sbl3b -> /dev/block/mmcblk0p14
abootb -> /dev/block/mmcblk0p15
rpmb -> /dev/block/mmcblk0p16
tzb -> /dev/block/mmcblk0p17
metadata -> /dev/block/mmcblk0p18
misc -> /dev/block/mmcblk0p19
persist -> /dev/block/mmcblk0p20
system -> /dev/block/mmcblk0p21
cache -> /dev/block/mmcblk0p22
userdata -> /dev/block/mmcblk0p23
DDR -> /dev/block/mmcblk0p24
grow -> /dev/block/mmcblk0p25

Yes, there are quite a lot. You, as a user, don't need to care about all of them. Here are the ones you will need to know about:

/system- size: about 0.5GB
This partition holds the Android OS itself. Kind of like the C:// disk on your every day Windows PC. This partition has many folders and files you cannot normally get to, due to safety reasons. For example, system/app is where all the system apps are installed.

If something gets deleted from this partition, Android will most probably won't work properly.


/data- size: either 5.8GB, or 12.9GB
This is where all your personal data is kept. This includes apps, sms, contacts, e-mails etc. It also stores your system settings, like wallpaper, and all those stuff you set up when you got your phone. The most important folders on this partition are data/app (where your apps are stored), data/data (where you app data is stored, like highscores and stuff), and data/media.
Data/media might be considered your sd-card. Yes, I know the Nexus 4 doesn't have an sd-card, but this folder works like one. When you connect your phone to your PC, this is the folder that pops up, with all your music, images, videos, and whatever else you keep on your phone.



Things are getting a bit more complicated, eh? Just bare with me. Next, I will be explaining the different terms you will be encountering throughout your Android experience.


Things you hear people talk about

Kernel
The kernel is an essential part of any Linux based operating system. It's the program that manages input and output requests of the operating system. Imagine you're at a restaurant. You give your order to a waiter. He takes it to the chef, the chef makes your food, then the waiter brings it back to you, and you enjoy it. In this case, you are the Android system, the waiter is the Kernel, and the chef is the hardware. The system gives the Kernel a request, like firing up another processor core when you play a heavy game, and the Kernel fulfills the request.

Here is an image for better understanding
382px-Kernel_Layout.svg.png



Recovery
This is a secondary, mini operating system that has access to your internal memory. It contains a few commands that would normally help you recover your Android system in case of a failure, like factory resetting. You will see that, for rooting, you will need to install a custom recovery.
The stock recovery does not have the ability to write custom ROMs (I'll explain these later) on your internal memory. A custom recovery has this option, and many more.
Here are some images for you to fully understand:

Stock recovery:
Unroot+Nexus+4+to+Stock+4.2.Still013.png


Custom Recovery
cwm-n4.jpg


You can see that the Custom Recovery has more options, including "Backup and Restore", Advanced, and Install zip from Sd-card.
You can get in Recovery by powering off your phone, then hold Power+Volume Down button until a black screen with colored text appears. Then, use the volume buttons to select 'Recovery", and then press the Power Button to select it.


Bootloader
The bootloader is the first thing that fires up when you open your phone. As the name says (Boot+Loader), this program loads the kernel, which when boots up the Android system.
The same bootloader can also boot in recovery, as explained above.
When you first get the phone, the bootloader is in a locked state. That means that you cannot use fastboot commands like "fastboot flash" or "fastboot boot". With other words, you cannot simply flash a custom recovery. Thankfully, Google gave us the option to unlock the bootloader very easily, and flash a custom recovery of our choice.


Custom ROMs
A custom ROM is a ZIP file that contains an altered version of the Android OS. There are many custom ROMs for the Nexus 4, made by wonderful and skilled devs for the community. You can install a Custom ROM with your Custom Recovery. Custom ROMs contain the following folders and files:

Untitled.png


META-INF- This folder holds the installation info and data. A custom recovery does not know on it's own how to install a ROM. In this folder, there's a txt file that contains a script, with the purpose of telling the recovery what to do.

System- This folder contains the stuff that will be installed on the /system partition that we talked earlier about.

boot.img- Among others, this file contains the kernel that comes with the ROM.


Ok, so now, after you read all this stuff, you're probably thinking "Ok, I will never get the hang of this". Don't worry. With time, you will know all of these from reflex. And, after you got over that, and manned up again, you probably thought "Ok, let's root this damn thing!". Not quite yet. We aren't done. There are still some crucial things that you need to know. So let's continue.


How to backup your stuff

Before you do anything EVER, you'll always have to backup your stuff, even if you don't feel like it, or your dog died (in which case I'm truly sorry), but, no matter what you're about to do, always have a recent backup sitting around.
There are many ways and things you can and will probably have to backup.

1. Backup your entire phone, by creating a Nandroid Backup.
As you saw in the 'Custom Recovery" picture above, you have a "Backup and Restore" option. Here it is again:
cwm-n4.jpg


With every occasion, it's best to use it as often as possible. It only takes about 2 minutes, but it could be a life saver.
A Nandroid will backup:
/system
/data (Except /data/media, where your "sd-card" is, because it's too large and not that important)
/cache (Yes, there is a cache partition, and it will be backed up, although not really necesarry)
kernel (The kernel will be backed up too)

***Optional tip: I always keep a recent nandroid backup on my PC, in case I somehow wipe all my phone's contents, and my backup among with them. The Nandroid backup is saved at this location, which can be accest with a root file explorer, like ES File Explorer : mnt/shell/emulated/clockworkmod/backup. If you want to copy it to your storage, just copy the latest backup, and then move it to your PC.

2. Your apps and data only
This can be very useful when changing ROMs. You just got bored of your ROM, and want to move to another one. The only way of taking your apps and data with you is by backing them up with an application like Titanium Backup. The backups will be saved in data/media, and will be restored using the same app with which you backup up on the new ROM.


3. Your SMS, Contacts, MMS etc.
These things can be backed up by special apps on the Play Store. Ok, contacts will be restored by Google Sync ( although not always done properly, that's why I still back them up), but SMS will not be restored. There are many free apps that back them up for you, nice an easily, for them to be restored in case of a ROM change or data loss.


4. Your storage (data/media, sd-card)
You just connect your phone to your PC, select all folders, and copy all over on your PC. This will be useful when you unlock the bootloader. A bootloader unlock will wipe all the stuff on your phone (This can be avoided, read guides). So keeping a copy of your sd-card contents on your PC isn't such a bad idea.


Now you know how to keep it safe by creating backups. I will say it again, you are never too safe! Backup when you do a modification, even if it's tiny. Now, after you've finished reading the above, you will probably attempt to root. You will use one of the guides out there ( I will link one at the end of this thread ) to install a custom recovery, and gain root access. But what to do with it? Well, you will most likely end up flashing a custom ROM.


Flashing a custom ROM

You will get bored of the stock ROM, and will decide to flash a custom ROM. But you haven't done it before, and you don't really understand the process.Before you do anything, you must:
-Make sure that the files are for your phone ! If you flash files that were made for another phone, you might end up with a brick!
-Never panic! There is always a way out! That's what backups are for!
-Read all the instructions! Every ROM thread has instructions. Read them!


{By the way, flashing = installing}

Now, let me take you through the whole flashing process. ( Use the steps in the ROM threads if instructed differently than here )

1. You will search far and wide in these forums for a custom ROM that fits your needs. Every ROM comes as a ZIP file. So when you decide on a ROM, download the zip. For copyright reasons, Google Apps (Play Store, Google Now etc) don't come included with the ROM. So you will have to download them too. They are usually linked on the ROM main thread.
Some ROMs might have addons too, so check them out, and download the ones you want.

2. You now downloaded the ROM, Google Apps, and some addons. The next step will be to put them on your sd-card. Connect your phone to your PC, and make an easy access folder, like "Root Stuffs" where you'll put all these zips.

3. Now, let the backup process begin. You first backup your apps, app data , SMS, Contacts etc., like I explained above. I recommend Titanium Backup for apps and SMS, MC Backup for contacts.

4. Now you are ready to go in recovery. Power down your phone. Then, press and hold the Power Button and the Volume Down button at the same time. You will be brought to the Bootloader Screen. Now, with the Volume Buttons, switch through the options until you find "Recovery". Then press the Power Button again.

5. Now you will be booted in your Custom Recovery. Depending on your recovery, you will have the options on your screen.

CWM Recovery:

6. You will go to the Backup and Restore menu, and select "Backup". If you made a backup before, you can select "Delete" first, and delete it, for space consumption purposes.

7. After the backup finished, you will return to the main screen. There, select 'Wipe data/ Factory Reset". This will wipe everything in /data except /media, so your sd-card will remain untouched. Don't worry, you have a Nandroid Backup!

8. After the wipe finished, you will go to "Install zip from sd-card". You'll have to navigate to the folder where you put the ROM, and select it. You'll see it will nicely install.

9. After the ROM finished installing, you will have to flash the Google Apps zip, and the mods. Install them the same way you installed the ROM itself.

10. After you have flashed everything, you can select "Reboot system now" . First boot will take longer to complete. Again, don't panic. You have a Nandoid bakcup . You will end up with the ROM booted, and you'll continue setting it up.

TWRP Recovery:

6. Go to the "Backup" menu, select "Boot", "System", and "Data", then swipe the thing on the bottom on the screen to start backing up.

7. Once you're done, use the home button to get to the main screen. Select "Wipe", and swipe the thing again to Factory Data Reset. This will wipe data, cache and dalvik cache. This will not wipe your internal storage (Music, photos, etc).

8. After the wipe finished, use the home button again to get to the main screen. From there, select the 'Install" option. You'll have to navigate to the folder where you put the ROM, and select it. Then, by using the "Add more zips" option, add the Gapps package, and and then any addons or mods, in this order. Then swipe the bottom thing to flash.

9. After you have flashed everything, you can select "Reboot" . First boot will take longer to complete. Again, don't panic. You have a Nandoid bakcup . You will end up with the ROM booted, and you'll continue setting it up.

***In case something went bad, like your phone doesn't boot for more than 10 minutes, or the animation endlessly repeats itself (Boot Loop), do the following:

11*. Hold down the Power +Volume Buttons until the phone shuts down. Then release them for a second, and immediately press them again. You will be brought to the bootloader screen. Enter recovery.

12*. In recovery, go to the "Backup and Restore" menu, and select "Restore". Then pick the backup you did earlier, and wait for it to complete. Then, select "Reboot system now", and you should be booted back in your original ROM.



Now, let's say that after you flashed a ROM, it either did not boot, or you had some bugs with it. You will go to the thread ROM to report your problem. Here's how to not post:
"This ROM doesn't work"

You will have to be a lot more specific than that. In reporting a problem, you will have to do the following:
-Say what you did (Flashing process)
-What you flashed afterwards
-What you did to reproduce the bug
-What recovery you use
-ROM Version
-even provide a logcat <This is quite advanced> (http://forum.xda-developers.com/showthread.php?t=1726238)


You have to give as many details as possible, so the developer can sort things out.


ADB and Fastboot

ADB (Android Debug Bridge)
The Android Debugging Bridge is kind of a toolkit, that has many commands to control your Android from your PC. This is an essential part of your Android experience. With ADB, you can do many stuff that you couldn't normally do, like backup your apps, or push and pull packages from your phone.
ADB is also used by many of the useful tools out there, like toolkits, and all sort of programs that enhance your Android experience.
With ADB, you can also Logcat. Logcatting is creating a log of everything that happens on your Android phone while it's on. This is used to find the sources of bugs.

Example of ADB Commands:
Code:
adb pull /system/app/RANDOM APP = creates a copy of a system app on your PC
adb push app /system/app = Copies an app from your PC to your system partition
adb reboot bootloader/recovery = Reboots the phone in bootloader or recovery
adb logcat = Starts a logcat


Fastboot
Fastboot is also a toolkit of commands, but a bit different from ADB. While with ADB, you can do simple actions, with fastboot, you can do major ones, like flashing a whole partition, or formatting one. Fastboot is usually the preferred method to flash a recovery. Also, Fastboot usually works with .img files.

Example of Fastboot commands:
Code:
fastboot erase boot = Erases the kernel
fastboot erase recovery = Erases the recovery
fastboot flash system system.img = Flashes the System partition with an image
fastboot flash boot boot.img = Flashes kernel
fastboot flash userdata data.img = Flashes Data partition
fastboot flash recovery recovery.img = Flashes a new recovery
fastboot reboot = Reboots the phone

To use ADB and Fastboot, you must first have ADB drivers and Fastboot drivers installed. Here is a very good guide to set up these two useful things:
http://www.redmondpie.com/how-to-set-up-android-adb-and-fastboot-on-windows-tutorial/

Tips and Tricks

1. Try to not use toolkits. (I'm not disregarding any toolkit dev. They did a wonderful job)
Due to the fact that people are lazy in nature :D, toolkits have been made so that users don't struggle with rooting their phone. But there are many reasons for you to not use one:
-->you won't learn anything from using a toolkit, and, if something goes wrong, a toolkit can rarely fix your problem. It's better if you rely on your own forces.
-->you put the fate of your phone in someone else's hands. If a bit of code is wrong, then your phone could get bricked.
-->you miss out all the fun. Why buy a Nexus device if you don't want to explore the depths of the Android OS?

2. Never panic
Whenever you don't know what to do, and you're stuck, don't panic. There are many people here that can help you. Don't try doing anything blindly. Search the forums, or start a thread in the Q&As section, and we will help you.

3. Read everything carefully!! (If you read this, post a cat picture in this thread)
I might have said it a couple of times throuout this post, but always read everything. Someone wrote something for a reason. Usually, if you read everything, and do what you are told, you are bound to be failproof.

Ok, so now you know pretty much all a normal user should know. But there are still questions that are very frequently asked that need answering. Here are some questions and answers about popular problems and misconceptions:

Questions and Misconceptions

1. My Nexus 4 is getting very hot. Hardware problem?
Nope. There are many reasons that contribute to your phone getting hot, like
-the fact that glass is a good heat conductor, and the Nexus is covered in it
-the fact that a quad core produces more heat
-etc.
Don't worry. Everything is working as it should. For example, the Ipad gets 3 times hotter than the Nexus.

2. If I am rooted, will I receive OTA updates?
Yes, and no.
You will be able to download the update by having installed the Stock ROM with stock kernel, though it will not be installed automatically, due to the fact that you have a custom recovery. You will need to install it manually.

3. My notifications are delayed. Why?
Well, it due to the fact that Android is doing too much filtering.
To fix, navigate to /system/etc/wifi, and open WCNSS_qcom_cfg.ini. Now find the line McastBcastFilter=3. Change the value to 1, like this: McastBcastFilter=1, save, and exit. Then reboot. Your notifications should not be delayed anymore.

4. The Nexus 4 audio quality is horrible. Why?
It isn't horrible. It's normal, but the max volume isn't as loud as on other devices. I have been a piano player for 12 years. I have quite a sensitive ear, and I can tell you that the audio quality on the Nexus is comparable with that of an Ipod. The only major difference is that, with the Ipod, you can go deaf with the max volume.

5. Which kernel/ ROM should I use?
Don't ever ask this question. What's good for others isn't necessarily good for you. You'll have to try the many kernels and ROMs yourself.

6. My Nexus 4 rattles when I shake it. Why? Something broken?
Nope. There's nothing broken. That rattling is caused my the camera lenses moving. Don't worry about that either.

This is all for now. I hope you understand what's up with this Rooting process. If you have any questions, don't be shy to ask in this thread

If there is anything to be added to this thread, please post below

Thank you for the time you allocated to reading this! You are now smarter :good:

Good day, and Happy flashing!!!



For credits, useful links and other stuff, see the posts below.​
 
Last edited:

abaaaabbbb63

Senior Member
Nov 19, 2011
3,898
3,423
Somewhere Over The Rainbow
Last edited:

Chromium

Senior Member
Oct 5, 2012
4,481
6,520
Toronto
chromium1.blogspot.ca
Thanks!! No problem. My girlfriend left me, so I have plenty of free time now :p

O god :p Nice guide, will be helpful. One thing though:
4. Now you are ready to go in recovery. Power down your phone. Then, press and hold the Power Button and both the Up and Down Volume button at the same time. You will be brought to the Bootloader Screen. Now, with the Volume Buttons, switch through the options until you find "Recovery". Then press the Power Button again.

The bootloader can be accessed using just volume down and power. I never have to use both volume buttons.
 
Last edited:
  • Like
Reactions: abaaaabbbb63

DarkShade93

New member
Jul 18, 2013
2
0
Hello!

I bought my Nexus last week, and I kept looking on the internet they can do with it. I've heard of the root, and I was curious. I also found it very interesting forum where I found this thread. Thanks for the information. Very useful.

Sorry for bad English. I used Google Translate.
 

gamekid94

Member
May 4, 2013
13
1
Nexus 4 doubts

Hii i just got a 16gb nexus 4 which is my first android phone last month and now i was thinking of rooting it and getting paranoid android on it...but just wanted to get some doubts clarified...
1. I wont be able to install ota updates when 4.3 or 5.0 android versions are released , so how will i get them ?? By Updating paranoid android ROM ??
2. In case i just root my phone and not install any custom ROMs then will i get otas ??
3. After installing a custom rom , can i revert back to the stock google thing ? I mean make my phone as it was when i first booted it.. ??

Thats all i guess..
 
Last edited:

abaaaabbbb63

Senior Member
Nov 19, 2011
3,898
3,423
Somewhere Over The Rainbow
i JUST realized this was here.. DOH!

THANK YOU :)

No problem :)





Hii i just got a 16gb nexus 4 which is my first android phone last month and now i was thinking of rooting it and getting paranoid android on it...but just wanted to get some doubts clarified...
1. I wont be able to install ota updates when 4.3 or 5.0 android versions are released , so how will i get them ?? By Updating paranoid android ROM ??
2. In case i just root my phone and not install any custom ROMs then will i get otas ??
3. After installing a custom rom , can i revert back to the stock google thing ? I mean make my phone as it was when i first booted it.. ??

Thats all i guess..


1. Yeah. Paranoid will most probably be updated to the latest android as soon as the source is released.

2. Yes, you will get OTAs, but you will have to install them manually.

3. Yes you can. You can either do a nandroid backup of your stock rom, and keep it, or you can flash a stock rom.




Nice guide Andu! :thumbup:

Sent from my Nexus 4 using Tapatalk 2

Thanks!
 
  • Like
Reactions: Vlad Paul

danarama

Senior Member
Aug 22, 2010
31,283
18,810
Oxenhope, West Yorkshire, UK
Its worth noting that some roms have specific gapps packages too. Its always good to use these dedicated packages in case they have cool optimisations (eg slim with the dark mode toggles)

Sent from my GT-I9300 using Tapatalk 4 Beta
 

Top Liked Posts

  • There are no posts matching your filters.
  • 176
    [REF] ★★★Understanding the Android world before rooting your LG Nexus 4★★★

    Understanding the Android world before rooting your LG Nexus 4

    Here is a *noob friendly* collection of information every user that wants to root their phone should know. Many people blindly follow guides without even knowing what "Rooting" means. Hopefully, this will help new users (and old ones, why not?) understand what is happening with their phone, and what they will put up with.

    This may seem as a lot to read, but there are no shortcuts. You either read and learn what you're dealing with, or find out the hard way.



    Let's get started, shall we?


    What does rooting mean?

    To 'root' your phone means to gain administrative rights on the file system of your phone (in linux, root is the username of the master admin, kind of being an Administrator on Windows). With root access, you can install and uninstall anything you want on the phone.

    Most phones come with limited access regarding what you can and can't do on it. This isn't necessarily a bad thing, because it can keep users from accidentally breaking something they shouldn't mess with on the phone, especially in regards to the operating system. However, many manufacturers limit your rights to things that aren't really so mission critical, too, and rooting the phone gets around this.

    If you have a few unnecessary applications (bloatware) pre-installed on your phone that you cannot uninstall, rooting will give you this ability. It will also allow you to upgrade to newer versions of Android before your phone's manufacturer and/or cell provider make the updates available to you.



    So now you know what rooting means. And I bet you are now thinking "Should I do it, or not?" Well, hope this helps you decide:


    The advantages of rooting

    -De-bloat your phone. Uninstall any unwanted system apps.
    -More control over how the CPU acts. This can increase performance or battery life, depends on how you configure it.
    -More control over power consumption. This implies undervolting your CPU, giving it less power, so it consumes less.
    -More control over how apps start up. Prevent apps from starting up when they don't need to.
    -Change your Baseband (Radio). Try different radio versions, with the purpose of reducing battery drain or improving your signal strength. This may also allow you to enable LTE, due to the fact that it's disabled on the latest radios.
    -Flash custom ROMs. Bored of the stock ROM and look? Browse through the hundreds of custom ROMs provided by this community, each having different features and looks.
    -Backups. The ability to completely backup your phone, and fully restoring it to the time of the backup. This is done with a Nandroid Backup (we'll talk about this later)
    -Mods and Inovations. Use many mods, fixes, tweaks or features created by the community!
    -Custom Kernels. As a Nexus device, the Nexus 4 has tons of kernels with different features, supporting better performance, or battery life! To see what a kernel is, keep reading.
    -Run apps that need Root Permission. These apps can be very useful, like Titanium Backup, Root Explorer, Terminal Emulator and many others!

    The disadvantages of rooting

    -Rooting will void your warranty (Although reverting root is very easy)
    -The process a bit dangerous. Something could (99.9% probably not, but still) go wrong, and end up bricking your phone. So, yes, the process is 0.1% risky. You can end up deleting everything on your phone. You'll have to handle this process gently and with care.
    -You will be able to do a lot more mistakes. These may cause damage to your phone (But hey, that's why we have these kind of threads, eh?)
    -No more over the air official updates. You'll have to update your phone manually, through your recovery. (Which isn't that hard)



    Now that you fully know what rooting implies, let's continue exploring the Android world.

    What about the internal memory? How does that work?

    Now, as you might already know, each phone has an internal memory. In the Nexus 4's case, it's either 8GB or 16GB. This internal memory needs to hold a lot of things, not only your personal data. This is why you only have available to use 5.8 GB or 12.9 GB.
    An Android's internal memory is partitioned into many chunks that have their separate purposes.
    These are all the Nexus 4's partitions, and their names.
    modem -> /dev/block/mmcblk0p1
    sbl1 -> /dev/block/mmcblk0p2
    sbl2 -> /dev/block/mmcblk0p3
    sbl3 -> /dev/block/mmcblk0p4
    tz -> /dev/block/mmcblk0p5
    boot -> /dev/block/mmcblk0p6
    recovery -> /dev/block/mmcblk0p7
    m9kefs1 -> /dev/block/mmcblk0p8
    m9kefs2 -> /dev/block/mmcblk0p9
    m9kefs3 -> /dev/block/mmcblk0p10
    rpm -> /dev/block/mmcblk0p11
    aboot -> /dev/block/mmcblk0p12
    sbl2b -> /dev/block/mmcblk0p13
    sbl3b -> /dev/block/mmcblk0p14
    abootb -> /dev/block/mmcblk0p15
    rpmb -> /dev/block/mmcblk0p16
    tzb -> /dev/block/mmcblk0p17
    metadata -> /dev/block/mmcblk0p18
    misc -> /dev/block/mmcblk0p19
    persist -> /dev/block/mmcblk0p20
    system -> /dev/block/mmcblk0p21
    cache -> /dev/block/mmcblk0p22
    userdata -> /dev/block/mmcblk0p23
    DDR -> /dev/block/mmcblk0p24
    grow -> /dev/block/mmcblk0p25

    Yes, there are quite a lot. You, as a user, don't need to care about all of them. Here are the ones you will need to know about:

    /system- size: about 0.5GB
    This partition holds the Android OS itself. Kind of like the C:// disk on your every day Windows PC. This partition has many folders and files you cannot normally get to, due to safety reasons. For example, system/app is where all the system apps are installed.

    If something gets deleted from this partition, Android will most probably won't work properly.


    /data- size: either 5.8GB, or 12.9GB
    This is where all your personal data is kept. This includes apps, sms, contacts, e-mails etc. It also stores your system settings, like wallpaper, and all those stuff you set up when you got your phone. The most important folders on this partition are data/app (where your apps are stored), data/data (where you app data is stored, like highscores and stuff), and data/media.
    Data/media might be considered your sd-card. Yes, I know the Nexus 4 doesn't have an sd-card, but this folder works like one. When you connect your phone to your PC, this is the folder that pops up, with all your music, images, videos, and whatever else you keep on your phone.



    Things are getting a bit more complicated, eh? Just bare with me. Next, I will be explaining the different terms you will be encountering throughout your Android experience.


    Things you hear people talk about

    Kernel
    The kernel is an essential part of any Linux based operating system. It's the program that manages input and output requests of the operating system. Imagine you're at a restaurant. You give your order to a waiter. He takes it to the chef, the chef makes your food, then the waiter brings it back to you, and you enjoy it. In this case, you are the Android system, the waiter is the Kernel, and the chef is the hardware. The system gives the Kernel a request, like firing up another processor core when you play a heavy game, and the Kernel fulfills the request.

    Here is an image for better understanding
    382px-Kernel_Layout.svg.png



    Recovery
    This is a secondary, mini operating system that has access to your internal memory. It contains a few commands that would normally help you recover your Android system in case of a failure, like factory resetting. You will see that, for rooting, you will need to install a custom recovery.
    The stock recovery does not have the ability to write custom ROMs (I'll explain these later) on your internal memory. A custom recovery has this option, and many more.
    Here are some images for you to fully understand:

    Stock recovery:
    Unroot+Nexus+4+to+Stock+4.2.Still013.png


    Custom Recovery
    cwm-n4.jpg


    You can see that the Custom Recovery has more options, including "Backup and Restore", Advanced, and Install zip from Sd-card.
    You can get in Recovery by powering off your phone, then hold Power+Volume Down button until a black screen with colored text appears. Then, use the volume buttons to select 'Recovery", and then press the Power Button to select it.


    Bootloader
    The bootloader is the first thing that fires up when you open your phone. As the name says (Boot+Loader), this program loads the kernel, which when boots up the Android system.
    The same bootloader can also boot in recovery, as explained above.
    When you first get the phone, the bootloader is in a locked state. That means that you cannot use fastboot commands like "fastboot flash" or "fastboot boot". With other words, you cannot simply flash a custom recovery. Thankfully, Google gave us the option to unlock the bootloader very easily, and flash a custom recovery of our choice.


    Custom ROMs
    A custom ROM is a ZIP file that contains an altered version of the Android OS. There are many custom ROMs for the Nexus 4, made by wonderful and skilled devs for the community. You can install a Custom ROM with your Custom Recovery. Custom ROMs contain the following folders and files:

    Untitled.png


    META-INF- This folder holds the installation info and data. A custom recovery does not know on it's own how to install a ROM. In this folder, there's a txt file that contains a script, with the purpose of telling the recovery what to do.

    System- This folder contains the stuff that will be installed on the /system partition that we talked earlier about.

    boot.img- Among others, this file contains the kernel that comes with the ROM.


    Ok, so now, after you read all this stuff, you're probably thinking "Ok, I will never get the hang of this". Don't worry. With time, you will know all of these from reflex. And, after you got over that, and manned up again, you probably thought "Ok, let's root this damn thing!". Not quite yet. We aren't done. There are still some crucial things that you need to know. So let's continue.


    How to backup your stuff

    Before you do anything EVER, you'll always have to backup your stuff, even if you don't feel like it, or your dog died (in which case I'm truly sorry), but, no matter what you're about to do, always have a recent backup sitting around.
    There are many ways and things you can and will probably have to backup.

    1. Backup your entire phone, by creating a Nandroid Backup.
    As you saw in the 'Custom Recovery" picture above, you have a "Backup and Restore" option. Here it is again:
    cwm-n4.jpg


    With every occasion, it's best to use it as often as possible. It only takes about 2 minutes, but it could be a life saver.
    A Nandroid will backup:
    /system
    /data (Except /data/media, where your "sd-card" is, because it's too large and not that important)
    /cache (Yes, there is a cache partition, and it will be backed up, although not really necesarry)
    kernel (The kernel will be backed up too)

    ***Optional tip: I always keep a recent nandroid backup on my PC, in case I somehow wipe all my phone's contents, and my backup among with them. The Nandroid backup is saved at this location, which can be accest with a root file explorer, like ES File Explorer : mnt/shell/emulated/clockworkmod/backup. If you want to copy it to your storage, just copy the latest backup, and then move it to your PC.

    2. Your apps and data only
    This can be very useful when changing ROMs. You just got bored of your ROM, and want to move to another one. The only way of taking your apps and data with you is by backing them up with an application like Titanium Backup. The backups will be saved in data/media, and will be restored using the same app with which you backup up on the new ROM.


    3. Your SMS, Contacts, MMS etc.
    These things can be backed up by special apps on the Play Store. Ok, contacts will be restored by Google Sync ( although not always done properly, that's why I still back them up), but SMS will not be restored. There are many free apps that back them up for you, nice an easily, for them to be restored in case of a ROM change or data loss.


    4. Your storage (data/media, sd-card)
    You just connect your phone to your PC, select all folders, and copy all over on your PC. This will be useful when you unlock the bootloader. A bootloader unlock will wipe all the stuff on your phone (This can be avoided, read guides). So keeping a copy of your sd-card contents on your PC isn't such a bad idea.


    Now you know how to keep it safe by creating backups. I will say it again, you are never too safe! Backup when you do a modification, even if it's tiny. Now, after you've finished reading the above, you will probably attempt to root. You will use one of the guides out there ( I will link one at the end of this thread ) to install a custom recovery, and gain root access. But what to do with it? Well, you will most likely end up flashing a custom ROM.


    Flashing a custom ROM

    You will get bored of the stock ROM, and will decide to flash a custom ROM. But you haven't done it before, and you don't really understand the process.Before you do anything, you must:
    -Make sure that the files are for your phone ! If you flash files that were made for another phone, you might end up with a brick!
    -Never panic! There is always a way out! That's what backups are for!
    -Read all the instructions! Every ROM thread has instructions. Read them!


    {By the way, flashing = installing}

    Now, let me take you through the whole flashing process. ( Use the steps in the ROM threads if instructed differently than here )

    1. You will search far and wide in these forums for a custom ROM that fits your needs. Every ROM comes as a ZIP file. So when you decide on a ROM, download the zip. For copyright reasons, Google Apps (Play Store, Google Now etc) don't come included with the ROM. So you will have to download them too. They are usually linked on the ROM main thread.
    Some ROMs might have addons too, so check them out, and download the ones you want.

    2. You now downloaded the ROM, Google Apps, and some addons. The next step will be to put them on your sd-card. Connect your phone to your PC, and make an easy access folder, like "Root Stuffs" where you'll put all these zips.

    3. Now, let the backup process begin. You first backup your apps, app data , SMS, Contacts etc., like I explained above. I recommend Titanium Backup for apps and SMS, MC Backup for contacts.

    4. Now you are ready to go in recovery. Power down your phone. Then, press and hold the Power Button and the Volume Down button at the same time. You will be brought to the Bootloader Screen. Now, with the Volume Buttons, switch through the options until you find "Recovery". Then press the Power Button again.

    5. Now you will be booted in your Custom Recovery. Depending on your recovery, you will have the options on your screen.

    CWM Recovery:

    6. You will go to the Backup and Restore menu, and select "Backup". If you made a backup before, you can select "Delete" first, and delete it, for space consumption purposes.

    7. After the backup finished, you will return to the main screen. There, select 'Wipe data/ Factory Reset". This will wipe everything in /data except /media, so your sd-card will remain untouched. Don't worry, you have a Nandroid Backup!

    8. After the wipe finished, you will go to "Install zip from sd-card". You'll have to navigate to the folder where you put the ROM, and select it. You'll see it will nicely install.

    9. After the ROM finished installing, you will have to flash the Google Apps zip, and the mods. Install them the same way you installed the ROM itself.

    10. After you have flashed everything, you can select "Reboot system now" . First boot will take longer to complete. Again, don't panic. You have a Nandoid bakcup . You will end up with the ROM booted, and you'll continue setting it up.

    TWRP Recovery:

    6. Go to the "Backup" menu, select "Boot", "System", and "Data", then swipe the thing on the bottom on the screen to start backing up.

    7. Once you're done, use the home button to get to the main screen. Select "Wipe", and swipe the thing again to Factory Data Reset. This will wipe data, cache and dalvik cache. This will not wipe your internal storage (Music, photos, etc).

    8. After the wipe finished, use the home button again to get to the main screen. From there, select the 'Install" option. You'll have to navigate to the folder where you put the ROM, and select it. Then, by using the "Add more zips" option, add the Gapps package, and and then any addons or mods, in this order. Then swipe the bottom thing to flash.

    9. After you have flashed everything, you can select "Reboot" . First boot will take longer to complete. Again, don't panic. You have a Nandoid bakcup . You will end up with the ROM booted, and you'll continue setting it up.

    ***In case something went bad, like your phone doesn't boot for more than 10 minutes, or the animation endlessly repeats itself (Boot Loop), do the following:

    11*. Hold down the Power +Volume Buttons until the phone shuts down. Then release them for a second, and immediately press them again. You will be brought to the bootloader screen. Enter recovery.

    12*. In recovery, go to the "Backup and Restore" menu, and select "Restore". Then pick the backup you did earlier, and wait for it to complete. Then, select "Reboot system now", and you should be booted back in your original ROM.



    Now, let's say that after you flashed a ROM, it either did not boot, or you had some bugs with it. You will go to the thread ROM to report your problem. Here's how to not post:
    "This ROM doesn't work"

    You will have to be a lot more specific than that. In reporting a problem, you will have to do the following:
    -Say what you did (Flashing process)
    -What you flashed afterwards
    -What you did to reproduce the bug
    -What recovery you use
    -ROM Version
    -even provide a logcat <This is quite advanced> (http://forum.xda-developers.com/showthread.php?t=1726238)


    You have to give as many details as possible, so the developer can sort things out.


    ADB and Fastboot

    ADB (Android Debug Bridge)
    The Android Debugging Bridge is kind of a toolkit, that has many commands to control your Android from your PC. This is an essential part of your Android experience. With ADB, you can do many stuff that you couldn't normally do, like backup your apps, or push and pull packages from your phone.
    ADB is also used by many of the useful tools out there, like toolkits, and all sort of programs that enhance your Android experience.
    With ADB, you can also Logcat. Logcatting is creating a log of everything that happens on your Android phone while it's on. This is used to find the sources of bugs.

    Example of ADB Commands:
    Code:
    adb pull /system/app/RANDOM APP = creates a copy of a system app on your PC
    adb push app /system/app = Copies an app from your PC to your system partition
    adb reboot bootloader/recovery = Reboots the phone in bootloader or recovery
    adb logcat = Starts a logcat


    Fastboot
    Fastboot is also a toolkit of commands, but a bit different from ADB. While with ADB, you can do simple actions, with fastboot, you can do major ones, like flashing a whole partition, or formatting one. Fastboot is usually the preferred method to flash a recovery. Also, Fastboot usually works with .img files.

    Example of Fastboot commands:
    Code:
    fastboot erase boot = Erases the kernel
    fastboot erase recovery = Erases the recovery
    fastboot flash system system.img = Flashes the System partition with an image
    fastboot flash boot boot.img = Flashes kernel
    fastboot flash userdata data.img = Flashes Data partition
    fastboot flash recovery recovery.img = Flashes a new recovery
    fastboot reboot = Reboots the phone

    To use ADB and Fastboot, you must first have ADB drivers and Fastboot drivers installed. Here is a very good guide to set up these two useful things:
    http://www.redmondpie.com/how-to-set-up-android-adb-and-fastboot-on-windows-tutorial/

    Tips and Tricks

    1. Try to not use toolkits. (I'm not disregarding any toolkit dev. They did a wonderful job)
    Due to the fact that people are lazy in nature :D, toolkits have been made so that users don't struggle with rooting their phone. But there are many reasons for you to not use one:
    -->you won't learn anything from using a toolkit, and, if something goes wrong, a toolkit can rarely fix your problem. It's better if you rely on your own forces.
    -->you put the fate of your phone in someone else's hands. If a bit of code is wrong, then your phone could get bricked.
    -->you miss out all the fun. Why buy a Nexus device if you don't want to explore the depths of the Android OS?

    2. Never panic
    Whenever you don't know what to do, and you're stuck, don't panic. There are many people here that can help you. Don't try doing anything blindly. Search the forums, or start a thread in the Q&As section, and we will help you.

    3. Read everything carefully!! (If you read this, post a cat picture in this thread)
    I might have said it a couple of times throuout this post, but always read everything. Someone wrote something for a reason. Usually, if you read everything, and do what you are told, you are bound to be failproof.

    Ok, so now you know pretty much all a normal user should know. But there are still questions that are very frequently asked that need answering. Here are some questions and answers about popular problems and misconceptions:

    Questions and Misconceptions

    1. My Nexus 4 is getting very hot. Hardware problem?
    Nope. There are many reasons that contribute to your phone getting hot, like
    -the fact that glass is a good heat conductor, and the Nexus is covered in it
    -the fact that a quad core produces more heat
    -etc.
    Don't worry. Everything is working as it should. For example, the Ipad gets 3 times hotter than the Nexus.

    2. If I am rooted, will I receive OTA updates?
    Yes, and no.
    You will be able to download the update by having installed the Stock ROM with stock kernel, though it will not be installed automatically, due to the fact that you have a custom recovery. You will need to install it manually.

    3. My notifications are delayed. Why?
    Well, it due to the fact that Android is doing too much filtering.
    To fix, navigate to /system/etc/wifi, and open WCNSS_qcom_cfg.ini. Now find the line McastBcastFilter=3. Change the value to 1, like this: McastBcastFilter=1, save, and exit. Then reboot. Your notifications should not be delayed anymore.

    4. The Nexus 4 audio quality is horrible. Why?
    It isn't horrible. It's normal, but the max volume isn't as loud as on other devices. I have been a piano player for 12 years. I have quite a sensitive ear, and I can tell you that the audio quality on the Nexus is comparable with that of an Ipod. The only major difference is that, with the Ipod, you can go deaf with the max volume.

    5. Which kernel/ ROM should I use?
    Don't ever ask this question. What's good for others isn't necessarily good for you. You'll have to try the many kernels and ROMs yourself.

    6. My Nexus 4 rattles when I shake it. Why? Something broken?
    Nope. There's nothing broken. That rattling is caused my the camera lenses moving. Don't worry about that either.

    This is all for now. I hope you understand what's up with this Rooting process. If you have any questions, don't be shy to ask in this thread

    If there is anything to be added to this thread, please post below

    Thank you for the time you allocated to reading this! You are now smarter :good:

    Good day, and Happy flashing!!!



    For credits, useful links and other stuff, see the posts below.​
    18
    Credits and Thanks!!


    @rootSU
    For providing me a template and much of the info. His original thread in the S3 forums: (http://forum.xda-developers.com/showthread.php?t=2362743)

    @mskip
    For providing information on memory partitions

    @paxChristos
    For the logcat part

    @efrant
    For pointing out some mistakes

    My annoying cat
    For continually stepping on my keyboard.​
    6
    Thanks go this awesome guide!

    Thanks!! No problem. My girlfriend left me, so I have plenty of free time now :p
    5
    Wow. No replies in a long time, but 11k views.

    Guess that means I explained everything clearly, doesn't it? :D

    I guess so. Its either that, or people come here then realize that they're too lazy to put any time into reading this and gaining knowledge. Then they end up just using a toolkit > soft-bricking their phone > posting a frantic response in the help thread > having someone explain to them why they shouldnt have used a toolkit and suggesting that they read this > coming back to this thread to try to educate themselves > rinse and repeat.

    The Circle of n00b Life™

    On a sidenote i just found a remarkable discovery: the faint grid pattern on the brown part of the xda site header looks the same as the digitizer pattern on the nexus 4 while the screen is off :eek:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone