From 9eee9e78193ca880d12552b3a1744f5085d11828 Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Mon, 29 Sep 2014 11:00:02 +0200 Subject: [PATCH] First commit --- 00-environment/README.md | 6 +++++ 01-boot-sector/.README.md.swp | Bin 0 -> 12288 bytes 01-boot-sector/README.md | 17 +++++++++++++ README.md | 44 ++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 00-environment/README.md create mode 100644 01-boot-sector/.README.md.swp create mode 100644 01-boot-sector/README.md 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 0000000000000000000000000000000000000000..6d766c2cd8c39855ff7e48b267922e2d93d5c25b GIT binary patch literal 12288 zcmeI2y>8S%5XUE}N%*R$m>fljl(T(_PJDDhNs%IoL=LDxx3<^k)!E*YcTMgZ=qY&w zsCWn{co-gl4hqEVo=+DdMT9bFERR;ZJ0Jh~ZDo1m==tFhJ_vS!o*Mw~?rse*SzrBh z2O!C0rHeuv;WjUR%2))2PDF9Bi{E*(Oc?IhdJ^ktxUZ9@l$AB%NZGuJLv6aYvAR~G z2%}y%*4lQBOlT#1da$>DbP$y3U+VBS6JP@82sAe9K3s#{onGX2?sYcs_N`~NfC(@GCcp%k z025#WOyCL<5cD(s*EN7wYb2ij|1ZA(zg!3SOlHXfvTy4EAIUzDy(H_9ZIJz>xF2NS z$-a`kCyU8^zAMOsB{Kmgzyz286JP>NfC(@GCcp%i1fmEp`S$z6;SetAOm6)?3h@vA zJ~PNin5CFymsAC$NthB~kSl}q+FYVh<)o0tqPuR5^Xt|qU(5P2K)=^RQKi`L?V!%Q zyC@1dlIb7bqLvuXtTZ@`rh9wTdjJECr5IEChBj?3tdH)b%8XrQS4_l(>}>n>Cx^!; znB+1UJ5l89(*d+aeboJAR;VhKHAdT*OOd*<)f;VjorMk&s?hp}=va zPb&(t)Rd@GbT`+n(p7*1S9CF5pvhECT;?SpmDIR!P0qU!)QHty{TXsDQ)A{$oms}R zafBtj$YteY5?xLjOU*d1Ho#LzwKUbH^;$94r>;n$satng$0wv-qq560q?4MVoF>Yu dYP5}~a+83MG)-J&QcKc|x~Y*`KYMB$@Efe`4o(07 literal 0 HcmV?d00001 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.