diff --git a/00-environment/README.md b/00-environment/README.md new file mode 100644 index 0000000..08cf531 --- /dev/null +++ b/00-environment/README.md @@ -0,0 +1,6 @@ +I'm working on a Mac, though Linux is better because it will have all the standard tools already +available for you. + +On a mac, [install Homebrew](http://brew.sh) and then `brew install qemu nasm` + +Don't use the Xcode developer tools `nasm` if you have them installed, they won't work for the most cases. diff --git a/01-boot-sector/.README.md.swp b/01-boot-sector/.README.md.swp new file mode 100644 index 0000000..6d766c2 Binary files /dev/null and b/01-boot-sector/.README.md.swp differ diff --git a/01-boot-sector/README.md b/01-boot-sector/README.md new file mode 100644 index 0000000..3e44a7b --- /dev/null +++ b/01-boot-sector/README.md @@ -0,0 +1,17 @@ +This is very exciting, we're going to create our own boot sector! + +When the computer boots, the BIOS doesn't know how to load the OS, so it +delegates that task to the boot sector. Thus, the boot sector must be +placed in a known, standard location. That location is the first sector +of the disk (cylinder 0, head 0, sector 0) and it takes 512 bytes. + +To make sure that the "disk is bootable", the BIOS checks that bytes +511 and 512 of the alleged boot sector are bytes `0xAA55`. + +This is the simplest boot sector ever: + +```asm +e9 fd ff 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa +``` diff --git a/README.md b/README.md index fdaa3c1..805eb44 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,47 @@ os-tutorial =========== How to create an OS from scratch + +I have always wanted to learn how to make an OS from scratch. In college they taught us +how to implement advanced features (pagination, semaphores, memory management, etc) +but: + +- I never got to start from my own boot sector +- College is hard so I don't remember most of it. + +Inspired by [this document](http://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf) +and the [OSDev wiki](http://wiki.osdev.org/), I'll try to make short step-by-step READMEs and +code samples for anybody to follow. + +I will not explain the theory. Google is your friend. Learn what assembler is, pagination, interrupts, +segmentation, etc. That is already covered by thousands of PDFs from Universities. This course +is a tutorial, a hands-on, not a real CS lecture. + + +How to use this tutorial +------------------------ + +First, go through every folder in order. They build on previous code, so if +you jump right to folder 08, you may find a lot of stuff which is not related +to what folder 08 is about. + +To see the increments between "lessons", do a diff between folders. + +Second, for each folder, read the README. It is **very concise**. There is +no theory. Then, look at the code examples. You can try to write them by +yourself on a different folder, modify them slightly and play a bit with the +code. + +Finally, the code files provided in each folder are the final result. If +you want to learn quickly (though not as thoroughly), just read the +provided code files. + +TL;DR: First read the README on each folder, then decide if you will +implement it yourself or just read the provided code files. + + +Contributing +------------ + +I'm still learning this. For the moment, please restrict your contributions to fixing possible bugs +or improving existing documents. I'm not yet ready to accept enhancements.