Tuesday, August 3, 2010

Setting Up Bochs

Start at the Beginning
Table of Contents

Bochs is, unfortunately, something of a bear to set up. I've done most of the hard work for you, but you'll still need to get involved a little.

Just like in a real computer, Bochs needs a hard disk. Because your computer is a real, physical thing, it has a real, physical hard disk. Because your Bochs "virtual machine" is a virtual thing, you'll need a virtual hard disk. This is a file on your (real) computer, a "hard disk image", that contains all of the stuctures of a real hard disk, plus all of your data.

I've created a virtual hard disk for you that contains a minimal installation of FreeDOS - the free implementation of DOS we'll be using - and DJGPP, the compiler we'll be using to take our source code and translates it into machine code that the computer can execute. Download it here. It's about 40MB.

First, extract 'c.img' from 'hdimg.zip' somewhere. Note - although 'c.img' is only around 40MB zipped up, it expands to around 1GB! That's because it's a 1GB virtual hard disk, of course. It's only so small zipped up because most of it is empty.

Next, put this Bochs configuration file into Bochs' directory. The Bochs default install directory is C:\Program Files\Bochs-2.4.5. If you had Bochs install Start Menu shortcuts like I recommended, there should be a shortcut to "Bochs 2.4.5 Folder" you can click on to find it.

Before we begin, you'll need to make a change to the configuration file - you'll need to tell Bochs where to find your hard disk image. Open the configuration file up in Notepad. If you're on Windows 7 or Windows Vista, you'll need to start Notepad in Administrative mode to do this. Right click on the Notepad shortcut in the start menu and click 'Run as administrator'.

Inside the configuration file, look for the line that says:

ata0-master: type=disk, path="C:\Users\Adam\c.img", mode=flat, cylinders=2080, heads=16, spt=63

You'll need to change the path here to point to where ever you extracted your hard disk image. So if you extracted it to C:\Documents and Settings\George\Desktop\c.img, change the line so that it reads:

ata0-master: type=disk, path="C:\Documents and Settings\George\Desktop\c.img", mode=flat, cylinders=2080, heads=16, spt=63

Save the configuration file and run Bochs. Click 'Start' and, if all went well, in a couple of seconds your brand new DOS computer should boot up! It should look something like this:



Previous

No comments:

Post a Comment