Installing Minix 2 on VirtualBox
Minix 3 has been out for a long time, but Minix 2 is simpler and can be a better basis for experimentation. It's convenient to install Minix on a virtual machine so that installations can be cloned in seconds, trashed at leisure and discarded at will. Although it's possible to download an installation of Minix 2 on VMware Player, I find VirtualBox more convenient for experimenting, even though the networking doesn't seem to work.
Here's a step-by-step guide to installing Minix 2 on VirtualBox with a Linux host.
Stage 1: fetch the software and prepare a boot disk.
- Download the Minix 2 distribution from http://www.minix3.org/previous-versions/gzipped/Intel-2.0.4.tar.gz and untar it.
- Make an empty 1440kB floppy disk image with
dd if=/dev/zero of=boot.img bs=1k count=1440
- Concatenate the root and usr images from the Minix distribution and write them to the floppy image with
cat Intel-2.0.4/i386/ROOT.MNX Intel-2.0.4/i386/USR.MNX | dd of=boot.img conv=notrunc
Stage 2: create a virtual machine
- Now make a new VirtualBox machine as follows:
- Name=Minix, Operating System=Other, Version=Other/Unknown.
- Base Memory Size=64MB.
- Create new hard disk, VDI, Dynamically allocated, 200MB.
- Choose Settings/Storage for the new machine.
- Delete the CD drive
- Add a second hard disk to the IDE controller: Create new disk, VDI, Fixed size, Location=MinixDist.vdi, Size=20MB. Put the image in the same directory as
- Add a floppy controller and a floppy drive containing your image
Stage 3: prepare the installation disk
- Cross your fingers and boot the machine.
=to boot, fill in the
/dev/fd0p2, login as root.
- Partition (using
part) and format (using
mkfs) the 20MB drive that appears as
/dev/c0d1with a single Minix partition that fills the disk.
- Make a minix file system, and mount it to check.
mkfs /dev/c0d1p0 mount /dev/c0d1p0 /mnt df
shutdownand close the window to power off the virtual machine.
- Now mount the disk image under Linux, copy the Minix files, and unmount it.
sudo mount -o loop,offset=2129408 MinxDist.vdi /mnt sudo cp Intel-2.0.4/i386/* Intel-2.0.4/src/* /mnt sudo umount /mnt
Stage 4: actually install Minix.
- Now boot the virtual machine again.
- Follow the instructions in
usage.txtto install Minix.
- There's no need to create a swap partition, because 64MB RAM is plenty to run Minix.
- When you get to the stage of installing the rest of /usr and the system source, mount the 20MB disk on /dist, and all the files you need will be there.
mkdir /dist mount /dev/c0d1p0 /dist setup /usr </dist/USR.TAZ etc
- Don't forget to remove the floppy disk image from the virtual drive when you've finished.
Stage 5: enjoy.
- You can mount the 20MB disk under Linux again or under Minix to transfer files back and forth. Just don't try to mount it in both places at once.
- Minix 3 installs in VirtualBox with no problems. Just insert the ISO image into the virtual CD-ROM(Read-Only Memory) A form of storage whose contents are non-volatile (are not lost when the power is off) but cannot be changed under program control. Modern ROM is usually EEPROM -- Electrically Erasable Programmable Read Only Memory, and ''can'' be changed electrically, and even under control of a program running on the microcontroller, but using special peripheral registers and not the normal store instructions. ''Flash memory'' is a modern, super-compact implementation of EEPROM, but for our purposes it does exactly the same job. We will modify the contents of the <span style="font-size: 110%">micro:bit</span>'s flash memory by downloading programs, but we will probably not be writing programs that change the contents of the flash memory. drive, boot the virtual machine, and follow the instructions. Choose the PCnet-PCI II network adapter, which Minix can access using the LANCE driver, included in the 2.04 fixes.
- The ethernet driver doesn't seem to work in Minix 2, but the one provided in Minix 3 does work. Maybe the working one can be ported across. [Update: yes it can. Details to follow. (29/9/2011)]
- On my laptop, there's no NumLock key (or rather, there is one, but it functions in a non-standard way). Sometimes, VirtualBox thinks the NumLock is on, and unhelpfully inserts a NumLock keypress into the keyboard buffer of Minix at startup. The result is that the arrow keys don't work. Fixes: use an external keyboard to turn NumLock off; or hack the Minix keyboard driver to ignore NumLock.
- The magic number 2129408 comes from the fact that the VDI file has an 2-megabyte header before the disk image, and then the partition starts 63*512 = 32256 bytes into the disk image itself. You can find the offset of the image data by using the command
vboxmanage internalcommands dumphdinfo MinixDist.vdi