4.2. bochsrc

Bochs uses a configuration file called a bochsrc to know where to look for disk images, how the Bochs emulation layer should work, etc. When you first start up Bochs, it looks around for its configuration file, and parses it. Here are a few lines from a sample file:

  diskc: file="30M.sample", cyl=615, heads=6, spt=17
  boot: c
The format is very strict, so be sure to put the right number of spaces and use lowercase letters. As you can see, most lines have a keyword telling what is being configured, followed by a colon, followed by a few variable=value pairs, separated by commas. For very simple options, sometimes just a single value is needed. The source and binary distributions come with a sample bochsrc, so you can just copy the sample file and edit the settings you need to change.

Starting with version 1.3, you can use environment variables in the bochsrc file, for example:

  diskc: file="$IMAGES/30M.sample", cyl=615, heads=6, spt=17
  boot: c
Starting with version 2.0, two environment variables have a built-in default value which is set at compile time. $BXSHARE points to the "share" directory which is typically /usr/local/share/bochs on UNIX machines. See the $(sharedir) variable in the Makefile for the exact value. $BXSHARE is used by disk images to locate the directory where the BIOS images and keymaps can be found. If $BXSHARE is not defined, Bochs will supply the default value. Also, $LTDL_LIBRARY_PATH points to a list of directories (separated by colons if more than one) to search in for Bochs plugins. A compile-time default is provided if this variable is not defined by the user. On Win32 and MacOSX, the default for the share directory is determined by a platform-specific specific algorithm. On Win32, we use the registry to see what directory Bochs and its support files were installed in. On MacOSX, the share directory is the directory where the application is located.

The section below lists all the supported bochsrc options.

4.2.1. romimage

Examples:

  romimage: file=bios/BIOS-bochs-latest, address=0xf0000
The ROM BIOS controls what the PC does when it first powers on. Normally, you can use a precompiled BIOS in the source or binary distribution called BIOS-bochs-latest. The ROM BIOS is usually loaded starting at address 0xf0000, and it is exactly 64k long.

4.2.2. megs

Examples:

  megs: 32
  megs: 128
Set this to the default number of megabytes of memory you want to emulate. The default is 32, since most operating systems won't need more than that.

4.2.3. optromimage1, optromimage2, optromimage3 or optromimage4

Example:

   optromimage1: file=optionalrom.bin, address=0xd0000
This enables Bochs to load up to 4 optional ROM images.

Be sure to use a read-only area, typically between C8000 and EFFFF. These optional ROM images should not overwrite the rombios (located at F0000-FFFFF) and the videobios (located at C0000-C7FFF).

Those ROM images will be initialized by the bios if they contain the right signature (0x55AA).

It can also be a convenient way to upload some arbitary code/data in the simulation, that can be retrieved by the boot loader

4.2.4. vgaromimage

Examples:

  vgaromimage: bios/VGABIOS-elpin-2.40
  vgaromimage: bios/VGABIOS-lgpl-latest
You also need to load a VGA ROM BIOS at 0xC0000.

A VGA BIOS file from Elpin Systems, Inc. is provided in the source and binary distributions.

A free LGPL'd VGA BIOS is also provided in the source and binary distributions.

4.2.5. floppya/floppyb

Examples:

2.88M 3.5" Floppy:
  floppya: 2_88=a:, status=inserted
1.44M 3.5" Floppy:
  floppya: 1_44=floppya.img, status=inserted
1.2M  5.25" Floppy:
  floppyb: 1_2=/dev/fd0, status=inserted
720K  3.5" Floppy:
  floppya: 720k=/usr/local/bochs/images/win95.img, status=inserted
Floppya is the first drive, and floppyb is the second drive. If you're booting from a floppy, floppya should point to a bootable disk. To read from a disk image, write the name of the image file. In many operating systems Bochs can read directly from a raw floppy drive. For raw disk access, use the device name (Unix systems) or the drive letter and a colon (Windows systems). You can set the initial status of the media to ejected or inserted. Usually you will want to use inserted. In fact Bryce can't think of any reason to ever write ejected in your bochsrc.

