An introduction to building your own Android Rom.
- Libraries (and modules)
- Recovery & Fastboot
- Apps, framework, core, android-runtime, etc…
A kernel acts as a bridge between the applications and the actual hardware of a device. Usually the data processing part is done at hardware level. The kernel is the most low-level abstraction layer for the resources.
There are several types of kernels, but for building an Android ROM we’ll only focus on the Android hybrid kernel. Android’s kernel is based on the Linux kernel. Because devices can differ in RAM memory, ROM memory, hardware parts the kernel must be setup for your hardware configuration. It’s important you setup a kernel for your hardware or if you’re just looking for all the pieces to make your own rom, then remember to use a kernel that’s been designed to work with your hardware.
What are some reasons you might consider a different a kernel?
Probably the biggest reason people change kernels is for some additional features not present in the stock kernel. Overclocking is probably the main reason people switch. I’m guessing here, but I think this is probably the reason people get started with all this. It’s probably a good area to learn about the kernel and how it works because when you overclock the kernel, the CPU will be instructed to do more calculations per second; so, it will increase performance. It’s a good way to see how the kernel interacts with hardware.
Just like in other areas of development, like web development, you’re going to want to have Libraries. Libraries make things easier for everyone, by giving you access to something that has already been written and are ready to use. 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 are used 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) and OSx ~/Library/. When coding in Java you import .jar libraries before the class signature. On your Android you have particular libraries that can’t be absent, or else your ROM can’t boot.
A bootloader in general is the first bytes of code that a machine executes that will tell the boot sequence and will load the operating system into the RAM. It’s the ARM version of the UEFI/EFI/Bios. There are really great articles about the difference between a UEFI/EFI/Bios and bootloader. I believe it’s even the reason behind Linus Torvalds “Fuck you NVIDIA ” comments. (I think NVIDIA was making undiscoverable busses and just making life hard for Linux users in general. Read more here about this. ).
To access the bootloader on most Android phones it’s a combination of the power button and a volume button (usually down).
The bootloader can be used as an exploit for rooting an Android phone, and loading a Recovery into as well. Having a modded recovery makes it easy to flash a new kernel, radio image, ROM, partitions, and some other features like Dual booting if you get the right Recovery. There are some really great recoveries out there. I personally use TWRP with MultiRom which gives my Nexus 6 a nice recovery image that works very well and MultiRom which enables dual booting of multiple OS’s. Every boot brings you to MultiRom where I have both the Nexus stock ROM and Kali Linux NetHunter project.
Fastboot mode can start on your device even before Android loads (and can even run when Android isn’t installed at all), fastboot mode is useful for updating the firmware quickly, without having to use a recovery mode. In fact, it’s frequently the preferred way to initially install the recovery image on many devices. Fastboot can also be used for developer operations like unlocking the bootloader of Google’s Nexus devices.
The down side to using fastboot is that you’ll have to have a host computer. However, sometimes if things go very wrong fastboot can get you up and running again.
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 the bootloader needs to load the OS. This can also be upgraded by flashing a new radio image through your recovery. Flashing a Radio image is something you’ll want to be careful with because if it’s not the correct image or setup right then your device might not start anymore (bricked). It can be flashed using fastboot or your Recovery.
Something that keeps frustration to a minimum is getting a device that is easily hackable. Trust me. This means you’ll get better support in forums like ours and XDA and you won’t have to continually work around some OEM restriction.
A few community favorites can be picked up off contract for cheap on places like amazon and bangood. You can find others but here are our picks.
My personal pick would be the Nexus 5. It’s very cheap now at $175, has a great Ubuntu Touch port, countless roms, and you can even install sailOS, FirefoxOS, and Kali. They can even be installed all at once with Multi Rom! It’s the perfect Android phone to get started in my opinion. Did I mention you can pick it up for $175?
Our Other Picks:
The One Plus One. Hackable out of the box. Similar to the Nexus 5, just more expensive.
Nexus 6: Multi Rom support. Great roms, amazing screen. Our favorite phone to throw Viper4Android on; it’s a great music phone.