[MINIX LOGO]

Minix on Bochs on Windows How-to

modified: 19 June 2004


[HOME] [HINTS/FAQ] [MINIX DOWNLOADS] [CONTRIB SOFTWARE]
[NET SOFTWARE] [MINIX-VMD] [TEXTBOOK] [LINKS]

Index of this document Back to index

Introduction:

"Bochs is a highly portable open source IA-32 (x86) PC emulator written in C++, that runs on most popular platforms. It includes emulation of the Intel x86 CPU, common I/O devices, and a custom BIOS. Currently, Bochs can be compiled to emulate a 386, 486, Pentium, Pentium Pro or AMD64 CPU, including optional MMX, SSE, SSE2 and 3DNow instructions. Bochs is capable of running most Operating Systems inside the emulation including Linux, Windows® 95, DOS, and Windows® NT 4."

-- from the Bochs home page.

Bochs is an emulator, interpreting every CPU instruction. So it is slow. The dhrystone benchmark indicates the slowdown factor is about 100; Minix on Bochs on a 400 Mhz AMD K-6 yields a dhrystone score about equal to what I measured some years ago on 386 system. But that's not really too bad. Since Minix has only a text-mode console interface it doesn't need to waste a lot of CPU power doing graphics.

Minix can be run as a guest OS on top of Bochs. This allows Minix to be used on just about any common computer, with any host hardware and operating system, including Unix, Linux, Windows, and MacIntosh systems. In a teaching lab students can experiment with alterations to the Minix operating system without danger of corrupting the host OS or applications that may be needed for other classes. If the host computer on which Bochs is running has a network interface you can have a guest operating system share that interface on most host platforms. When this is set up correctly the host and the guest have distinct identities on the network. On a Windows host they can even connect to each other and other guest systems.

This document describes how to install Bochs and how to install and configure Minix on Bochs. It is written as a tutorial, with the idea you will read it through from beginning to end as you work with Minix on Bochs. Everything you might want to know about some particular topic may not be in the same place, as it might be in a reference document. Tutorials are not always good as reference documents, and vice versa.

I have not investigated everything one might want to know about using Minix on Bochs, and I would welcome additional information from anyone who wants to look into things I have left out. Corrections where I got something wrong would also be appreciated. Nothing here is guaranteed to be correct, and since we are talking about a free operating system (Minix) running on a free emulator (Bochs), and taking advantage of other free packages (WinPCap, DiskExplorer), there is always a chance that a newer version of any one of these pieces may work differently from the way it is described here.

This document is mostly based on experience running Bochs on Windows 2000, Service Pack 4. Some testing has been done on Windows 98 as well. I expect some of the information here will be applicable to running Minix on Bochs on other operating systems.

Back to index

Installing Bochs on Windows 2000:

Read the introduction to the Bochs project on the Bochs home page, http://bochs.sourceforge.net/ and click on the link to the Bochs project page to see what is available for download. The rest of this description is based on the Bochs-2.1.1.exe binary installation package for 32-bit Windows released 2004-02-07. (Earlier releases, as well as source packages and binary packages for Bochs versions that will run on Linux, Unix, and Mac OS are also available here.) You can also view Release Notes and the ChangeLog on the Bochs project page. When you click on a file to download you will have to select a mirror site to download from. Choose one, and then download the file to your Windows machine.

If you have previously installed another version of Bochs you may want to uninstall it before proceeding. If you added any files or a Minix subdirectory to what was installed by the earlier Bochs version they should be left after the uninstallation is complete, but to be sure you may want to move them to another directory or to the Windows desktop temporarily.

Installation is like most Windows installations. For Windows 2000 you should be logged in to Windows as an Administrator or Power User. Double-click the file you downloaded and agree to the license terms. The default "Normal" installation requires 3.2 MBytes of hard disk space. I suggest that you opt for the "Full" installation if you have plenty of disk space. This requires 10 MBytes more to install a small demonstration Linux system. The Linux demo may come in handy later, it gives you a way to see if a problem you encounter with Minix on Bochs is a Minix problem or whether it also occurs when running a different guest operating system on the Bochs host. Be aware, however, that you are going to need another 50 MBytes of disk space to run Minix on Bochs (actually, you can do it with less space, but the procedure I will suggest here requires another 50 MBytes for a full Minix-on-Bochs installation).

After installation is complete the installer will offer to let you view the CHANGES.txt and README.txt files. The installer will create a Bochs 2.1.1 folder in your Start: Programs menu, with various shortcuts, including links to a sample Bochs configuration file, and links to programs to create a new virtual disk and to find and identify network adapters so they can be specified in the configuration file and accessed by a guest operating system.

Installing Bochs on your Windows system will also make the Bochs HTML Documentation available. The documentation is extensive, but there are many gaps where sections are planned but not yet written. The top-level page should be at C:\Program Files\Bochs-2.1.1\docs\index.html. (Note that this link may not work if you did not install Bochs in the suggested directory or if your Bochs version is different, but it should be a good guide to finding the pages. Also try cutting and pasting the URL into your browser's address window if clicking on it doesn't work).

