Installing Bochs

Bochs is an x86-emulator that can be installed on different platforms. Here I describe my experiences of installing Bochs on Linux and on MacOS Mountain Lion.

Ubuntu Linux

Installing Bochs on Ubuntu was simple. I did

sudo apt-get install bochs

Then I located the Bochs configuration file. It was found, and copied to the directory where I intended to run Bochs, as

cp /usr/local/share/doc/bochs/bochsrc-sample.txt bochsrc.txt

My goal was to simulate an x86-computer with a floppy-disc unit. Changes were therefore done, in the file bochsrc.txt. The changes can be seen from the diff-command

diff /usr/local/share/doc/bochs/bochsrc-sample.txt bochsrc.txt

as

387c387
< floppya: 1_44=/dev/fd0, status=inserted
---
> #floppya: 1_44=/dev/fd0, status=inserted
392c392
< #floppya: 1_44=a.img, status=inserted, write_protected=1
---
> floppya: 1_44=arch/x86_fd_target/a.img, status=inserted, write_protected=1
474c474
< ata0-master: type=disk, mode=flat, path="30M.sample"
---
> #ata0-master: type=disk, mode=flat, path="30M.sample"
494,495c494,495
< #boot: floppy
< boot: disk
---
> boot: floppy
> #boot: disk

Then I am ready to run Bochs, using the command

bochs -f arch/x86_fd_target/bochsrc.txt -q

resulting in a simulated PC screen, as

bochs hello

Linux

The Bochs project is found at http://bochs.sourceforge.net.

After reading information about the latest release, I navigated to the releases page. I then downloaded release 2.6 in source format, resulting in download of the file

bochs-2.6.tar.gz

I then unpacked the source and navigated to the newly created bochs source directory, as

tar zxvf bochs-2.6.tar.gz
cd bochs-2.6

Then the configure script shall be run. Since I was not root on the machine, I used a prefix to configure, indicating the directory where I wanted Bochs to be installed. The configure command used was

./configure --prefix=/nobackup/local/prog/bochs

Bochs was then built, using the command

make

and installed using the command

make install

Then I located the Bochs configuration file. It was found, and copied to the directory where I intended to run Bochs, as

cp /nobackup/local/prog/bochs/share/doc/bochs/bochsrc-sample.txt arch/x86_fd_target/bochsrc.txt

My goal was to simulate an x86-computer with a floppy-disc unit. Changes were therefore done, in the file bochsrc.txt. The changes can be seen from the diff-command

diff /nobackup/local/prog/bochs/share/doc/bochs/bochsrc-sample.txt arch/x86_fd_target/bochsrc.txt

as

190c190
< cpu: model=core2_penryn_t9600, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
---
> cpu: count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
415c415
< floppya: 1_44=/dev/fd0, status=inserted
---
> #floppya: 1_44=/dev/fd0, status=inserted
420c420
< #floppya: 1_44=a.img, status=inserted, write_protected=1
---
> floppya: 1_44=arch/x86_fd_target/a.img, status=inserted, write_protected=1
502c502
< ata0-master: type=disk, mode=flat, path="30M.sample"
---
> #ata0-master: type=disk, mode=flat, path="30M.sample"
522,523c522,523
< #boot: floppy
< boot: disk
---
> boot: floppy
> #boot: disk
636c636
< debug: action=ignore, pci=report # report BX_DEBUG from module 'pci'
---
> debug: action=ignore, # pci=report # report BX_DEBUG from module 'pci'

I also added the following changes

export PATH=/nobackup/local/prog/bochs/bin:$PATH
export BXSHARE=/nobackup/local/prog/bochs/share/bochs

to my setup script, where I also set up other environment variables.

Then I am ready to run Bochs, using the command

bochs -f arch/x86_fd_target/bochsrc.txt -q

resulting in a simulated PC screen as shown above.

Mac Mountain Lion

I navigated to the releases page. I then downloaded release 2.6 in source format, resulting in download of the file

bochs-2.6.tar.gz

I then unpacked the source and navigated to the newly created bochs source directory, as

tar zxvf bochs-2.6.tar.gz
cd bochs-2.6

The configure command used was

./configure --with-x11

The –with-x11 indicates that X11 shall be used. For this purpose I had installed XQuartz, as described by Apple in this support note.

Bochs was then built, using the command

make

and installed using the command

sudo make install

I used the same configuration file as described above for Ubuntu, and I could then run Bochs using the command

bochs -f arch/x86_fd_target/bochsrc.txt -q

resulting in a simulated PC screen, as shown above.

Advertisements

About Ola
Writer of fiction and non-fiction, published the suspense novel Prevention - creating Books with Views - with books on programming and embedded systems - http://my.bookbaby.com/book/prevention

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: