Go to file
Sa'id Kharboutli cfd6859308
Fixed typo regarding indirect addressing
The comment previously stated that attempt 2 was "printing the memory address...", but it is meant to say "printing the data at the memory address..." since it was indirectly addressed using [the_secret]
2021-05-09 03:01:36 -04:00
00-environment Update README.md 2017-04-14 22:16:08 +02:00
01-bootsector-barebones Merge pull request #33 from ariisboss/patch-1 2018-04-20 14:44:13 +02:00
02-bootsector-print updated READMEs 2014-10-05 18:39:45 +02:00
03-bootsector-memory Fixed typo regarding indirect addressing 2021-05-09 03:01:36 -04:00
04-bootsector-stack updated READMEs 2014-10-05 18:39:45 +02:00
05-bootsector-functions-strings lesson 7, reading from disk 2014-10-08 20:59:08 +02:00
06-bootsector-segmentation lesson 6, segmentation 2014-10-05 20:41:18 +02:00
07-bootsector-disk Fix comment for number of sectors to read 2016-10-12 21:22:55 +02:00
08-32bit-print typo 2015-03-23 09:27:40 +01:00
09-32bit-gdt lessons 8, 9, 10, entering 32-bit mode 2014-10-09 11:42:38 +02:00
10-32bit-enter lessons 8, 9, 10, entering 32-bit mode 2014-10-09 11:38:11 +02:00
11-kernel-crosscompiler changed gcc src download link 2017-10-06 14:24:47 +09:00
12-kernel-c Fixed typo in README.md 2018-03-02 22:31:30 -06:00
13-kernel-barebones os-image.bin can be shortened to $@ 2017-12-06 23:39:30 -05:00
14-checkpoint Updated link to GDB 2018-04-03 16:51:57 -05:00
15-video-ports Lesson 18 2015-02-03 19:13:13 +01:00
16-video-driver Lesson 18 2015-02-03 19:13:13 +01:00
17-video-scroll Lesson 18 2015-02-03 19:13:13 +01:00
18-interrupts Updated link to JamesM's tutorial. Close #11 2016-10-24 10:58:40 +02:00
19-interrupts-irqs Updated gitignore 2015-03-20 11:40:31 +01:00
20-interrupts-timer Fixed warnings 2015-03-23 16:08:34 +01:00
21-shell Merge pull request #62 from ss18/ss18/pr0 2018-11-03 01:25:29 +01:00
22-malloc fixed README for lesson 22 2015-08-17 18:32:46 +02:00
23-fixes pased -> passed 2018-09-25 14:28:04 +02:00
24-el-capitan Update README.md 2018-10-05 18:42:47 +03:00
.gitignore Updated gitignore 2015-03-20 11:40:31 +01:00
LICENSE Create license. Closes #51 2018-09-22 11:31:27 +02:00
README.md Update README.md 2018-04-19 10:05:19 +02:00

os-tutorial

How to create an OS from scratch!

I have always wanted to learn how to make an OS from scratch. In college I was taught 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.
  • I'm fed up with people who think that reading an already existing kernel, even if small, is a good idea to learn operating systems.

Inspired by this document and the OSDev wiki, I'll try to make short step-by-step READMEs and code samples for anybody to follow. Honestly, this tutorial is basically the first document but split into smaller pieces and without the theory.

Updated: more sources: the little book about OS development, JamesM's kernel development tutorials

Features

  • This course is a code tutorial aimed at people who are comfortable with low level computing. For example, programmers who have curiosity on how an OS works but don't have the time or willpower to start reading the Linux kernel top to bottom.
  • There is little theory. Yes, this is a feature. Google is your theory lecturer. Once you pass college, excessive theory is worse than no theory because it makes things seem more difficult than they really are.
  • The lessons are tiny and may take 5-15 minutes to complete. Trust me and trust yourself. You can do it!

How to use this tutorial

  1. Start with the first folder and go down in order. They build on previous code, so if you jump right to folder 05 and don't know why there is a mov ah, 0x0e, it's because you missed lecture 02. Really, just go in order. You can always skip stuff you already know.

  2. Open the README and read the first line, which details the concepts you should be familiar with before reading the code. Google concepts you are not familiar with. The second line states the goals for each lesson. Read them, because they explain why we do what we do. The "why" is as important as the "how".

  3. Read the rest of the README. It is very concise.

  4. (Optional) Try to write the code files by yourself after reading the README.

  5. Look at the code examples. They are extremely well commented.

  6. (Optional) Experiment with them and try to break things. The only way to make sure you understood something is trying to break it or replicate it with different commands.

TL;DR: First read the README on each folder, then the code files. If you're brave, try to code them yourself.

Strategy

We will want to do many things with our OS:

  • Boot from scratch, without GRUB - DONE!
  • Enter 32-bit mode - DONE
  • Jump from Assembly to C - DONE!
  • Interrupt handling - DONE!
  • Screen output and keyboard input - DONE!
  • A tiny, basic libc which grows to suit our needs - DONE!
  • Memory management
  • Write a filesystem to store files
  • Create a very simple shell
  • User mode
  • Maybe we will write a simple text editor
  • Multiple processes and scheduling

Probably we will go through them in that order, however it's soon to tell.

If we feel brave enough:

  • A BASIC interpreter, like in the 70s!
  • A GUI
  • Networking

Contributing

This is a personal learning project, and even though it hasn't been updated for a long time, I still have hopes to get into it at some point.

I'm thankful to all those who have pointed out bugs and submitted pull requests. I will need some time to review everything and I cannot guarantee that at this moment.

Please feel free to fork this repo. If many of you are interested in continuing the project, let me know and I'll link the "main fork" from here.