If you installed the Linux demo system you can run it now. For more information go to the page on Running the DLX Linux Demo on Bochs

Back to index

Installing Minix 2.0.4 on Bochs using the DOSMinix image

There is more than one way to get Minix running on Bochs. The super-easy way will be to use an image package downloaded from the Bochs site. A collection of disk images can be found at http://bochs.sourceforge.net/diskimages.html. Unfortunately, at the time of writing this document (Feb 2004) a Minix 2.0.4 image is not in this collection. Another SourceForge site (http://prdownloads.sourceforge.net/bochs/) has a Minix 2.0.3 image in two different formats, but it is old (Dec. 2002, about the time of the release of Bochs 2.0). If you can find an up-to-date Minix image package for Bochs somewhere, use it, but read what follows anyway. And if a newer Minix release is available you may want to get the latest DOSMinix image and install it yourself as described below.

Updates: 10 March 2004: I have posted a ready-to-use Minix 2.0.4 image for Bochs on Windows as a zipped Windows directory on this site. Download mx204bx01.zip. It is a big (7 MByte) download. Using the ready-to-run image will make some of the steps to be described below unnecessary, but I still recommend that you read the rest of this document, especially the section about time-keeping problems. 24 March 2004: The same Minix 2.0.4 image package has now been posted at SourceForge. The filename has been changed. The URL to download it is: http://prdownloads.sourceforge.net/bochs/minix204.zip. (SourceForge has high-powered servers and bandwidth and mirror sites, so this may be a better way than downloading from my humble minix1 machines).

The next easiest way is to use the DOSMinix image, which was originally designed to run Minix from a simulated disk using a large MS-DOS/Windows file. This also works very well as a simulated disk for use with Bochs. For more about DOSMinix read the dosminix.txt file available from the Minix home page in the Netherlands, or at other sites that distribute Minix, such as this one.

The rest of this section describes installation using the DOSMinix image. Other methods are described in a later alternative installation methods section.

Download the ready made 2.0.4 DOSMinix from http://www.cs.vu.nl/pub/minix/2.0.4/i386/DOSMINIX.ZIP or another site, and then use WinZip or a similar program to unzip the archive. Assuming you installed Bochs in the default location, C:\Program Files\Bochs-2.1.1, specify that the files should be extracted into C:\Program Files\Bochs-2.1.1\minix204. Winzip will create the new directory for you.

Now use Windows Explorer to look at the newly created C:\Program Files\Bochs-2.1.1\minix204 directory. Here's a DOS-style directory listing of what you'll see:

    09/14/2003  02:03p              20,800 BOOT.COM
    04/05/2003  12:22p                 481 minix.bxrc
    12/20/1998  04:06p                 766 MINIX.ICO
    11/09/2003  05:47p          52,428,800 MINIX.MNX
    09/14/2003  02:03p               2,848 MKFILE.COM
    05/22/2001  10:31p               1,650 README.HTM
    05/22/2001  10:31p               1,327 README.TXT
The most important file here is MINIX.MNX, which is a simulated 50 MByte hard disk containing Minix. The other file of importance to us now is minix.bxrc, the Minix Bochs run-time commands file that tells Bochs how to start Minix. It is discussed in the next section. BOOT.COM won't be needed here, it is used to start Minix on DOS. MKFILE.COM may be useful later if you want to make a new Minix simulated disk, although Bochs provides another tool for this. MINIX.ICO is a Minix icon, so you can impress people with a custom icon on your Windows desktop for starting Minix on Bochs. That's not essential, but it's cool, and I'll discuss that further down.

Back to index

The Bochs run-time configuration file minix.bxrc

The minix.bxrc included with the Minix 2.0.4 DOSMINIX.ZIP looks like this:

    romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
    megs: 64
    vgaromimage: $BXSHARE/VGABIOS-elpin-2.40
    ata0-master: type=disk, path=MINIX.MNX, cylinders=200, heads=16, spt=32
    boot: disk
    log: bochsout.txt
    panic: action=ask
    error: action=report
    info: action=report
    debug: action=ignore
    ips: 1000000
    mouse: enabled=0
    pit: realtime=1
    user_shortcut: keys=ctrlaltdel
    #ne2k: ioaddr=0x280, irq=3, mac=42:00:XX:XX:XX:XX, ethmod=win32, ethdev=XXXX
This was written for an earlier version of Bochs. As it stands this file will work, but the "pit:" (programmable interval timer) parameter is going to be removed from future releases of Bochs, and a warning message will be seen on startup if this line is left in. You can delete this line, or comment it out by placing a '#" character at the start of the line, and then add the following line:
    clock: sync=realtime, time0=1
to make the bxrc file be interpreted without warnings. Also note that the line beginning "#ne2k:" is commented out. This line configures the virtual NE2000 ethernet card that Bochs provides for the guest operating system, and it will need to be edited and activated to make Minix networking functional. This will be discussed further down.

The meaning of the other parameters defined in the minix.bxrc file should be clear from their names. For detailed explanations of all of them, as well as of other parameters that can be used in a Bochsrc file, see the file bochsrc-sample.txt in the main Bochs directory. Later in this document I'll discuss modifying the minix.bxrc to allow you to use the network, floppy disks and CD-ROMs with Minix-on-Bochs.

