Bochs uses a configuration file called 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 (see Section 5.2), and parses it. Here are a few lines from a sample file:
ata0-master: type=disk, path="30M.sample", cylinders=615, heads=6, spt=17 boot: disk |
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.The syntax used for bochsrc can also be used as command line arguments for Bochs. If you have any spaces in your command line arguments, they should be enclosed in single quotes, for example:
bochs 'boot:floppy' 'floppya: 1_44=a.img, status=inserted' |
Starting with version 1.3, you can use environment variables in the bochsrc file, for example:
floppya: 1_44="$IMAGES/bootdisk.img", status=inserted boot: floppy |
Starting with version 2.0, you can can use #include in the bochsrc to read the configuration from other files. Now it is possible to put platform or installation defaults in a global config file (e.g. location of rom images). Put this on top of your config file if the global configuration is stored in /etc:
#include /etc/bochsrc |
The section below lists all the supported bochsrc options.
Examples:
megs: 32 megs: 128 |
Note: Due to limitations in the host OS, Bochs fails to allocated even 1024MB on most systems.
Example:
cpu: count=2, ips=10000000 |
count
Set the number of processors:cores per processor:threads per core when Bochs is compiled for SMP emulation. Bochs currently supports up to 8 processors. If Bochs is compiled without SMP support, it won't accept values different from 1. For more information on SMP see Section 8.8.
quantum
Maximum amount of instructions allowed to execute by processor before returning control to another cpu. This option exists only in Bochs binary compiled with SMP support.
reset-on-triple-fault
Reset the CPU when triple fault occur (highly recommended) rather than PANIC. Remember that if you are trying to continue after triple fault the simulation will be completely bogus !
ips
Emulated Instructions Per Second. This is the number of IPS that Bochs is
capable of running on your machine. You can recompile Bochs with
--enable-show-ips
option enabled, to find your workstation's capability.
Measured IPS value will then be logged into your log file
or in the status bar (if supported by the gui).
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].
Table 4-1. Example IPS Settings
Bochs | Speed | Machine/Compiler | Typical IPS |
---|---|---|---|
2.2.6 | 2.6Ghz | Intel Core 2 Duo with WinXP/g++ 3.4 | 21 to 25 million |
2.2.6 | 2.1Ghz | Athlon XP with Linux 2.6/g++ 3.4 | 12 to 15 million |
2.0.1 | 1.6Ghz | Intel P4 with Win2000/g++ 3.3 | 5 to 7 million |
1.4 | 650MHz | Athlon K-7 with Linux 2.4.x | 2 to 2.5 million |
1.4 | 400MHz | Pentium II with Linux 2.0.x | 1 to 1.8 million |
Examples:
romimage: file=bios/BIOS-bochs-latest, address=0xe0000 romimage: file=$BXSHARE/BIOS-bochs-legacy, address=0xf0000 romimage: file=mybios.bin, address=0xfff80000 romimage: file=mybios.bin |
Example:
optromimage1: file=optionalrom.bin, address=0xd0000 |
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 arbitrary code/data in the simulation, that can be retrieved by the boot loader
Examples:
vgaromimage: file=bios/VGABIOS-elpin-2.40 vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus |
A VGA BIOS from Elpin Systems, Inc. as well as a free LGPL'd VGA BIOS are provided in the source and binary distributions.
Note: Please check with the vga option to decide what VGA BIOS to use.
Examples:
vga: extension=cirrus vga: extension=vbe |
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 auto-detect: floppya: image=floppy.img, status=inserted |
Following floppy disk types are supported: 2_88, 1_44, 1_2, 720k, 360k, 320k, 180k, 160k, as well as "image" to let Bochs auto-detect the type of floppy disk (does only work with images, not with raw floppy drives).
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.
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=0x3e0, irq=11 ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x360, irq=9 |
Examples:
ata0-master: type=disk, path=10M.img, mode=flat, cylinders=306, heads=4, spt=17, translation=none ata1-master: type=disk, path=2GB.cow, mode=vmware3, cylinders=5242, heads=16, spt=50, translation=echs ata1-slave: type=disk, path=3GB.img, mode=sparse, cylinders=6541, heads=16, spt=63, translation=auto ata2-master: type=disk, path=7GB.img, mode=undoable, 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:
Table 4-2. ata devices configuration options
Option | Comments | Possible values |
---|---|---|
type | type of attached device | [disk | cdrom] |
path | path of the image | |
mode | image type, only valid for disks | [flat | concat | external | dll | sparse | vmware3 | vmware4 | undoable | growing | volatile ] |
cylinders | only valid for disks | |
heads | only valid for disks | |
spt | only valid for disks | |
status | only valid for cdroms | [inserted | ejected] |
biosdetect | type of biosdetection | [none | auto], only for disks on ata0 [cmos] |
translation | type of translation done by the BIOS (legacy int13), only for disks | [none | lba | large | rechs | auto] |
model | string returned by identify device ATA command |
You have to tell the type of the attached device. For Bochs 2.0 or later, it can be
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 (see Section 8.1). 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. In Windows, there is no easy way.
Disk geometry autodetection works with images created by bximage if CHS is set to 0/0/0 (cylinders are calculated using heads=16 and spt=63). For other hard disk images and modes the cylinders, heads, and spt are mandatory.
The disk translation scheme (implemented in legacy int13 BIOS functions, and used by older operating systems like MS-DOS), can be defined as:
none : no translation, for disks up to 528MB (1032192 sectors)
large : a standard bitshift algorithm, for disks up to 4.2GB (8257536 sectors)
rechs : a revised bitshift algorithm, using a 15 heads fake physical geometry, for disks up to 7.9GB (15482880 sectors). (don't use this unless you understand what you're doing)
lba : a standard lba-assisted algorithm, for disks up to 8.4GB (16450560 sectors)
auto : autoselection of best translation scheme. (it should be changed if system does not boot)
The mode option defines how the disk image is handled. Disks can be defined as:
flat : one file flat layout
concat : multiple files layout
external : developer's specific, through a C++ class
dll : developer's specific, through a DLL
sparse : stackable, commitable, rollbackable
vmware3 : vmware version 3 disk support
vmware4 : vmware version 4 disk support
undoable : flat file with commitable redolog
growing : growing file
volatile : flat file with volatile redolog
Default values are:
mode=flat, biosdetect=auto, translation=auto, model="Generic 1234" |
The biosdetect
option has currently no effect on the BIOS.
Note: Make sure the proper ata option is enabled when using a device on that ata channel.
Examples:
boot: floppy boot: cdrom, disk boot: network, disk boot: cdrom, floppy, disk |
Example:
floppy_bootsig_check: disabled=1 |
The configuration interface is a series of menus or dialog boxes that allows you to edit all the settings that control Bochs' 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 while the graphical version is only available when Bochs is compiled with wxWidgets support, see Section 3.4.12. If you do not use a config_interface line, Bochs will choose a default for you (usually textconfig).
Note: wxWidgets 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, see display_library option.
Examples:
config_interface: textconfig config_interface: wx |
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 option lets you choose which one you want to run with. If you do not use a display_library line, Bochs will choose a default for you.
Note: wxWidgets provides both a configuration interface and a display library. So if you use the "wx" display library, you must also use the "wx" configuration interface, see config_interface option.
Examples:
display_library: x display_library: sdl |
display_library: rfb, options="timeout=60" # time to wait for client display_library: sdl, options="fullscreen" # startup in fullscreen mode display_library: win32, options="legacyF12" # use F12 to toggle mouse display_library: win32, options="windebug" # use experimental debugger gui |
Table 4-3. display_library values
Option | Description |
---|---|
x | use X windows interface, cross platform |
win32 | use native win32 libraries |
carbon | use Carbon library (for MacOS X) |
beos | use native BeOS libraries |
macintosh | use MacOS pre-10 |
amigaos | use native AmigaOS libraries |
sdl | use SDL library, cross platform, details in Section 3.4.11 |
svga | use SVGALIB library for Linux, allows graphics without X windows |
term | text only, uses curses/ncurses library, cross platform |
rfb | provides an interface to AT&T's VNC viewer, cross platform, details in Section 3.4.10 |
wx | use wxWidgets library, cross platform, details in Section 3.4.12 |
nogui | no display at all |
Examples:
log: bochsout.txt log: - log: /dev/tty (Unix only) log: /dev/null (Unix only) log: nul (win32 only) |
Examples:
logprefix: %t-%e-@%i-%d logprefix: %i%e%d |
%t : 11 decimal digits timer tick %i : 8 hexadecimal digits of current cpu eip (ignored in SMP configuration) %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
Examples:
debug: action=ignore info: action=report error: action=report panic: action=ask |
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."
Examples:
debugger_log: debugger.out debugger_log: /dev/null (Unix only) debugger_log: - |
Examples:
com1: enabled=1, mode=null com1: enabled=1, mode=mouse com1: enabled=1, mode=term, dev=/dev/ttyp9 com2: enabled=1, mode=file, dev=serial.out com3: enabled=1, mode=raw, dev=com1 com3: enabled=1, mode=socket, dev=localhost:8888 |
When using the mode 'term', you can specify a 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 of 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.
Other serial modes are 'null' (no input/output), 'file' (output to a file specified as the 'dev' parameter), 'raw' (use the real serial port - under construction for win32), 'mouse' (standard serial mouse - requires mouse option setting 'type=serial' or 'type=serial_wheel') and 'socket' (connect a networking socket).
Examples:
parport1: enabled=1, file="parport.out" parport2: enabled=1, file="/dev/lp0" parport1: enabled=0 |
Example:
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.
midi: The filename is where the midi data is sent to. This can be a device or just a file if you want to record the midi data. On a Windows host this parameter is ignored when using output to the sound device.
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. On a Windows host this parameter is ignored when using output to the sound device.
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 = Resource changes, 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 the ips paramter of the cpu option. It is possible to adjust the dmatimer value at runtime.
Examples:
vga_update_interval: 40000 # default vga_update_interval: 250000 |
Example:
keyboard_serial_delay: 250 # default |
Example:
keyboard_paste_delay: 100000 # default |
Examples:
ips: 2000000 # default ips: 10000000 |
This defines the parameters of the clock inside Bochs:
sync
TO BE COMPLETED (see Greg's explanation in feature request #536329)
time0
Specifies the start (boot) time of the virtual machine. Use a time value as returned by the time(2) system call. If no time0 value is set or if time0 equal to 1 (special case) or if time0 equal 'local', the simulation will be started at the current local host time. If time0 equal to 2 (special case) or if time0 equal 'utc', the simulation will be started at the current utc time.
Syntax: clock: sync=[none|slowdown|realtime|both], time0=[timeValue|local|utc] Examples: clock: sync=none, time0=local # Now (localtime) clock: sync=slowdown, time0=315529200 # Tue Jan 1 00:00:00 1980 clock: sync=none, time0=631148400 # Mon Jan 1 00:00:00 1990 clock: sync=realtime, time0=938581955 # Wed Sep 29 07:12:35 1999 clock: sync=realtime, time0=946681200 # Sat Jan 1 00:00:00 2000 clock: sync=none, time0=1 # Now (localtime) clock: sync=none, time0=utc # Now (utc/gmt) Default value are sync=none, time0=local |
Examples:
mouse: enabled=1 mouse: enabled=1, type=imps2 mouse: enabled=1, type=serial mouse: enabled=0 |
With the mouse type option you can select the type of mouse to emulate. The default value is 'ps2'. The other choices are 'imps2' (wheel mouse on PS/2), 'serial', 'serial_wheel' and 'serial_msys' (one com port requires setting 'mode=mouse', see com option). To connect a mouse to an USB port, see the usb1 option (requires PCI and USB support).
Example:
private_colormap: enabled=1 |
enabled=1
turns on this feature and 0 turns it off.Examples:
i440fxsupport: enabled=1 # default if compiled with PCI support i440fxsupport: enabled=1, slot1=pcivga, slot2=ne2k |
Example:
pcidev: vendor=0xbabe, device=0x2bad |
vendor
and device
should contain the PCI vendor ID respectively the PCI
device ID of the host PCI device you want to map within Bochs.Note: The PCI device mapping is still in a very early stage of development and thus it is very experimental. This feature requires Linux as a host operating system.
Besides the pcidev
config line you will need to load
a pcidev kernel module within your Linux host OS. This kernel module is
located in the bochs/host/linux/pcidev/
directory.
Examples:
usb1: enabled=1, port1=mouse, port2=keypad usb1: enabled=1, port1=tablet, port2=disk:usbdisk.img |
With the portX option you can connect devices to the hub (currently supported: 'mouse', 'tablet', 'keypad' and 'disk'). If you connect the mouse or tablet to one of the ports, Bochs forwards the mouse movement data to the USB device instead of the selected mouse type. When connecting the keypad to one of the ports, Bochs forwards the input of the numeric keypad to the USB device instead of the PS/2 keyboard. To connect a flat image as an USB hardisk you can use the 'disk' device with the path to the image separated with a colon (see above).
Note: PCI support must be enabled.
Example:
gdbstub: enabled=1, port=1234, text_base=0, data_base=0, bss_base=0 |
gdbstub: enabled=0 |
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=0x300, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0 ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=en0 #macosx ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0 ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=vde, ethdev="/tmp/vde.ctl" ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=vnet, ethdev="c:/temp" ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0 ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun0, script=./tunconfig ioaddr, irq: You probably won't need to change ioaddr and irq, unless there are IRQ conflicts. These parameters are ignored if the NE2000 is assigned to a PCI slot. 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 physical ethernet interface. You can also specify a network simulator or a module with no input/output ("null"). See the table below for currently supported values. 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 optional, 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 |
The following table shows the available ethernet modules with description, whether the "ethdev" and "script" parameters are used or not and the Bochs version where this module was added.
Table 4-4. Ethernet modules
Module | Description | ethdev | script | Bochs version |
---|---|---|---|---|
arpback | ARP simulator - disabled by default. | No | No | 1.3 |
fbsd | FreeBSD / OpenBSD packetmover. | Yes | No | 1.0 |
linux | Linux packetmover - 'root' privileges required, no connection to the host machine. | Yes | No | 1.3 |
null | Null packetmover. All packets are discarded, but logged to a few files. | No | No | 1.0 |
tap | TAP packetmover. | Yes | Yes | 1.4 |
tuntap | TUN/TAP packetmover - see Configuring and using a tuntap network interface. | Yes | Yes | 2.0 |
vde | Virtual Distributed Ethernet packetmover. | Yes | Yes | 2.2 |
vnet | ARP, ping (ICMP-echo), DHCP and read/write TFTP simulation. The virtual host uses 192.168.10.1. DHCP assigns 192.168.10.2 to the guest. The TFTP server uses the ethdev value for the root directory and doesn't overwrite files. | Yes, for TFTP | No | 2.2 |
win32 | Win32 packetmover - WinPCap driver required. | Yes | No | 1.3 |
Examples:
keyboard_mapping: enabled=0, map= keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map |
Examples:
keyboard_type: xt keyboard_type: at keyboard_type: mf |
Examples:
user_shortcut: keys=ctrl-alt-del user_shortcut: keys=ctrl-alt-esc |
Valid key names:
"alt", "bksl", "bksp", "ctrl", "del", "down", "end", "enter", "esc", "f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", "plus", "right", "shift", "space", "tab", "up", "win" and "print".
Example:
cmosimage: file=cmos.img, rtc_init=time0 |
Example:
magic_break: enabled=1 |
[1] | IPS measurements depend on OS and compiler configuration in addition to processor clock speed. |