Working with Minix 3 on Ubuntu with VirtualBox

In my OS course, we use the Minix operating system. We have various assignments that require us to edit kernel source code, etc. We use virtual machines for doing our work, and my preferred VM software is VirtualBox. There seems to be little info about using Minix with VirtualBox on the net, as Minix is not officially supported by VBox. Nevertheless it can be used fine. I am going to write about my own setup in roughly tutorial form.

First, about my software versions. At the time of this writing, I am using:

  1. the latest stable Ubuntu, which is Jaunty Jackalope, version 9.04, as the host operating system,
  2. the latest stable VirtualBox, which is version 3.0.4, and,
  3. the latest stable Minix 3, version 3.1.3a

It is quite simple to install Virtualbox on Ubuntu.

Installing Minix on VBox

http://wiki.minix3.org/en/UsersGuide/RunningMinixOnVirtualBox

My own VM settings are 128 MB RAM and a 1 GB virtual hard disk.

Installing packages

http://wiki.minix3.org/en/UsersGuide/InstallingBinaryPackages

Packages that are useful for me: flex, gcc, emacs, less, make.

Networking

Networking has not been possible to setup. I have tried to get bridged networking to work, so that files can be shared via ssh, but it has not worked yet. I will update if I do succeed. Please post in the comments if you have any tips.

Networking would have been ideal for transferring files both ways between the two OSes, but I am managing with one way transfers for now (Linux to Minix).

Exchanging files between Minix and Ubuntu

I have so far only succeeded in copying files into the guest OS and not vice versa. Since networking has not worked for me, I transfer files via cd images. To transfer single files, create a cd image containing the files in Ubuntu with:

mkisofs -o t.iso <list of single files>

Then, mount the cd image in the VM through VBox’s GUI: Devices->Mount CD ROM. To read the cdrom in Minix, use the isoread, and isodir commands. To copy files from the cd, use a command of the form:

isoread - /dev/c0d2 src.c > src.c

Don’t forget the hyphen after “isoread”.

Copying a whole directory into minix may seem complex using the above method, but the trick is to create a tar file out of the directory we want to copy. We copy the tar archive into minix using the method discussed above and then extract it in the guest.

Getting Minix kernel sources

This initially turned out to be challenging, because though the source code is available in the VM at /usr/src, it can’t be copied to the host for editing using powerful editors in Linux. The source code is available on the Minix cd but it is present in a cd sub-partition that is in the Minix filesystem format. Also, there is no readily available download package on the Minix website.

But there is the SVN repo. The only thing to find is the right revision for the version of Minix we use. Looking the tags folder, helped. To download the sources for my version, I fired off a terminal and typed:

svn checkout https://gforge.cs.vu.nl/svn/minix/tags/r3_1_3a

Enter the username as “anonymous” and enter a blank password.

To get rid of the .svn folders (these are not part of Minix source code) inside the sources folder we downloaded, use the following command from inside the folder created by the subversion checkout:

find . -name ".svn$" | xargs rm -rf

Now our sources are ready for editing.

Recompiling the Minix kernel

After we edit sources, we copy the files into Minix’s /usr/src. Then, from /usr/src/ we type:

make world

If everything works, this builds a new kernel and sets it up for booting. Type “shutdown” to shutdown the VM, and from the boot prompt, type “boot d0p0” to start minix. In the resulting boot menu enter “3”, and we boot into the kernel we just modified! More information about recompiling is here.

/r3_1_3a