6 ms·
Creating a Bare Bones Bootloader
- good_guy 12y agoSimilar guide to write a small kernel https://news.ycombinator.com/item?id=7588205 https://news.ycombinator.com/item?id=7588205
- charlesap 12y agoYou can go all the way to protected mode, enable paging, and then page in the rest of your kernel in just 512 bytes, and without touching the BIOS: https://github.com/charlesap/bootpager/blob/master/oiuboot.asm https://github.com/charlesap/bootpager/blob/master/oiuboot.a...
- Rusky 12y agoThat's pretty impressive. Unfortunately the BIOS is still required for getting a map of physical memory...
- mmastrac 12y agoThis brings back memories of reading through Norton's programmer's guide to the PC, figuring out how all the various interrupts worked. It was always faster to write to b800:0000 than use int 10h (assuming a color display of course!).
- dugmartin 12y agoYep, instead of looping over an interrupt just use "rep movsb" between the data segment and display memory.
- taiki 12y agoWhat about for EFI? Does this guide hold up the same?
- emaste 12y agoNo, none of the description in this guide applies to UEFI. The UEFI firmware loads its bootloader as a PE binary from a FAT filesystem, not a binary blob from sector 0, and the CPU is already in 32- or 64-bit mode. The interface for calling firmware routines is also completely different. This is a decent equivalent guide for UEFI: http://www.rodsbooks.com/efi-programming/hello.html http://www.rodsbooks.com/efi-programming/hello.html
- CocaKoala 12y agoI'm really digging the systems posts that have been cropping up on HN recently; this and the toy OS post that was floating around are both really interesting.
- zhemao 12y agoFunny thing is that they both do basically the same thing, except one is done all in assembly and the other in C. I would have liked this post to actually discuss the things that a bootloader is meant to do, like switching to 32-bit protected mode and loading the next block of code from the disk.
- heywire 12y agoIf this type of thing interests you, check out http://wiki.osdev.org http://wiki.osdev.org. I cannot recommend this site enough for someone who is interested in writing their own toy OS.
- CocaKoala 12y agoThis looks like exactly what I've been hoping to find after taking an OS course last semester! Thank you very much for sharing this link!