4.2.6. ata0, ata1, ata2, ata3

Examples:

ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e8, irq=11
ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x368, irq=9
These options enables up to 4 ata channels. For each channel the two base io addresses and the irq must be specified. ata0 is enabled by default, with ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14

4.2.7. ata0-master, ata0-slave, ata1-*, ata2-*, ata3-*

Examples:

ata0-master: type=disk, path=10M.img, cylinders=306, heads=4, spt=17, translation=none
ata1-master: type=disk, path=2GB.img, cylinders=5242, heads=16, spt=50, translation=echs
ata1-slave:  type=disk, path=3GB.img, cylinders=6541, heads=16, spt=63, translation=auto
ata2-master: type=disk, path=7GB.img, cylinders=14563, heads=16, spt=63, translation=lba
ata2-slave:  type=cdrom, path=iso.sample, status=inserted

This defines the type and characteristics of all attached ata devices:

You have to tell the type of the attached device. For Bochs version2.0, it can by disk or cdrom

You have to point the "path" at a hard disk image file, cdrom iso file, or physical cdrom device. To create a hard disk image, try running bximage. It will help you choose the size and then suggest a line that works with it.

In UNIX it is possible to use a raw device as a Bochs hard disk, but WE DON'T RECOMMEND IT for safety reasons.

The path, cylinders, heads, and spt are mandatory for type=disk

The path is mandatory for type=cdrom

The disk translation scheme (implemented in legacy int13 bios functions, and used by older operating systems like MS-DOS), can be defined as:

4.2.8. diskc/diskd

The diskc and diskd options are deprecated. Use "ataX-*: type=disk,..." options instead.

Examples:

  diskc: file=10M.img, cyl=306, heads=4, spt=17
  diskc: file=112M.img, cyl=900, heads=15, spt=17
  diskd: file=483.img, cyl=1024, heads=15, spt=63
The diskc/diskd lines tell Bochs what disk image file to use as the constants of the emulated hard drive, and what geometry it should have. Diskc is the first hard drive, and diskd is the second hard drive. Using a raw hard drive is possible under on unix but WE DON'T RECOMMEND IT for safety reasons. The file should be a disk image file, which must be exactly 512*cyl*heads*spt bytes long. The geometry settings are cylinder (cyl), heads, and sectors per track (spt). If you use bximage to create the image, it will give you the required cyl, head, and spt information.

Note

You cannot use both diskd and cdromd together.

4.2.9. cdromd

The cdromd option is deprecated. Use "ataX-*: type=cdrom,..." option instead.

Examples:

  cdromd: dev=/dev/cdrom, status=inserted         (Unix only)
  cdromd: dev=e:, status=inserted                 (Windows only)
  cdromd: dev=cdromimage.iso, status=inserted
The cdromd line tells Bochs to emulate a CD-ROM device. You cannot have both a diskd and a cdromd, and there is no cdromc option.

Note

You cannot use both diskd and cdromd together.

4.2.10. newharddrivesupport

Examples:

  newharddrivesupport: enabled=1
This setting enables support for large hard disks, better CD recognition, and various other useful functions. You can set it to "enabled=1" (on) or "enabled=0" (off). It is recommended that this setting is left on unless you are having trouble with it.

4.2.11. boot

Examples:

  boot: floppy
  boot: disk
  boot: cdrom
This defines your boot drive. You can either boot from 'floppy', 'disk' or 'cdrom'. 'c' and 'a' are also accepted for historical reasons.

4.2.12. floppy_bootsig_check

Example:

  floppy_bootsig_check: disabled=1
This disables the 0xaa55 signature check on boot floppies The check is enabled by default.

4.2.13. config_interface

