How to compile and run Minix 3 operating system under linux
Tags: minix, operatingsystem, compiling, tanenbaum
Published: 2020-06-08 19:20:24

---
title: How to compile and run Minix 3 operating system under linux
published: true
description: 
tags: minix, operatingsystem, compiling, tanenbaum
cover_image: https://4.bp.blogspot.com/-r_QQPDQCgNI/Xt4iaQxo-uI/AAAAAAAAHqU/ZTY-jccUf3Ad6pWlpNJjVdJmVfsB-rRBwCLcBGAsYHQ/s1600/Screenshot%2Bfrom%2B2020-06-08%2B14-34-30.png
---
<p>The Minix operating system was created by <a href="https://en.wikipedia.org/wiki/Andrew_S._Tanenbaum">Andrew S. Tanenbaum</a> and inspired <a href="https://en.wikipedia.org/wiki/Linus_Torvalds">Linus Torvalds</a> in creation of Linux operating system.</p>

<p>
<a href="https://en.wikipedia.org/wiki/Andrew_S._Tanenbaum">Andrew S. Tanenbaum</a> wrote two reference books in Computer Science <a href="https://www.amazon.com/Modern-Operating-Systems-Andrew-Tanenbaum/dp/013359162X">Modern Operating Systems</a> and <a href="https://www.amazon.com/Computer-Networks-5th-Andrew-Tanenbaum/dp/0132126958/">Computer Networks</a>
</p>

<p>MINIX 3 is a free, open-source, operating system designed to be highly reliable, flexible, and secure. It is based on a tiny microkernel running in kernel mode with the rest of the operating system running as a number of isolated, protected, processes in user mode. It runs on x86 and ARM CPUs, is compatible with NetBSD, and runs thousands of NetBSD packages.</p> 
<h1>Install depedencies</h1>
<p>Before attempting to cross-compile MINIX, you need a working C toolchain, Git and some additional software on your host platform.</p>

For Debian-based operating systems, run the following command as super-user:
{% gist 
https://gist.github.com/adavidoaiei/4c1546693b826dd816986699901bc387.js %}
Note: Also on Ubuntu, if you get an error stating that “'/lib/cpp' fails sanity check”, you need to install the GNU C++ compiler:
{% gist 
https://gist.github.com/adavidoaiei/0294f7f1ca9328cb14011e939a27dbbe.js %}
Note: On FreeBSD and Minix (compiling for ARM on x86, e.g.), if you get a message along the lines of “Skipping image creation: missing tool 'mcopy'”, please install the emulators/mtools package.
<h1>Getting the sources</h1>
Once the required tools are installed, the next step is to obtain the sources. Run the following commands in a terminal:
{% gist https://gist.github.com/adavidoaiei/7e3aca91834ced27a9108160caba7997.js %}
NOTE: The releasetools script will generate object files and put them outside the source directory; i.e., if you've cloned to ~/minix/src/ and build from there, things will start showing up in ~/minix/ as an artifact of the build process.
<h1>Cross-building for x86</h1>
It's time to build MINIX itself. There are some wrapper scripts that will build ready-to-boot images from scratch (i.e. just the minix source tree) for either x86 or ARM. These scripts produce a lot of output and will take a while to complete the first time - a cross-toolchain based on LLVM is built from scratch.
{% gist https://gist.github.com/adavidoaiei/0fdc7d75dee0d8c5ddbe153c374c66f4.js %}
A command line for running the result in a KVM virtual machine is printed at the end of the process.<br>
To install quemu run:
{% gist https://gist.github.com/adavidoaiei/b01c4b7790b3b7fff9cf96d295f28ee5.js %}
To boot this image on kvm using the bootloader:
{% gist https://gist.github.com/adavidoaiei/1a2459c78d6fc7f99bd962f908c6250d.js %}
<a href="https://2.bp.blogspot.com/-R0WKMwxLW2Q/Xt5ulTAtdYI/AAAAAAAAHqg/u6sRF95BqPsiN6YxOBwScraR-MO1frPwQCLcBGAsYHQ/s1600/Screenshot%2Bfrom%2B2020-06-08%2B19-54-35.png" imageanchor="1" ><img border="0" src="https://2.bp.blogspot.com/-R0WKMwxLW2Q/Xt5ulTAtdYI/AAAAAAAAHqg/u6sRF95BqPsiN6YxOBwScraR-MO1frPwQCLcBGAsYHQ/s1600/Screenshot%2Bfrom%2B2020-06-08%2B19-54-35.png" data-original-width="1366" data-original-height="768" /></a>
<br><br>