3

Where can I find information regarding low level kernel hacking on Android? For example, I'd like to know how the device boots and follow the execution path from that point. Where exactly is the code that runs after I press the power button?

3

This link contains the parts where you can intervene / add your own functionality

The rough flow is Power On > Bootloader > Kernel > Init Process > System Server > Boot Complete

At the stage, the following is run:

A. The first boot loader stage will detect and set up external RAM.

B. Once external RAM is available and the system is ready the to run something more significant the first stage will load the main boot loader and place it in external RAM.

C. The second stage of the boot loader is the first major program that will run. This may contain code to set up file systems, additional memory, network support and other things. On a mobile phone it may also be responsible for loading code for the modem CPU and setting up low level memory protections and security options.

D. Once the boot loader is done with any special tasks it will look for a Linux kernel to boot. It will load this from the boot media (or some other source depending on system configuration) and place it in the RAM. It will also place some boot parameters in memory for the kernel to read when it starts up.

E. Once the boot loader is done it will perform a jump to the Linux kernel, usually some decompression routine, and the kernel assumes system responsibility.

Here's another link (more on the Linux side) on the topic with references: eLinux website answer

This comment stood out to me:

In general it is quite tricky to create a boot loader for an existing phone since they often come with tailor made boot loaders from the manufacturer. To add to the difficulty they also have security features that aim to prevent you from downloading your own bootloader. However, if you have an open platform you need an initial bootloader stage and a main bootloader able to start and/or flash software to the device. For the main bootloader you probably want to check out u-boot, http://www.denx.de/wiki/U-Boot. The initial bootloader stage needed to start u-boot need to be aware of the boot-protocol in the hardware requiring some documentation or reverse engineering in order to create or download a suitable one. To sum things up reprogramming of existing phones is often more work than its worth unless you are really interested in which case there are a lot of forums dedicated to that sort of thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.