|
2 | 2 |
|
3 | 3 | #### How the boot works?
|
4 | 4 |
|
5 |
| -When an x86-based computer is turned on, it begins a complex path to get to the stage where control is transferred to our kernel's "main" routine ("kmain()"). For this course, we are not going to consider new UEFI method but only BIOS boot method. |
| 5 | +When an x86-based computer is turned on, it begins a complex path to get to the stage where control is transferred to our kernel's "main" routine ("kmain()"). For this course, we are going to consider only a BIOS boot method and not the new UEFI one. |
6 | 6 |
|
7 | 7 | The BIOS boot sequence is: RAM detection -> Hardware detection/Initialization -> Boot sequence.
|
8 | 8 |
|
9 |
| -The important step for us is the "Boot sequence", where the BIOS is done with its initialization and tries to transfer control to the next stage of the bootloader process. |
| 9 | +The most important step for us is the "Boot sequence", where the BIOS is done with its initialization and tries to transfer control to the next stage of the bootloader process. |
10 | 10 |
|
11 |
| -During the "Boot sequence", the BIOS will first choose the "boot device" (floppy disk, hard-disk, CD, usb flash memory device or network). Our Operating system will first boot from the hard-disk (but it will be possible to boot it from a CD or a usb flash memory device). |
| 11 | +During the "Boot sequence", the BIOS will first choose the "boot device" (floppy disk, hard-disk, CD, usb flash memory device or network). Our Operating System will first boot from the hard-disk (but it will be possible to boot it from a CD or a usb flash memory device). |
12 | 12 |
|
13 | 13 | The BIOS will read 512 bytes from the first valid bootsector (where the last two bytes are 0x55 0xAA), or lock up with an error message if it cannot find one. And it'll transfer these 512 bytes into physical memory starting at address 0x7c00 then starts running the code that now begins at 0x7c00.
|
14 | 14 |
|
@@ -68,7 +68,7 @@ struct multiboot_info {
|
68 | 68 | };
|
69 | 69 | ```
|
70 | 70 |
|
71 |
| -You can use the command ```mbchk kernel.elf``` to validate your kernel.elf file against the multiboot standard. You also use the command ```nm -n kernel.elf``` to validate the offset of the different objects in the ELF binary. |
| 71 | +You can use the command ```mbchk kernel.elf``` to validate your kernel.elf file against the multiboot standard. You can also use the command ```nm -n kernel.elf``` to validate the offset of the different objects in the ELF binary. |
72 | 72 |
|
73 | 73 | #### Create a disk image for our kernel and grub
|
74 | 74 |
|
@@ -128,7 +128,7 @@ fdisk ./c.img
|
128 | 128 | > w
|
129 | 129 | ```
|
130 | 130 |
|
131 |
| -We need now to attach the created partition to loop-device (which allow a file to be access like a block device) using losetup. The offset of the partition is passed as an argument and calculated using: **offset= start_sector * bytes_by_sector**. |
| 131 | +We need now to attach the created partition to the loop-device (which allows a file to be access like a block device) using losetup. The offset of the partition is passed as an argument and calculated using: **offset= start_sector * bytes_by_sector**. |
132 | 132 |
|
133 | 133 | Using ```fdisk -l -u c.img```, you get: 63 * 512 = 32356.
|
134 | 134 |
|
@@ -170,5 +170,5 @@ losetup -d /dev/loop1
|
170 | 170 |
|
171 | 171 | #### See Also
|
172 | 172 |
|
173 |
| -* [GNU GRUB on wikipedia](http://en.wikipedia.org/wiki/GNU_GRUB) |
| 173 | +* [GNU GRUB on Wikipedia](http://en.wikipedia.org/wiki/GNU_GRUB) |
174 | 174 | * [Multiboot specification](https://www.gnu.org/software/grub/manual/multiboot/multiboot.html)
|
0 commit comments