The configuration interface is a series of menus or dialog boxes that allows you to edit all the settings that control Bochs's behavior. There are two choices of configuration interface: a text mode version called "textconfig" and a graphical version called "wx". The text mode version uses stdin/stdout and is always available. The graphical version is only compiled when you use "--with-wx" in the configure command. If you do not write a config_interface line, Bochs will choose a default for you (usually textconfig).

Note

wxWindows provides both a configuration interface and a display library. So if you use the "wx" configuration interface, you must also use the "wx" display library.

Examples:

  config_interface: textconfig
  config_interface: wx

4.2.14. display_library

The display library is the code that displays the Bochs VGA screen. Bochs has a selection of about 10 different display library implementations for different platforms. If you run configure with multiple --with-* options, the display_library command lets you choose which one you want to run with. If you do not write a display_library line, Bochs will choose a default for you.

Examples:

  display_library: x
  display_library: sdl

Note

wxWindows provides both a configuration interface and a display library. So if you use the "wx" configuration interface, you must also use the "wx" display library.

4.2.15. log

Examples:

  log: bochsout.txt
  log: /dev/tty               (unix only)
  log: /dev/null              (unix only)
Give the path of the log file you'd like Bochs debug and misc. verbage to be written to. If you really don't want it, make it /dev/null.

4.2.16. logprefix

Examples:

   logprefix: %t-%e-@%i-%d
   logprefix: %i%e%d
This handles the format of the string prepended to each log line. You may use those special tokens :
  %t : 11 decimal digits timer tick
  %i : 8 hexadecimal digits of cpu0 current eip
  %e : 1 character event type ('i'nfo, 'd'ebug, 'p'anic, 'e'rror)
  %d : 5 characters string of the device, between brackets
  

Default is %t%e%d

4.2.17. debug/info/error/panic

Examples:

  debug: action=ignore
  info: action=report
  error: action=report
  panic: action=ask
During simulation, Bochs encounters certain events that the user might want to know about. These events are divided into four levels of importance: debug, info, error, and panic. Debug messages are usually only useful when writing Bochs code or when trying to locate a problem. There may be thousands of debug messages per second, so be careful before turning them on. Info messages tell about interesting events that don't happen that frequently. Bochs produces an "error" message when it finds a condition that really shouldn't happen, but doesn't endanger the simulation. An example of an error might be if the emulated software produces an illegal disk command. Panic messages mean that Bochs cannot simulate correctly and should probably shut down. A panic can be a configuration problem (like a misspelled bochsrc line) or an emulation problem (like an unsupported video mode).

The debug, info, error, and panic lines in the bochsrc control what Bochs will do when it encounters each type of event. The allowed actions are: fatal (terminate bochs), ask (ask the user what to do), report (print information to the console or log file), or ignore (do nothing). The recommended settings are listed in the sample above.

Tip

The safest action for panics is "fatal" or "ask". If you are getting lots of panics and get tired of telling it to continue each time, you can try action=report instead. If you allow Bochs to continue after a panic, don't be surprised if you get strange behavior or crashes after a panic occurs. Please report panic messages to the bochs-developers mailing list unless it is just a configuration problem like "could not find hard drive image."

4.2.18. debugger_log

Examples:

  log: debugger.out
  log: /dev/null              (unix only)
  log: -
Give the path of the log file you'd like Bochs to log debugger output. If you really don't want it, make it '/dev/null', or '-'.

4.2.19. com1

Specifies the device to use as com1. This can be a real serial line, or a pty. To use a pty (under X/Unix), create two windows (xterms, usually). One of them will run bochs, and the other will act as com1. Find out the tty the com1 window using the `tty' command, and use that as the `dev' parameter. Then do `sleep 1000000' in the com1 window to keep the shell from messing with things, and run bochs in the other window. Serial I/O to com1 (port 0x3f8) will all go to the other window.

Examples:

com1: dev=/dev/ttyp9
com1: dev=/dev/cua0

4.2.20. parport1

