Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Theory behind bootloader [closed]

I have downloaded few bootloaders from osdev and successfully loaded a kernel. But now I want to learn theory behind bootloader. I want to know why the system boots up and everything behind the bootloader codes. Can anybody give me a link or link to a book? Thanks in advance. System is x86.

like image 283
narayanpatra Avatar asked Nov 05 '22 07:11

narayanpatra


1 Answers

https://pdos.csail.mit.edu/6.828/2014/xv6/book-rev8.pdf

On Appendix B, it gives a short overview in the first paragraph:

When an x86 PC boots, it starts executing a program called the BIOS, which is stored in non-volatile memory on the motherboard. The BIOS’s job is to prepare the hardware and then transfer control to the operating system. Specifically, it transfers control to code loaded from the boot sector, the first 512-byte sector of the boot disk.The boot sector contains the boot loader: instructions that load the kernel int o memory. The BIOS loads the boot sector at memory address 0x7c00 and then jumps (sets the processor's %ip) to that address. When the boot loader begins executing, the processor is simulating an Intel 8088, and the loader's job is to put the processor in a more modern operating mode, to load the xv6 kernel from disk into memory, and then to transfer control to the kernel. The xv6 boot loader comprises two source files, one written in a combination of 16-bit and 32-bit x86 assembly (bootasm.S;(8900)) and one written in C (bootmain.c;(9000)).

like image 125
Wallace Zhen Avatar answered Nov 10 '22 04:11

Wallace Zhen