Deciphering phone and embedded security - Part 1: Fundamentals of the Android architecture and terminologies

Before we go into deep details on the Flashing and custom ROMs, let's look at the Android architecture (stack) along with common terminology.

Introduction to Android Platform
An important factor that sets Android apart from most other mobile operating systems is that it's based on an open source platform, allowing anyone to modify most of Android's source code. Ideally, this would mean that if a developer felt Android needed a specific feature or capability, he or she could build it and incorporate it into the OS.

Figure 1: Android architecture

The base of the stack (and the innermost layer of the operating system) is the kernel that is based on Linux. Kernel is the main component of OS, that creates a bridge between the software (application) and hardware, providing the lowest level of abstraction that application software must control to perform its function. Kernel would typically include memory management programs, power management and several device drivers to control hardware devices likes camera, keypad, audio, etc.

The layer above kernel includes Android libraries, what gives the kernel instruction to perform specific tasks for example, the media framework library supports playback and recording of various audio, video and picture formats. Located on the same level as the libraries layer, the Android runtime layer includes a set of core Java libraries that allow Android applications to build their apps using Java programming language along with Dalvik virtual machine.

For laymen, Virtual Machine is a software application that can execute programs just like physical machines behaving like an independent device with its own operating system. The Android OS uses virtual machines to run each application as its own process. This makes applications independent of each other so if an application crashes it would still leave other applications running.

The layer above the libraries is the application Framework. This includes the programs that manage the phone's basic functions like resource allocation, location management, notification management etc. Being an open development platform application developers have full access to Android's application framework, allowing them to build extremely rich applications.

The top of the stack includes the applications themselves that interact with the lower layers to perform operations like making a phone call.

This entire stack is bundled in "ROM" or "Read Only Memory."

In order to understand the exact process of what really happens during Rooting or Jailbreaking and the underlying hardware and software involved, let's understand some of the basic terminology.

Concept of Flashing and Rooting
Flashing the phone is the procedure of putting new firmware (software) in the phone. This could be un-official or official release by the phone manufacturer. On the hardware side, it means connecting the data port on the phone and reprogramming the on-board chip, which contains the software that controls the phone.

There could be many reasons to flash a phone, such as firmware upgrade, solve problems and bugs or even converting the phone to some other model that just differs in firmware.

Rooting on the other hand is the process of modifying the operating system that is shipped with the device to grant complete control over it. Rooting is similar to enabling super user access (root) on Android device to allow complete control over the system, thereby having write access to all the system files. In Linux/Android, the root user is the user with all permissions to change and alter any files on the system/phone, thus the name.

So what's the need for Rooting or why access most basic folders and system files in the phone?

This is to use the apps that require root access for example:

Overclocking apps - These apps allow you to overclock your phone's processor, taking a 600mhz processor to 1ghz for example. Some phones models have the same processor but it is often underclocked to price it lower, even though there is no change in hardware.

Wifi Tethering - Turns your phone into a WiFi hotspot without you having to pay extra to your carrier for that feature. This is especially true for older models of Android like 1.1. However this is now a standard feature on some of the recent versions of Android.

Ability to increase performance through optimizations (usually through flashing ROMs)

Ability to upgrade your operating system version without having to wait for an OTA (like going from Android 2.3 to Android 3.0)

There are many more examples; however the above give a flavor and motivation behind Rooting.

Good start, one of the aspects of this I would like to see addressed is the fundamental difference between Android and iOS when it comes to implementing a Type 1 Hypervisor, which is really the only rigorous way to enforce any security.

This is a good article. I find it interesting. Is short and only touches the basics but it really feels as an introduction towards what may become a great follow-through series of articles.
It was interesting to learn the different terminology used for Android and iPhone. Like Jailbrake for iPhone and Rooting for iPhone. etc.