Back to index

Running Minix-on-Bochs: first time

Now you can run Minix-on-Bochs by navigating to the Bochs-2.1.1/minix204 directory and double-clicking on minix.bxrc. (It's more elegant to use a shortcut on the desktop and/or the Start menu, setting these up will be discussed in a later section).

Bochs and Minix will start up. There will be two text-mode windows. First a Bochs Window will open. It tells you what Bochs itself is doing -- initially, it will just show you where Bochs is writing its log file. Then the guest OS window will open, probably overlapping the Bochs Window.

At the top of the guest OS window will be a line of icons. The three rightmost ones are the most important ones to know about initially. The third from the right is marked Config. This halts the emulated OS and activates the Bochs window, allowing you to change various configuration options and restart or to quit. The next to rightmost button is Reset, it will reboot the emulated OS just like a hardware reboot of a real system (including possibly messing up your emulated file system if files were being written at the time). Finally the rightmost button marked Power shuts down the emulated system and causes Bochs to exit, too, just like powering down real hardware (and with the same possible effects on the emulated file system).

Within the guest OS window you'll first see some messages related to the emulated BIOS used by Bochs, then you'll see the Minix boot menu, with an invitation to press the '=' key to start Minix. When you press '=' Minix will start loading. If you have used Minix previously the messages you will see about loading the various components of Minix will be familiar. If you haven't used Minix before, did you read the usage(8) document you were advised to read first when you went to the Minix download site? If not you should read some documentation using Minix. Log in as root (just hit Enter when asked for a password, no password is required yet) and at the '#' prompt enter

   man usage
to read the usage(8) page. The man command reads documentation (man pages). You may want to read some other man pages as well at this time. A Minix on Bochs installation has many similarities to a DOSMinix installation, and the dosminix(8) page is also recommended. Check out the apropos command, too, it helps you find man pages using keywords. If you want hard copy of a man page, I'm sorry but at the moment you're not ready for that, you'll have to go to the online man pages at the site where you downloaded DOSMINIX.ZIP and print from your browser.

Warning: This first time you run Minix on Bochs you should not try to change the Minix configuration or edit any files on the emulated disk. The reason for this is that time-keeping with Bochs 2.1.1 is a little strange, and date-stamps of new or changed files may be inaccurate if they are written. The next section discusses this and how to live with it.

If Minix didn't start up correctly you might want to run the DLX Linux demonstration system to confirm that Bochs is installed correctly. There is more information on the Running the DLX Linux Demo on Bochs page.

Back to index

Timekeeping in Bochs and Minix-on-Bochs

Although the Minix real time clock keeps accurate time relative to the time Minix receives from the emulated BIOS when Minix is started, underneath Minix the Bochs emulation of the hardware clock is not accurate, and the time Bochs keeps will rapidly race ahead of the real time. A few experiments will show you the problem:

Dealing with the time-keeping problems: Perhaps a future release of Bochs will provide a way to keep the Bochs time in synchrony with real time, but for now we have to live with it. From the experiments above it should be clear that are a few things that should be avoided when using Minix on top of Bochs: In defense of Bochs, please remember that what appears to be a bug can be a feature in a different context. Emulators like Bochs are useful for debugging operating system code -- you may want to use it yourself this way for experimenting with modifications to Minix. Bochs does not use a hardware clock, it keeps track of time by counting cycles of the emulated CPU. This makes possible exact repetition of a sequence of instructions that are timing related. This can be very valuable when debugging, but the downside is difficulty in tracking real time.

Back to index

Running Minix-on-Bochs

After the first run and now with an understanding of the timekeeping problems you are ready to run Minix seriously. Start up Bochs by double-clicking on your minix.bxrc and press '=' as soon as the boot menu appears.

You may want to type man usage again. Some of the usage(8) man page is not relevant if you used the DOSMinix image to get started; all that stuff about installing is already done. As the page suggests for DOSMinix users, you should skip ahead to section 9 of the man page to see relevant material. One thing you will want to do is assign your emulated machine a name by editing /etc/hostname.file. Another change you'll want to make is to edit /etc/profile to specify your own timezone. Remember, to test whether changes in boot-time configuration work right shut down Bochs itself after halting Minix. If you reboot Minix without restarting Bochs Minix will get a very strange idea of the time and date.

Pay attention to what usage(8) says about working as root. Read the man page for adduser and make an account for yourself. The best way to log in is as an ordinary user. Then you can use su to make yourself bin to work on editing and compiling program files, or to make yourself root when and only when you must work as root to do system configuration. Also, note that root's home directory is the system root, and bin's home directory is the root of the source code directory tree. These are not good places to leave poetry, short stories, or other documents you may create while learning to use a text editor. Adduser will make a home directory for you to store your personal files in.

Another thing you will want to do is to learn to use one of the editors available, elle, elvis, and mined. Elle is a simple emacs clone, elvis is a vi clone, and mined is unique to Minix, but easy to learn and use. See the man pages. If you are not familiar with either of the standard Unix editors vi or emacs, mined will be the easiest one to use at first. [Some personal opinions: if you want to work in the Unix world you should become familiar with vi, even if you find you don't like it very much. If you already know emacs you may like elle, but rename or delete the .ellepro.b1 file in your home directory so it won't work like mined. If you want to use mined, use mined. But keep in mind that mined can not handle large files, so some day you'll be forced to learn one of the other editors if you are going to do serious work.]

Back to index

Adding external floppy disk access

There is an update available for Minix 2.0.4 that was not ready when the DOSMINIX.ZIP file for Minix 2.0.4 was prepared. To install it you will need some way to get some more files onto your Minix system. Even if you don't need to add an update, some way of importing and exporting data from Minix on Bochs will be necessary for most uses. Later we'll consider networking, but first we'll consider how to configure Minix running on Bochs to access floppy disks. Accessing CD-ROMs is similar, and is discussed in the next section.

Note that this section applies only to Bochs on Windows 2000, on Windows 98 access to the real (hardware) floppy drive is not supported. On Windows 98 access to floppy disks simulated by files is the only method supported.

Edit minix.bxrc to add this line:

    floppya: 1_44=a:, status=inserted
Now when you start Bochs and Minix again you'll be able to access the floppy disk drive known to Windows as A:. But there are some peculiar aspects to floppy disk access:

You will probably find, by the way, that accessing files on floppy disks from Minix on Bochs is painfully slow. (A command readall /dev/fd0 which takes slightly over 30 seconds on a standard Minix installation took almost 10 minutes on one of my Minix-on-Bochs test systems. Interestingly, there was also an interaction between reading the floppy disk and timekeeping, such that the Minix date command only recorded 2 minutes elapsed time during the readall run.) When you need to access entire disks, as described in the next paragraph, the time required can be excruciating. But for now you have to live with it. If you need to do a lot of data transfer into or out of Minix on Bochs you'll find using a network connection much more convenient.

Booting from floppy disk: You can boot into Minix on Bochs from a floppy disk. If a floppy is in the drive at the time you start Minix on Bochs, and you already have Minix installed, when the Minix boot menu appears press Esc and then type boot fd0. In a short while you'll see the boot menu from the floppy disk, press = to boot. If the disk was not in the drive you'll have to use the A: icon to get access to the disk. (You can also start a new installation by changing the boot: parameter value in minix.bxrc to "floppy"; this will be discussed in the section on alternate installation methods.)

Raw floppy disk access: When working with Minix sometimes you need to access a floppy disk as a raw block of data, with neither an MS-DOS nor a Minix file system. Examples of tasks that call for this kind of access are when testing a disk with the readall command, when writing out the MINIX.MNX and USR.MNX files with cat to make a boot disk for conventional installation of Minix from floppy disks, or when using the vol command to read in or write out a large file that is larger than the capacity of a single floppy disk. As above, if there was no disk in the drive when Bochs started or the previous disk was an MS-DOS disk, you'll have to use the Bochs A: icon dialogue to get the first disk recognized. With a command that accesses multiple disks (such as vol) you can then insert additional disks as requested by the program. This can be a very slow process, you'll be happy you don't have to do it often.

[Note: On one occasion, when I was testing reading in a file from multiple floppy disks using vol, when the program asked me to insert a new disk and press Enter, my key press wasn't interpreted as Enter -- instead a non-English character was echoed on the screen. In fact, no keypresses were interpreted correctly. I discovered after a certain amount of frustration that pressing Alt-F2 to switch to the second virtual console and then pressing Alt-F1 to switch back to the first virtual console got things working again. My hypothesis about what happened is that somehow the input queue for the console got corrupted and switching virtual consoles reset it.]

Back to index

Adding one additional line to the minix.bxrc file may be all you need to be able to access a CD-ROM. This worked on one of my systems:

    ata0-slave: type=cdrom, path=d:, status=inserted
This example is for a system on which the CD-ROM drive is the slave on the first IDE controller. But, an IDE CD-ROM drive can be in one of three positions on a PC-type system; it can be the slave on the first IDE controller or either the master or the slave on the second controller. An important point which is mentioned in the Bochs documentation but is easily overlooked is that the primary IDE channel is enabled by default, but the secondary channel is not. So if your CD-ROM drive is either the master or slave device on the secondary IDE, you need to add two lines to minix.bxrc; one to enable the interface and one to enable the drive, for example:
    ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
    ata1-master: type=cdrom, path=d:, status=inserted

Currently only the isoinfo/isodir/isoread family of commands exist for accessing CD-ROMs from Minix. There is no such thing as a Minix file system on a CD-ROM, and CD-ROMs thus cannot be mounted onto a Minix file system. CDs work somewhat like DOS-formatted floppies, but the user interaction is easier. If a CD is in the drive when Bochs and Minix start up it can be accessed immediately after Minix starts up. If there is no CD in the drive at startup, the Bochs CD icon (third from left at the top of the Bochs guest OS window) will show a large X. You just have to insert a CD-ROM and click on the icon to enable access, there is no user dialogue with this icon. Clicking on the icon when a CD is already accessible will eject it, again with no further interaction.

As with floppy disks, reading a CD-ROM is not very fast under Bochs. In one test I ran it took about 8 minutes to read a 3.4 MByte file from a CD-ROM with Minix on Bochs and about 10 seconds to read the same file with Minix running directly on the hardware on the same system.

Unlike the case of floppy disks, which are not supported by Bochs on Windows 95 and 98, access to CD-ROMs should work on all Win32 platforms. I've tested it successfully on both Windows 98 and Windows 2000.

Back to index

Updating the DOSMinix image

Now that you can read from a floppy disk you can update your Minix image. You should do this before recompiling Minix. At the time of writing there is already a set of source code updates for Minix 2.0.4 available as src/FIX.TAZ on the Minix distribution sites. It is possible there will be other updates available by the time you read this. Because packaging the DOSMINIX.ZIP file is a big job, it generally won't be revised between Minix releases.

If you don't have another Minix system available you'll probably download patches and updates with Windows. Copy the downloaded file to an MS-DOS formatted floppy disk, and after starting Minix on Bochs you can copy the files you need to your Minix system using mtools. The /usr/tmp directory is usually a good place to copy to:

    mtools copy /dev/fd0:/FIX.TAZ /usr/tmp

Usually official source file packages or patches will be archived so they will be unpacked into the proper directories in the source tree if you make the /usr directory the default directory and unpack the archive there. To test the paths stored into FIX.TAZ use tar with the 't' (table) option to generate a table of contents of the tar archive.

    zcat < /usr/tmp/FIX.TAZ | tar tvfp -
In this case you will see:
    src/kernel/rtl8139.c 0164 tape blocks
    src/kernel/pci_table.c 021 tape blocks
    src/kernel/pci.c 071 tape blocks
    /tmp/DONE 0 tape blocks
So if you change to /usr and extract the archive files using tar with the 'x' (extract) option your source tree will be updated.
    cd /usr
    zcat < /usr/tmp/FIX.TAZ | tar xvfp -

Keeping track of updates: I like to be able to keep track of updates and sometimes I may want to undo an update. An easy way to mark that an update has been added to a source directory is to rename the original files in a distinctive way before before adding new files or to make a copy of the original files with a new name before applying a patch. I usually add a suffix to the name of the original file that indicates its origin -- for instance, for the FIX.TAZ package I renamed the pci.c that was part of the original Minix 2.0.4 distribution as pci.c204.

Back to index

Networking Minix-on-Bochs

If the host computer on which you are running Bochs has a network interface you can have a guest operating system share that interface. When this is set up correctly the host and the guest have distinct identities on the network. They can even connect to each other.

The Windows version of Bochs uses library routines from a package called WinPCap to capture host system packets so they can be presented to the guest system via the simulated ethernet interface. WinPCap support is also used by a utility called niclist to extract information needed in configuring Bochs for accessing the real ethernet card. WinPCap is available from http://winpcap.polito.it. You can read more about it on that site before you download it. It is not a large program and it is easy to install. One caveat, though: at the time of writing, only an older version, 2.3, works correctly with Bochs with no fuss at all. Both WinPCap and Bochs are constantly being debugged and improved, so please check the Minix-Bochs-WinPCap page for more and perhaps newer information.

Before getting deeper into networking, here's another caveat: I have only successfully tested this on host machines with ethernet connections, and only with a limited number of different ethernet cards (although every ethernet card I've tried has worked well). I don't know if this will work with home broadband connections (cable or DSL) or with a modem through the Windows Dialup Adapter. In my own home I have ethernet connections from the computers on which I have experimented with Minix on Bochs to a hub, and through this I can connect to my DSL modem.

I did not have success making external connections by sharing an 802.11b wireless connection with a Minix guest on Bochs on a Windows 2000 laptop. Although network support appeared to initialize exactly the same as with an ethernet connection, external nodes were unreachable over the network. However, the network-enabled Minix-on-Bochs was able to be connected to by telnet and ftp from the Windows host itself, a useful feature.

The Minix system provided as /minix/2.0.4 with the DOSMinix disk image does not have network support compiled into the kernel. The quick and dirty way to get a networked kernel is to fetch the NET.TAZ file from the 2.0.4/i386 directory on your Minix download site, copy it to a DOS-formatted floppy disk, and then use the floppy to transfer it to your Minix on Bochs system with mtools. The /usr/tmp directory is a good place to put it. Then rename the existing Minix system file /minix/2.0.4 so it won't be overwritten (I suggest calling it 2.0.4nonet). Make / your working directory and use zcat and tar to extract minix/2.0.4.


    mtools copy /dev/fd0:/NET.TAZ /usr/tmp
    mv /minix/2.0.4 /minix/2.0.4nonet
    cd /
    zcat < /usr/tmp/NET.TAZ | tar xvfp - minix/2.0.4
It turns out in this case that the networked 2.0.4 system is newer than the original one, so it will be the one that will be booted when you start Minix the next time. If you want to be sure, or you want to be able to select either image, you can modify the boot parameters to add a second choice to the boot menu. If you take the time to do this by using ESC at boot time Minix will receive an advanced time-of-day from Bochs when it starts, so it is better to use edparams and modify the boot parameters while Minix is running.

Of course, a better way to get a Minix kernel that supports networking is to recompile a new Minix system configured for your needs. Login as bin (or use su to change your identity to bin). Edit /usr/include/minix/config.h to turn on ethernet support. [* See hint below.] Set ENABLE_DP8390 to 1 and be sure NE2000 is also 1. The other ethernet-related settings in config.h can be set to 0 -- regardless of the type of ethernet interface the host computer has, to the guest OS on Bochs it looks like an NE2000. If you will want to connect remotely to your Minix system with telnet or rlogin, also change NR_PTYS to something more than 0. Then "cd /usr/src/tools" and type "make hdboot". This will install a new system in /minix; since it is the newest one it is the one that will be activated when Minix is started the next time.

[* Hint: In the course of working with Minix you'll probably edit /usr/include/minix/config.h many times. I like to make a reference copy of the original version -- for Minix 2.0.4 I name it config.h204 -- so I can quickly use the diff command to see the differences between the original and the current version.]

You have to make a few other changes before you can boot with a networked Minix. Change /etc/inet.conf to look like this:

    eth0 DP8390 0 { default; };
Modify the boot parameters to include:
    DPETH0=300:3
    servers=inet
(again, this is best done using edparams while Minix is running, if you do it at boot time Minix time will be off).

If you have a DHCP server on your local network the default Minix bootup procedure will get you an IP address using DHCP. (Ask the local system manager, you may have to provide your ethernet address and wait for the DHCP server to be configured. And see below, your ethernet address when using Bochs is not the same as that of the host computer.) If you do not have a DHCP server or you don't want to use one, you need to provide a /etc/rc.net file to do this for you. As an example, if your IP address is to be 192.168.1.75 and the local gateway on your network is 192.168.1.1, here is a simple /etc/rc.net:

    ifconfig -h 192.168.1.75 -n 255.255.255.0
    add_route -g 192.168.1.1 -m 25
    daemonize nonamed
    daemonize tcpd  telnet in.telnetd
    daemonize tcpd  ftp in.ftpd
(This example only starts two services, telnet and ftp. See /usr/etc/rc for examples of starting other services.)

The above completes the configuration you must do within Minix to support networking. There is one more thing needed, an addition to your minix.bxrc that tells Bochs how to connect to the real ethernet adapter in the host computer. To find the values to put into minix.bxrc you need to use the Windows utility program niclist.exe which is in the main Bochs 2.1.1 directory. Niclist uses the WinPCap libraries described earlier. If you haven't already installed WinPCap 2.3, you need it now.

Once WinPCap is installed you can run niclist.exe. It is a command line program, and I suggest opening a Windows command line window by typing "cmd" in the Windows Start: Run dialogue, then running "niclist > niclist.out" to capture the output to a file. This will make it easy to paste the parts of the output you need into your minix.bxrc. Niclist normally just displays to the screen and finishes with a "Press any key to continue" message to allow its output to be read, so when you redirect its output you'll need to press Enter to force it to exit.

On one of my test systems niclist.out looks like this:

1: Intel DC21041 PCI Ethernet Adapter
     Device: \Device\Packet_{C6D40CF4-FCDD-4587-B3AC-B64E49F9E4EF}
2: VMware Virtual Ethernet Adapter
     Device: \Device\Packet_{5121F245-5B89-4CE8-82BB-87BEA8448574}

Example config for bochsrc:
ne2k: ioaddr=0x300, irq=3, mac=b0:c4:20:00:00:00, ethmod=win32, ethdev=\Device\Packet_{C6D40CF4-FCDD-4587-B3AC-B64E49F9E4EF}

Press any key to continue
Note that the "Example config for bochsrc" line is a very long line, but your web browser may wrap what you see to a second line. You'll need to paste it as a single long line into your minix.bxrc. Note also that on my system two ethernet interfaces are detected, but one is a virtual one for VMWare. In other cases you may see NdisWan adapters or other virtual adapters listed. One of these may be suggested as the ethdev to use in your minix.bxrc. Don't believe this. The ethdev specification you enter in your minix.bxrc must be one that corresponds to a real physical ethernet card.

By the way, if you want to network the DLX Linux demo guest OS supplied with Bochs (and I recommend that you do this) you need to enter an ne2k: parameter line in the bochsrc.bxrc file in the dlxlinux directory. The format is the same for every guest system. If you want to run more than one emulated system on your network at the same time you will need to give them different ethernet addresses to use. However, Bochs will always suggest the same ethernet address. On my test system (host IP address 192.169.1.95) I chose ethernet addresses 42:00:c0:a9:01:5f and 42:01:c0:a9:01:5f for the Linux and Minix emulated systems. The c0:a9:01:5f part is 192.169.1.95 in hexadecimal. I followed a procedure suggested by Kees Bot to generate these addresses. This is explained on the choosing an ethernet address page on this site.

Ethernet errors: If you have configured Bochs and Minix as described above Minix should start up normally, and should report finding an NE2000 ethernet card at 300:3. Then you should see it report that it is starting network daemons. But at some point in the startup sequence (as soon as Minix tries to send an ethernet packet) you will probably see a dialogue box that looks like this:

              +-------------------------------------------+
              |PANIC                                   |X||
              +-------------------------------------------+
              |  Device  [NE2K]                           |
              |  Message CR write - tx start, dev in reset|
              |                                           |
              |                                +--------+ |
              |  Continue                      |   OK   | |
              |  Continue and don't ask again  +--------+ |
              |  Kill simulation               +--------+ |
              |  Abort (dump core)             | Cancel | |
              |                                +--------+ |
              +-------------------------------------------+
I have seen this on every Windows 98 and Windows 2000 system I have tested but it seems harmless. So, don't panic! Highlight the "Continue and don't ask again" choice and click OK. If you press F5 from the console to see ethernet statistics you will see equal numbers in the packetT and transDef fields. I believe this means that there is some kind of timing problem in the interface between Minix and Bochs and each attempt to send a packet requires a retry. Each such event is also recorded in the bochsout.txt log file, but you can't view that file until you stop Bochs. These errors probably affect performance, but I haven't tried to measure an effect. In casual use with telnet and transferring small files by ftp I haven't noticed any degradation. I have not seen such errors with networked DLX Linux on Bochs.

See Updates for a patch to Minix ethernet code that fixes this.

Back to index

Using virtual floppy and CD-ROM drives

You can also use disk image files as virtual floppy disks. For instance, copy the standard boot floppy images for Minix, ROOT.MNX and USR.MNX to your Bochs-2.1.1\minix204 directory and modify the minix.bxrc file to replace these lines:

    boot: disk
    ...
    floppya: 1_44=a:, status=inserted
with these lines:
    boot: floppy
    ...
    floppya: 1_44=ROOT.MNX, status=inserted
Now when you start Bochs it will boot from the ROOT.MNX image. When it asks for the disk to mount as /usr you can do a virtual disk swap as follows: Now you can fill in fd0 as the disk to mount and press Enter. One possible pitfall: be sure the USR.MNX file is not marked read-only by Minix, which it may be if you have copied it from a CD-ROM. The Minix startup script /etc/rc, will complain vigorously if you try to mount a read-only floppy disk.

Of course, you could also have set a floppyb: line in your minix.bxrc with USR.MNX specified, but I wanted to illustrate that you can change virtual floppies on the fly. You can also transfer files between Minix and a virtual MS-DOS floppy. Windows by itself can't create or read such a virtual disk, but see the note below about DiskExplorer. Or you can use a Minix (or other Unix-like system) to read into a virtual disk file from real floppy disk or to write a virtual disk file to a real disk.

Some additional notes about virtual disks:

Virtual CD-ROMs: As of this writing I haven't tested access to virtual CD-ROMs, but I presume an ISO image can be used similarly to a floppy disk image file.

Back to index

Alternative installation methods

If you want to install a customized Minix system, or one for which a DOSMinix archive is not available, you can install directly into a simulated hard disk. The previous section suggests how to boot into Bochs using ROOT.MNX and USR.MNX image files. All you need is a simulated hard disk to install to.

Making the virtual hard disk: This is easy. Here are three ways to do it:

Installing from floppy disks: Using the ROOT.MNX disk image as a virtual boot disk and then mounting the USR.MNX disk image has already been described. This is identical to the start of the "standard" Minix installation procedure described in the usage(8) man page, except for using virtual floppy disks. At this point you can use either the setup script or the manual procedure described in usage(8).

When it comes to adding programs and source files to /usr you can use a set of real floppy disks, onto which you have previously copied the USR.TAZ, SYS.TAZ, and CMD.TAZ files as in a standard installation. This will be annoying because of the slowness of the floppy disk interface. Also, this method is not available if your host system is Windows 98, which supports access only to virtual floppy disks, not to real floppies. An easier way is to make these files into virtual disks.

Making virtual disks for loading the large .TAZ files is easy if you have another Unix-like system available on which you can run the dd command. All you need to do is chop each file into chunks of a size no more than the size of the emulated floppy disk specified in minix.bxrc. For instance, the size of USR.TAZ as provided with Minix release 2.0.4 is 4098899 bytes, which will fit on three 1.44M virtual disks. Use dd like this:

    dd if=USR.TAZ of=systaz1.img bs=512 count=2880
    dd if=USR.TAZ of=systaz2.img bs=512 count=2880 skip=2880 
    dd if=USR.TAZ of=systaz3.img bs=512 count=2880 skip=5760
With these files in the Bochs-2.1.1/minix204 directory, you can run setup /usr as you would to install onto a hard disk from real floppy disks. When asked to insert the first disk, use the Bochs A: button to simulate insertion of a floppy disk using systaz1.img. Each time the program tells you to change disks use the A: button again twice: clear the "Inserted" checkbox to signal ejection of the first disk, then click the A: button again to simulate insertion of of the second disk using systaz2.img. If your image files are named with the ".img" suffix the Browse button in the dialogue will list available virtual disks.

To do a full installation you can make a set of virtual 1.44 MByte floppies for the other archives, SYS.TAZ and CMD.TAZ and install them in the same way, using setup /usr.

You can read into Minix any file that is smaller than 1.44 MBytes by treating it as a virtual disk. This makes it easy to add the contents of NET.TAZ if you want to get a quick start with networking, or of FIX.TAZ, which contains some replacement source files. Bochs also has support for 2.88 MByte floppies, and in some cases declaring one of your disk drives to be a 2.88 MByte drive will simplify things -- for instance, currently the SYS.TAZ archive could be read in as a single simulated disk if Bochs expects one of your drives to be capable of handling a 2.88 MByte disk, and USR.TAZ and CMD.TAZ would require only two virtual disks each in this case. Although your hardware may only have one physical floppy drive, you could configure Bochs and Minix to recognize a B: drive using a virtual drive.

Some suggestions from Kees Bot on using virtual disks for facilitating Minix installation can be found on the Fun with Virtual Disks page.

Installation of Minix on Bochs from CD-ROM: Bochs can boot a guest operating system from a CD-ROM. Assuming you have the minix.bxrc configured to recognize a CD-ROM you just need to change the boot entry:

    boot: cdrom
I have tested this with the bootable Minix 2.0.3 CD-ROM package developed by Alexander Korzynski and his colleagues, described at http://studia.elka.pw.edu.pl/prog/minix (and also here at http://minix1.bio.umass.edu/faq/minixcd08.html.)

This package is intended for classroom use to boot a complete Minix system onto a 32 MByte RAM disk, but once the system has started (and it takes a while to read the complete system in from a CD-ROM under Bochs) you can then use Minix on the RAM disk on Bochs or you can partition a virtual hard disk and install Minix on it. This might be the easiest way to install Minix on Bochs on a Windows 98 system that is not on a network. Even though the Korzynski et al package installs Minix 2.0.3 you can easily burn a custom CD-ROM that also has a complete Minix 2.0.4 (or later) installation file set in an additional directory, and use these files for the installation on a virtual hard disk. .

Back to index

Making a run.bat and a Minix-on-Bochs shortcut

You can run Minix on Bochs by navigating to the Bochs-2.1.1/minix204 directory and double-clicking on minix.bxrc, but it's more elegant to have a shortcut on the desktop and/or the Start menu. Here's how to do it:

  1. Make a run.bat file to start Minix-on-Bochs. My run.bat looks like this:
        rem run.bat for Minix 2.0.4 on Bochs 2.1.1 on W2K
        cd "C:\Program Files\Bochs-2.1.1\minix204"
        ..\bochs -q -f minix.bxrc
    
    The first non-commented line changes to the correct directory and the next line starts Bochs using the correct Bochsrc file. The -q means quick start, without interactive setting of options. (There is a run.bat in the Bochs-2.1.1/dlxlinux directory if you want to see another model).

  2. Make a shortcut on the desktop:

Back to index

Printing and using serial ports

The Bochs emulator can provide access to parallel and serial ports for a guest operating system. Adding lines like

    parport1: enabled=1, file="lpt1:"
    com1: enabled=1, dev=com1:
should enable access to the printer port and the first serial port, according to the documentation in bochsrc-sample.txt. I haven't tried either of these yet, I don't have any serial or parallel port peripherals on any of the Windows computers where I have experimented with Bochs.

The parport1 file parameter can also be a filename, in which case Minix printer output can be appended to a file in the Windows host directory. But, the default Minix configuration does not have a printer driver compiled into the kernel, so compling a new system and additional configuration (such as adding an /etc/printcap file) is necessary. So although using printing to a file seems like a possible way to transfer Minix output to the Windows host, setting it up is beyond the scope of this article -- but see the next paragraph.

Quick and dirty network printing: There is a way to print over the network, and it works with a networked Minix on Bochs as well as on a conventional networked Minix installation. Because I have several computers in my home office I have one of them, a PC named tomato running Linux, set up as a print server. I defined a two line script which I call rlpr:

    #!/bin/sh
    rsh tomato lpr
With rlpr in the path on a Minix system, and with an entry for each Minix system from which I want to print in /etc/hosts.equiv on the print server, I can pipe any text I want to print to rlpr to be printed on the default printer on the print server.

Back to index

Updates (additions and corrections since March 2004 posting)

Back to index

Acknowledgements

Kees Bot offered suggestions and answered several questions about using Minix on Bochs. Rob van der Leek posted to comp.os.minix an article (available on this site) similar to this one about using Minix on Bochs 2.1 on a Linux platform. Other people, some of whom are referred to in other articles referenced in the non-Intel platforms and virtual or emulated hardware pages on this site, have also written about their experiences using various Minix versions on various Bochs versions. I've been helped by all of these in writing the current article.

Back to index
Top of page


[HOME] [HINTS/FAQ] [MINIX DOWNLOADS] [CONTRIB SOFTWARE]
[NET SOFTWARE] [MINIX-VMD] [TEXTBOOK] [LINKS]

All material on this site not otherwise attributed is copyright ©1994-2004 Albert S. Woodhull
Click here for information on copying and other use.
Mail comments on this page to: Al Woodhull <awoodhull@hampshire.edu>
Viewable With Any Browser    [Valid HTML 4.0!]