Cooking with UNIX/Linux
Cooking with UNIX/Linux > Trying out Bochs

Trying out Bochs

BOCHS RECIPE by Frederik Dannemare

## BOCHS INSTALLATION
#
# Install relevant Bochs packages:
apt-get install bochs bochs-doc bochs-term bochs-x bochsbios vgabios xfonts-bochs


## GENERATE WINDOWS CD ISO IMAGE (USING DD) AND A DISK IMAGE (USING BXIMAGE)
#
# It is faster to do the installation from a harddisk ISO image, rather than from CD.
# Therefore, put your Windows CD into your drive and dd all content to an ISO image:
mkdir ~/win98
dd if=/dev/cdrom of=~/win98/win98.iso

# Now create the disk image to hold your Windows installation:
cd ~/win98
bximage [choose 'hd', 'flat', and an image name (e.g. 'win98.img') and size (e.g. '600')]

# When bximage has finished writing the new (empty) image file,
# the output values must be written to your ~/win98/.bochsrc file.
# My output from bximage looks like:
ata0-master: type=disk, path="win98.img", mode=flat, cylinders=1219, heads=16, spt=63


## .BOCHSRC CONFIGURATION FILE
#
# In my .bochsrc file (below), I have added the output values from bximage
# to the line beginning with 'diskc'.

########################################################
# ~/win98/.bochsrc
#
# Asign memory for Bochs. But make sure you will have enough
# memory left over for your Linux system.
megs: 64

# IPS (Emulated Instructions Per Second) is used to calibrate many time-dependent
# events within the Bochs simulation. If you have a fast (1+ Ghz) CPU
# set ips to 5 million during the first few installation steps.
ips: 5000000

vga_update_interval: 300000
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-da.map

# Location of ROM images.
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000
vgaromimage: /usr/share/vgabios/vgabios.bin

# Cylinder, heads, and spt info from bximage output
diskc: file="/home/frederik/win98/win98.img", cyl=1219, heads=16, spt=63

# Location of the Windows CD image (ISO image)
cdromd: dev=/home/frederik/win98/win98.iso, status=inserted

newharddrivesupport: enabled=1
boot: cdrom
log: bochs.log

# If you have problems pressing the Bochs buttons (Reset, Power, etc.)
# try disabling mouse support inside the Bochs session.
mouse: enabled=0

# End of .bochsrc
########################################################


## EXECUTE BOCHS TO PARTITION YOUR DISK IMAGE
#
# Fire up Bochs
cd ~/win98
bochs

# If Bochs panics with something like "Failed to open plex86 device.", don't worry.
# Simply continue with 'cont'.

# When presented with the 1st menu, choose:
# 2.  Boot From CD-ROM

# When presented with the 2nd menu, choose:
# 2.  Start computer with CD-ROM support.

# When presented with a DOS-prompt (A:\>), execute fdisk:
A:\>fdisk

# Say "Y" to large disk support.

# In fdisk, choose:
# 1. Create DOS partition or Logical DOS Drive
# 1.  Create Primary DOS Partition
# Say "Y" to use the maximum available size.

# Type "Esc" to exit FDISK.
# You should now be back at the DOS-prompt. Click on the Bochs "Power" button to exit.

## EXECUTE BOCHS TO FORMAT YOUR NEW PARTITION
#
# Fire up Bochs again, and choose '2' and '2' in the menus as last time.
# Let's get the drive formatted:
A:/>d:
D:/>cd win98
D:/WIN98>format c: /s

# Say "Y" to actually carry out the format command.
# No need to set a disk label.
# Exit Bochs and replace "ips: 5000000" with "ips: 1000000" in ~/win98/.bochsrc.
# Setting ips lower than 1 million may prevent you to strike a key fast enough
# in the Windows boot menus, if you have a really fast CPU. On the other hand,
# a higher ips value during installation, makes the whole process more slow.
# It's your call.


## EXECUTE BOCHS TO INSTALL WINDOWS
#
# Fire up Bochs yet again, and choose '2' and '2' in the menus as last time.
# Now it's time to start the Windows 98 installer:
A:\>d:
D:\>cd win98
D:\WIN98>setup

# Be patient, very patient. The installation easily takes several hours...