Friday, November 11, 2016
What follows is more a simple explanation on how to build an Android ROM. I’m going to discuss several parts that can’t be absent if you want a fully functional Android phone, from the software point of view that is.
Here’s a brief summary :
Libraries (and modules)
Apps, framework, core, android-runtime, etc…
A kernel is a critical component of every Operating System. It can be seen as a sort of bridge between the applications and the actual hardware of a device. Usually the data processing part is done at hardware level, furthermore the kernel is the most low-level abstraction layer for the resources.
There exist several types of kernels, but I am only discussing the one that is important for the Android ROM. The kernel for the Android ROM is a hybrid kernel, it is based on the Linux kernel. Devices can differ in RAM memory, ROM memory, hardware parts and so on. So it’s really important you have a kernel for your type of device, an HTC Wildfire kernel won’t work on a Nexus One for example.
It is possible to overclock a kernel. You may wonder, what the hell is overclocking? Every CPU is designed to work at a certain clock speed. For the HTC Wildfire the Qualcomm ARMv6 processor operates at 528 mHz — this is a limit that is coded in to the kernel because they can’t guarantee good cooling for the CPU if you go over this limit. My Wildfire runs at 652.8 mHz and it can go to 768 MHz until it freezes. When you overclock the kernel, the CPU will be instructed to do more calculations per second; so, it will increase performance.
When you overclock the CPU of your desktop machine, it will need extra cooling, but fortunately that’s not necessary for a smartphone. However, keep in mind that this will degenerate your CPU much faster than if it was at stock. To overclock an Android phone you must root it and install SetCPU or another overclocking app from the Play Store. Then you will have to flash a kernel that supports overclocking. I prefer the OC Kernel of HCDR.Jacob, at XDA-forums (see links right). If you have done these 3 things you’re ready to OC!
Imagine you want to program an application for your phone that uses the camera. It can take a picture and turn the flash LED on. These are things not only your own application will use, but there can be tons of applications that have a button that can take a photo. So, imagine those apps always having to write the machine code to get the camera to turn on; it would be a lot of code duplication and would make an application slow. Instead, for functions like the camera or loudspeakers, they developed libraries. These are chunk of codes that can be executed by calling them trough a call-method (in java : import somelibrarie.someclass;). These are already pre-written and ready to use. It saves a lot of coding work and keeps the source code small. Libraries in the Windows OS for example are called .dll files (Dynamic Linked Libraries), whereas on your Android ROM or Linux OS these are the .so files (Shared Object). When coding in Java you import .jar libraries before the class signature. On your Android phone you have particular libraries that can’t be absent, or else your ROM won’t even boot.
A bootloader in general is the first bytes of code that a machine executes that will tell the bootsequence and will load the operating system into the RAM. On an Android phone this is the so called HBoot. From here you can go to the recovery, system or data partitionn. By pressing the power button on your phone, HBoot will load the OS into RAM. By pressing the power and volume down buttons, you’ll bring up the HBoot menu.
The bootloader is used as an exploit for rooting an Android phone. Once rooted you can flash custom ROMs, like ImPrOS, or just edit system files (for a how-to, check tutorials under Android.)
When you use a one-click-root application like Unrevoked3, it will install a modded recovery. With this modded recovery it is possible to flash a new kernel, radio image (see below), custom ROM, install applications (not the best way though), Nandroid backup, etc. The modded recovery that is flashed by Unrevoked3 is called ClockworkMod.
Recovery is a method for you to not only save yourself when you screw up (which you will! ), but to update the ROM or kernel that’s on your phone, partition your SD card to use with a2sd, and many other OS-related things. There’s a lot of different recoveries for different phones, so you’ll have to do some research of your own into what the most respected one is for your phone. The recovery is essential, because you want to always have a fallback in case something bad happens to your phone’s software.
The lowest part of software layer is the radio: this is the very first thing that runs, just before the bootloader. This handles the GPS antenna, GSM antenna and fires up the CPU; everything that HBoot needs to load the OS. This can also be upgraded by flashing a new radio image through your recovery. However, this is not recommended: flashing a new ROM can’t brick your phone (make it unusable), but if anything goes wrong when you flash a ROM with a new radio image, this can brick your phone. So unless you experience bad reception or battery drainage, don’t touch the radio!