Giter Club home page Giter Club logo

o-oconnell / minixfromscratch Goto Github PK

View Code? Open in Web Editor NEW
1.2K 13.0 62.0 6.3 MB

Development and compilation setup for the book versions of MINIX (2.0.0 and 3.1.0) on QEMU

License: Other

Shell 1.83% Makefile 1.62% C 79.29% Assembly 2.70% Max 0.03% Yacc 0.29% Limbo 0.04% Lex 0.16% NASL 0.01% XSLT 0.08% Roff 12.04% CSS 0.01% Perl 0.01% HTML 1.42% Eiffel 0.08% E 0.06% C++ 0.34% xBase 0.01% Batchfile 0.01% sed 0.01%
kernel operating-systems computer-architecture data-structures-and-algorithms networking programming bash compilers filesystem system-administration

minixfromscratch's Introduction

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:

  • Is heavily commented.
  • Comes with three highly detailed books as its primary form of documentation.
  • Has a much smaller and easier-to-understand kernel (it helps that it's a microkernel).
  • Runs quite well on an emulator without melting your CPU (at least since the 2nd edition).

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:

  • Exit MINIX with CTRL+ALT+DEL (if you do not, you may lose files that were not synced to the hard disk). You'll then need to close QEMU manually (MINIX doesn't know how).
  • Mount the root, usr, and home partitions with ./mountminix3. Linux requires superuser permissions to mount a file system.
  • Make your edits to the code (for a start, maybe try modifying the boot message).
  • Unmount the filesystems using ./umountminix3.sh (also requires sudo).
  • Start the system again with ./qemuminix3.sh

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:

  • A similar directory structure: files such as /etc/utmp, /etc/passwd, /dev are where you expect them to be.
  • A Bash interpreter (ash) with source code.
  • Similar filesystem conventions: just as in Linux, you can mount filesystems directly onto the root filesystem with mount.
  • A similar system administration structure, with familiar utilities like chmod, mkfs, mkisofs (genisoimage), part (similar to fdisk or parted) an Emacs clone (elle), and a Vim clone (evil).

MINIX is useful for learning about

  • Operating systems
  • Cybersecurity
  • Networking
  • System administration
  • Computer architecture
  • Compilers (MINIX ships with its own miniature C compiler, ACKPACK)
  • Filesystems and disk partitioning
  • Hardware
  • Bash scripting
  • Data structures and algorithms

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

minixfromscratch's People

Contributors

linesteppr avatar o-oconnell avatar ozanuslan avatar syncsynchalt avatar tromcho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minixfromscratch's Issues

Edit and Recompiler

Env: wsl2 in Win10

Q . sudo ./mountminix3.sh
There is information followed :

" pg@HIL3510W:minixfromscratch$ sudo ./mountminix3.sh
[sudo] password for pg:
mount: /home/pg/GitPlayground/minixfromscratch/minix3bookmnt/root: unknown filesystem type 'minix'.
mount: /home/pg/GitPlayground/minixfromscratch/minix3bookmnt/home: unknown filesystem type 'minix'.
mount: /home/pg/GitPlayground/minixfromscratch/minix3bookmnt/usr: unknown filesystem type 'minix'."

Q2: navigate to ./minix3bootmnt/usr , there is no code source to be edited

image

So my Q is, does anything wrong about the process, or i missed some information?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.