> Fundamentally, I don't know how does a computer boot -and the basic
> operations that have to be executed by the computer in this phase-
> (Is it a miracle?).
is a very beautiful city, so I'll make a small exception.
Booting is a very complicated, multi-stage process. It is very
dependant on CPU architecture and system hardware. In general:
1) When powered on, and after receiving a power-good signal,
modern CPUs will start a built-in self test (BIST) and then
within a very short, prescribed time, will start executing
instructions from a specific memory address FFFF:0000 for x86.
2) Normally, ROM BIOS chips are mapped into this address, and
the CPU starts executing BIOS routines. These program the
various hardware chips on the mobo (particularly the north
and south bridges) and any adapter cards will also be given a
chance to execute their own setup routines from their own ROMs.
3) After this, the BIOS will go looking to boot an OS from
disks (in whichever order it's programmed). It will load the
first 512 byte sector into 0:7C00 and start executing it.
4) What this Master-Boot Record does is entirely up to it.
MS-DOS/Win, *BSD, Linux (LILO) and OS/2 have their own MBRs.
Often, because it is so small, it cannot do much, and will
only load a second-stage boot loader.
5) This boot loader will load the kernel image, perhaps
decompressing it, and transfer control to it
6) The kernel will then take control and start it's own
setup of VM, page tables, IDTs, kernel data structures,
and also do further hardware initialization.
8) *IX kernels will then call `init` which will do yet
9) When all is finished, you may be presented with a login
prompt. Or not :)