This defines a parallel (printer) port. When turned on and an output file is defined emulated printer port sends characters printed by the guest OS into the output file. On some platforms a device filename can be used to send the data to the real parallel port (e.g. "/dev/lp0" on Linux, "lpt1" on win32 platforms).

Examples:

parport1: enabled=1, file="parport.out"
parport1: enabled=1, file="/dev/lp0"
parport1: enabled=0

4.2.21. sb16

Examples:

  sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, 
        loglevel=2, log=sb16.log, dmatimer=600000

Note

The example is wrapped onto several lines for formatting reasons, but it should all be on one line in the actual bochsrc file.

The sb16 line defines Sound Blaster 16 emulation. It can have several of the following properties. All properties are in the usual "property=value" format.

  • midi: The filename is where the midi data is sent. This can be a device or just a file if you want to record the midi data.

  • midimode:

       0 = No data should be output.
       1 = output to device (system dependent - midi denotes the device driver).
       2 = SMF file output, including headers.
       3 = Output the midi data stream to the file (no midi headers and no
           delta times, just command and data bytes).
       

  • wave: This is the device/file where wave output is stored.

  • wavemode:

       0 = no data
       1 = output to device (system dependent - wave denotes the device driver).
       2 = VOC file output, including headers.
       3 = Output the raw wave stream to the file.
       

  • log: The file to write the sb16 emulator messages to.

  • loglevel:

       0 = No log.
       1 = Only midi program and bank changes.
       2 = Severe errors.
       3 = All errors.
       4 = All errors plus all port accesses.
       5 = All errors and port accesses plus a lot of extra information.
       

  • dmatimer: Microseconds per second for a DMA cycle. Make it smaller to fix non-continuous sound. 750000 is usually a good value. This needs a reasonably correct setting for IPS (see below).

4.2.22. vga_update_interval

Examples:

  vga_update_interval: 250000
Video memory is scanned for updates and screen updated every so many virtual seconds. The default is 300000, about 3Hz. This is generally plenty. Keep in mind that you must tweak the 'ips:' directive to be as close to the number of emulated instructions-per-second your workstation can do, for this to be accurate.

4.2.23. keyboard_serial_delay

Example:

  keyboard_serial_delay: 200
Approximate time in microseconds that it takes one character to be transfered from the keyboard to controller over the serial path.

4.2.24. keyboard_paste_delay

Example:

  keyboard_paste_delay: 100000
Approximate time in microseconds between attempts to paste characters to the keyboard controller. This leaves time for the guest os to deal with the flow of characters. The ideal setting depends on how your operating system processes characters. The default of 100000 usec (.1 seconds) was chosen because it works consistently in Windows.

4.2.25. floppy_command_delay

Examples:

  floppy_command_delay: 50000
Time in microseconds to wait before completing some floppy commands such as read, write, seek, etc., which normally have a delay associated. This was once hardwired to 50000 but now you can adjust it.

4.2.26. ips

Examples:

  ips: 1000000
Emulated Instructions Per Second. This is the number of IPS that bochs is capable of running on your machine. You can recompile Bochs, using instructions included in config.h (in the source code), to find your workstation's capability.

IPS is used to calibrate many time-dependent events within the bochs simulation. For example, changing IPS affects the frequency of VGA updates, the duration of time before a key starts to autorepeat, and the measurement of BogoMips and other benchmarks. The table below lists some typical IPS settings for different machines[1].

4.2.27. pit

Examples:

  pit: realtime=0
  pit: realtime=1
The PIT is the programmable interval timer. Bochs's PIT model was written by Greg Alexander. It has a real-time option that tries to keep the PIT in sync with the host time. This feature is still experimental, but it may be useful if you want to prevent Bochs from running too fast, for example a DOS video game. Be aware that with the realtime pit option, your simulation will not be repeatable; this can a problem if you are debugging.

4.2.28. mouse

