The installation of MINIX3 system

There is a great experience for speed lovers to use the MINIX installed on a primary partition, but it is simpler if the first encounter with MINIX takes place on a virtualized machine. So we are going to install MINIX3 in VirtualBox. For example, let's choose the latest development snapshot image minix3_2_1_ide_20131118.iso, that should be written to a CD disk, but it is a better way to mount this ISO image directly.

Installation in VirtualBox

Figure 2.4. Giving the name of the MINIX system that will be installed.

Giving the name of the MINIX system that will be installed.

Creating a virtual machine in VirtualBox is a very simple, but necessary subtask. After some clicks with using the default settings the new virtual MINIX system will be launched soon.

Figure 2.5. Launching the virtualized MINIX.

Launching the virtualized MINIX.

At first startup, we must give from where we want to boot. All we have to do is to choose the downloaded image file.

Figure 2.6. Starting the installation.

Starting the installation.

From this point we have to give some settings that must be applied mutatis mutandis.

Figure 2.7. Loading the system from disk.

Loading the system from disk.

We must follow the instructions which appeared on the screen: the installation will start after we have logged in as root and entered setup.

Figure 2.8. We accept defaults, mutatis mutandis.

We accept defaults, mutatis mutandis.

During the next installation steps we may accept the defaults by pressing Enter, mutatis mutandis. Then (after unmounting the installer disk image in the menu item Devices/CD/DVD Device) we are able to boot the new MINIX system from the hard disk.

Figure 2.9. MINIX starts from hard disk now.

MINIX starts from hard disk now.

In the next section we are going to take possession of the newly installed MINIX.

The first MINIX kernel hacking

The first kernel compilation is an obligatory task for all students. Let's do it together now!

Using the command cd /usr/src we enter the directory that contains the MINIX kernel-tree. Then we open the source file kernel/main.c with vi editor. The usage of vi is not masochism, because the installed MINIX has no other editors now.

Figure 2.10. Opening the source file kernel/main.c with vi.

Opening the source file kernel/main.c with vi.

In this source file, search for the function announce().

/*===========================================================================*
          * announce *
          *===========================================================================*/
          static void announce(void) { /* Display the MINIX startup banner. */
          printf("\nMINIX %s.%s. " #ifdef _VCS_REVISION "(" _VCS_REVISION
          ")\n" #endif "Copyright 2012, Vrije Universiteit, Amsterdam, The
          Netherlands\n", OS_RELEASE, OS_VERSION); printf("MINIX is open
          source software, see http://www.minix3.org\n"); printf("nORBi a
          kernelben\n"); printf("%c%s",0x1B,"[47;30m"); }

Figure 2.11. The modification of the function announce() in the kernel/main.c source file.

The modification of the function announce() in the kernel/main.c source file.

All we did was to write a message during booting. The Hungarian language message nORBi a kernelben roughly means „the author is in the kernel” that is similar to a „Hello, World!„ message from the kernel. This message will be printed in boot time. In addition, the video mode of the terminal is changed to gray background and black foreground. The description of the used ANSI escape codes, for example, can be found in Wikipedia.

After saving the source (using Shift+zz key combination in vi) the make install command compiles the kernel sources, then the system must be rebooted by the command shutdown -r.

Figure 2.12. The booting of the newly compiled kernel.

The booting of the newly compiled kernel.

In the case of the newly compiled kernel we can see the message from the kernel and the changed video mode as well.

Figure 2.13. The message from the kernel.

The message from the kernel.

Installing the packages

Handling packages and the packages themselves are always changing... At first in Minix3, we could use packman package manager program and for example the emacs editor could be installed from package. At this moment MINIX's package manager is pkgin and emacs cannot be installed from package.

Before listing the available packages we must enter the command pkgin update, after this we are able to choose from packages using command pkgin av|more.

Figure 2.14. The first step of managing packages.

The first step of managing packages.

Customize Your Minix!

For example, I like to set the bash's PS1 environment variable to show the host name, the user name and the working directory. I usually add the following lines to the bottom of the .profile file.

export PS1="\[\033[47;30m\][minix@\u]\w > " clear bash
            exit

If we have already set the video mode in kernel, we do the same in the shell too. Here we may notice that using .bashrc to set PS1 is a more robust solution than using .profile

 export PS1="\[\033[47;30m\][minix@\u]\w
            > " clear 

because in this case the make world will not delete this file.