I am trying to dive deeper into the boot process and understand how everything works.
I have understanding but I am not sure I am right. I have already found a lot of great examples like that What is the boot sequence?
As I can guess this the board specific boot process.
I know this question could look a little bit offtopic, but I haven't found any other place with a such great community.
First of all consider we have an electronic device, let it be a Android powered smartphone.
We have a CPU (SoC including CPU core and GPU core).A CPU has it own ROM memory. This ROM has hardcoded address of memory where a CPU has to jump and start executing the code located there. Or this ROM could have some helper code for initializing hardware. So when a power on button is pressed, CPU/GPU starts executing code at the address hardoced by a vendor.
Most of times the address described above is pointing to the first stage bootloader. This bootloader is responsible for setting up hardware, performing tests .. In case of PC this is a BIOS (a ROM chip soldered into a motherboard). But in case of embedded devices it is responsible for finding/detecting second stage bootloader.
A Second stage bootloader is located physically outside a CPU. It can be stored on a separate ROM chip, on a flash memory chip which is soldered to a mother board (BGA). This type of bootloader is much more complicated than previous one. It can do a lot of stuff like the network stack initialization, detecting filesystems and so on. For example this could be Uboot or Coreboot bootloaders. They are responsible for loading a kernel, this bootloaders could be configured to use specific arguments for booting a kernel.
3.1 In case of Android. Every device has FLASH memory, and a vendor specific bootloader, it is located at the beginning of flash memory. As far as all firmware updates are done via bootloader (recovery), vendors lock this part of the memory with a code to prevent user access. So to be able to access flash memory space of device we need to be in the bootmode (CPU executes code located in the bootloader area) in this mode it is possible to do anything with memory (flash memory) even erase a bootloader. But all in all I can resolder a flash memory chip with a custom bootloader. Or I can even do this using JTAG interface.
- After doing all required stuff for booting a kernel. It can be a third stage bootloader. In this case Uboot can satisfy both the second stage and the third stage as well.
Does my story make any sense ? Do I understand a boot process correctly ? I would be grateful for any help or explanation.