Saturday, July 3, 2010

Minix 3 and bochs (or Virtual Machines Make My Head Hurt) -- Part 1


The subtitle Virtual Machines Make My Head Hurt is a reference to the difficulty I have in determining which layer is doing what at any given time when I'm operating in a virtual machine environment.  If there is a failure somewhere I have to ask myself the questions:   is the failure on the guest operating system?  The host operating system?  Some incomplete interoperability between the two?  The hardware?  The application I'm running?

Well, failure isn't really the theme of this post, since I'm at the beginning of this particular phase of my Minix 3 installation, although thinking through how the different layers in virtual environments are working together still makes my head hurt.  So I'll slowly explain what I'm trying to do, and why.  Then I'll followup at the end of this post with exactly where I am and what I intend to do to move this aspect of the project along.

As I stated in an earlier post my long term goal is to get Minix 3 working on my Dell Inspiron 1545 laptop in every reasonable respect (including the network, the wireless, and the USB ports).  This is both a narrow and broad project.  Narrow in the sense that I'm focused on one particular system.  Broad in the sense that in order to do this I may have to learn about writing drivers for everything on the system.

How does this relate to virtual machinery?  After a couple of weeks of burning anything I needed from the outside world to a CD on my Ubuntu Linux system and moving it to the laptop, I discovered that it might be nice to ftp things I need onto a networked Minix 3 work area, evaluate and configure it in that environment, then when I deem it ready make a CD and move it onto the laptop.

This is where bochs comes in.  bochs is a free and open source x86 emulator.  With it I should be able to run Minix 3 in a virtual environment, including access to the network of the host environment, do any configuration or development needed on the virtual Minix 3, then move it to my Dell laptop for further testing.  If I'm reading the bochs documentation correctly I should also be able to do some of the necessary reverse engineering I'll need to do for my device drivers with the debug mode in bochs.

So a couple of days ago I installed bochs onto my Ubuntu Linux workstation, and attempted to use the  document Running Minix 3 on Bochs from the Minix 3 website to configure and run Minix 3 on bochs. I followed the instructions, and the attempt to run my Minix 3 boot image failed on the following error:

========================================================================
                       Bochs x86 Emulator 2.4.2
             Build from CVS snapshot on November 12, 2009
==============================
==========================================
00000000000i[     ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins'
00000000000i[     ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[     ] reading configuration from bochsrc.txt
00000000000p[     ] >>PANIC<< bochsrc.txt:9: directive 'ips' not understood
00000000000e[CTRL ] notify called, but no bxevent_callback function is registered
00000000000i[CTRL ] quit_sim called with exit code 1

I re-read the installation instructions, then went to the bochs home website on sourceforge and browsed the documentation there.  As far as I could tell at that time 'ips' was a legitimate directive in bochs, so I posted descriptions of the problem to both the Minix 3 google group, and to the bochs help forum.
Stanislav Shwartsman, one of the bochs developers, answered on the bochs help forum that the 'ips' directive was deprecated and could no longer be used, and suggested that I use the sample  bochsrc configuration file which comes with bochs as a basis to configure bochs for Minix 3 and that I then get the documentation updated.

So at this point my plan for the week is:

1) finish reading  the bochs documentation so that I can devise an appropriate bochsrc file.
2) get Minix running on bochs
3) Make  the configuration steps available so that the Minix 3 documentation can be updated (or just doing it myself if I have wiki editing privileges on the document).  
4)  If I've  understood the bochs documentation correctly I can  create a Minix 3 bochs image and make it available to other people via the bochs website.  I'd like to do that if possible.

I'll write a  followup post to describe how the plan went.

1 comment:

  1. you should take the line with ips (instructions per seconds) out and instead insert:

    cpu: count=1, ips=15000000, reset_on_triple_fault=1

    In blocksrc example Text-File you find the informations commented what you can use as parameters in the newer version.

    After this change, I was able to boot by Ubuntu LTS 10.04, but I still got some other errors! But you can try and tell how working with your Dell Laptop! I used and A58 Lenovo Boosize!

    ReplyDelete