o-oconnell / minixfromscratch

Development and compilation setup for the book versions of MINIX (2.0.0 and 3.1.0) on QEMU
Other
1.23k stars 66 forks source link
bash compilers computer-architecture data-structures-and-algorithms filesystem kernel networking operating-systems programming system-administration system-programming

MINIX 2 Book Version recently added! Check releases: MINIX 2 is more education-focused and simpler than 3 yet equally well documented. You can get the book here.

MINIX From Scratch

Why MINIX?

I believe that learning MINIX is probably the best way to learn about operating systems. Until now, I have not been able to find a MINIX 3 project that allows you to compile the code that is referenced in the book Operating Systems: Design and Implementation (3e) (v3.1.0). It was tricky to get a reasonable development setup to make it possible for newbies like myself to learn from the book. This is an attempt to fix that and make it easy to browse, edit, recompile, and execute the code.

Why should you learn MINIX instead of Linux? Or rather than another teaching OS such as xv6, NachOS, or Xinu?

Unlike most of these systems, MINIX:

Although xv6 and these other systems have been valuable tools for me (and may have extra features, like threads and NAT), I have found that the MINIX documentation is the most extensive.

Screenshots

The login screen:

login

Using the built-in partition editor, part:

part

Editing code from the hard disk image mounted with mountminix3.sh:

src

Navigating the code in /usr/src:

src

Recompiling the system:

recompile

Minimal working example

Download the .img from releases. Assuming you have QEMU installed, run ./qemuminix3.sh. After it boots, you can log in with username "root" and no password. To edit the code and recompile:

Why learn MINIX before Linux

Relevant quote from Andy Tanenbaum:

For people who thought little of MS-DOS , the existence of MINIX (with source code) as an alternative was even a reason to finally go out and buy a PC. One of these people was a Finnish student named Linus Torvalds. Torvalds installed MINIX on his new PC and studied the source code carefully...By Aug. 1991 he had produced a primitive kernel. On Aug. 25, 1991, he announced it on comp.os.minix...Thus was Linux born (OSDI, 3e, p.19).

MINIX is a great tool for learning about Linux. MINIX is like a small and simplified version of Linux - Linus took heavy inspiration from it, and his legendary "nothing big" post announcing Linux was first posted on the comp.os.minix news board. Within MINIX you will find many familiar Unix/Linux tools and features, including:

MINIX is useful for learning about

Making your own hard disk image

To make a bootable and editable hard disk image, you'll need to install it from the official MINIX CD. You can find it at minix3.org. MINIX 3 comes with a setup.sh utility, which will install to the hard disk that you specify with your desired network card, partitions, etc.

References