Examples:

  mouse: enabled=1
  mouse: enabled=0
This option prevents Bochs from creating mouse "events" unless a mouse is enabled. The hardware emulation itself is not disabled by this. You can turn the mouse on by setting enabled to 1, or turn it off by setting enabled to 0. Unless you have a particular reason for enabling the mouse by default, it is recommended that you leave it off. You can also toggle the mouse usage at runtime (middle mouse button on X11 and SDL, F12 on Win32).

4.2.29. private_colormap

Examples:

  private_colormap: enabled=1
Requests that the GUI create and use its own non-shared colormap. This colormap will be used when in the bochs window. If not enabled, a shared colormap scheme may be used. Once again, enabled=1 turns on this feature and 0 turns it off.

4.2.30. i440fxsupport

Examples:

  i440fxsupport: enabled=1
Enables limited i440fx PCI chipset support.

4.2.31. time0

Examples:

  time0: 938581955
Specifies the start (boot) time of the virtual machine. Use a time value as returned by the time(2) system call. Time equal to 1 is a special case which starts the virtual machine at the current time of the simulator host.

4.2.32. ne2k

The ne2k line configures an emulated NE2000-compatible Ethernet adapter, which allows the guest machine to communicate on the network. To disable the NE2000 just comment out the ne2k line.

Examples:

ne2k: ioaddr=0x280, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0
ne2k: ioaddr=0x280, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0
ne2k: ioaddr=0x280, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD
ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=tun0, script=./tunconfig

ioaddr, irc: You probably won't need to change ioaddr and irq, unless there
are IRQ conflicts.

mac: The MAC address MUST NOT match the address of any machine on the net.
Also, the first byte must be an even number (bit 0 set means a multicast
address), and you cannot use ff:ff:ff:ff:ff:ff because that's the broadcast
address.  For the ethertap module, you must use fe:fd:00:00:00:01.  There may
be other restrictions too.  To be safe, just use the b0:c4... address.

ethmod: The ethmod value defines which low level OS specific module to be 
used to access pysical ethernet interface. Current implemented values include :
 - fbsd : ethernet on freebsd and openbsd
 - linux : ethernet on linux
 - win32 : ethernet on win32
 - tap : ethernet through a linux tap interface
 - tuntap : ethernet through a linux tuntap interface

ethdev: The ethdev value is the name of the network interface on your host
platform.  On UNIX machines, you can get the name by running ifconfig.  On
Windows machines, you must run niclist to get the name of the ethdev.
Niclist source code is in misc/niclist.c and it is included in Windows 
binary releases.

script: The script value is optionnal, and is the name of a script that
is executed after bochs initialize the network interface. You can use
this script to configure this network interface, or enable masquerading.
This is mainly useful for the tun/tap devices that only exist during
Bochs execution. The network interface name is supplied to the script
as first parameter

4.2.33. keyboard_mapping

Examples:

  keyboard_mapping: enabled=0, map=
  keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map
This enables a remap of a physical localized keyboard to a virtualized U.S. keyboard, as the PC architecture expects. If enabled, the keymap file must be specified.

4.2.34. keyboard_type

Examples:

  keyboard_type: xt
  keyboard_type: at
  keyboard_type: mf
Type of keyboard returned by a "identify keyboard" command to the keyboard controller. It must be one of "xt", "at" or "mf". Defaults to "mf". It should be ok for almost everybody. A known exception is French macs, that do have a "at"-like keyboard.

4.2.35. user_shortcut

Examples:

  user_shortcut: keys=ctrlaltdel
  user_shortcut: keys=ctrlaltesc
This defines the keyboard shortcut to be sent when you press the "user" button in the headerbar. The shortcut string can be a combination of these key names: "alt", "ctrl", "del", "esc", "f1", "f4", "tab", "win". Up to 3 keys can be pressed at a time.

Notes

[1]

IPS measurements depend on OS and compiler configuration in addition to processor clock speed.