bochs on Raspberry Pi

This post is also available in: Chinese (Simplified) Russian Spanish Portuguese (Portugal) French Arabic German Japanese

< x86 on ARM >
I try to run DOS on Debian wheezy on Raspberry Pi.
( Windows95 is also possible, but it’s too slow )

< Install “bochs” >
Installing “bochs” is very easy.
Command line is as below.

root@myhost:~# apt-get install bochs bochs-x bochs-sdl bochs-svga

< Generate hard disk image >
Execute “bximage” on your Raspberry Pi.
I recommend to execute “bximage” as non-root user.
You should execute “bximage” as a user which use “bochs”.
It’s 2GB image sample.

$ bximage
========================================================================
                                bximage
                  Disk Image Creation Tool for Bochs
        $Id: bximage.c,v 1.34 2009/04/14 09:45:22 sshwarts Exp $
========================================================================
Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd]
What kind of image should I create?
Please type flat, sparse or growing. [flat]
Enter the hard disk size in megabytes, between 1 and 129023
[10] 
2048
I will create a ‘flat’ hard disk image with
  cyl=4161
  heads=16
  sectors per track=63
  total sectors=4194288
  total size=2047.99 megabytes
What should I name the image?
[c.img] 
msdoshdd.img
Writing: [] Done.
I wrote 2147475456 bytes to msdoshdd.img.
The following line should appear in your bochsrc:
  
ata0-master: type=disk, path=”msdoshdd.img”, mode=flat, cylinders=4161, heads=16, spt=63

“bximage” said to add line “
ata0-master: type=disk, path=”msdoshdd.img”, mode=flat, cylinders=4161, heads=16, spt=63” to “.bochsrc”.

< Generate “.bochsrc” for MS-DOS >
Go to your home directory.
I use “nano” to edit text files.

$ cd /home/username
$ nano .bochsrc

My “.bochsrc” is as below.

megs: 64
romimage: file=$BXSHARE/BIOS-bochs-latest
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
display_library: sdl
ata0-master: type=disk, path=/home/username/msdoshdd.img, mode=flat, cylinders=4161, heads=16, spt=63
ata0-slave: type=cdrom, path=/home/username/MS-DOS-6.22.iso, status=inserted
boot: cdrom, disk
#keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-us.map
log: bochsout.txt
clock: sync=realtime, time0=local

“MS-DOS-6.22.iso” is my MS-DOS bootable file. Please replace it to any iso bootable file you have. In my “.bochsrc”, mouse is unavailable. If you want to use mouse, please google about “How to edit bochsrc to use mouse”.

< Install VNC >
If you use HDMI display, you don’t need this step.
If you don’t use display, you need to install VNC server to remote X on Raspberry Pi.
Execute this command line as root.

root@myhost:~# apt-get install tightvncserver

Run this command line as a user which use “bochs”.

$ vncserver :1 -geometry 1024×768 -depth 24
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? 
n
New ‘X’ desktop is myhost:1

“:1″ means port “5901″.
“-geometry 1024×768″ means resolution.
“-depth 24″ means colors in bits.

< Execute bochs >
Please connect your VNC server on Raspberry Pi. ( or use “startx” with HDMI display )
And execute terminal. ( ex. LXTerminal )
Execute bochs on terminal.

$ bochs

Sometimes bochs ask you like this syntax.

A PANIC has occurred.  Do you want to:
  cont       – continue execution
  alwayscont – continue execution, and don’t ask again.
               This affects only PANIC events from device [MEM0 ]
  die        – stop execution now
  abort      – dump core
  debug      – hand control to gdb

I always answer “alwayscont”.

< To be honest >
I tried to install Windows95.
But it needs FD images of DOS and Windows3.1. ( My Windows95 is upgrade version )
It was troublesome for me.
So I changed my goal.