Alchemical Symbols ⭕🟪🧧🥬🟥🟦🟧
←↑→↓↖↙↗↘↕⏤
unicode=Geometric Shapes
▶ 仅仅个别字不同的时候的对比标识
◆
◉ 着重强调
◆ 1、
◆ 2、
◆ 3、
Miscellaneous Symbols
☞
Dingbats
✍ 重点记忆,个人总结的点,或者知识。
✎✎
⟱
⬢命令集⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢命令集⬢
sudo mkdir /home/asd
sudo mount -t vboxsf 1 /home/asd
ls /home/asd
⬢命令集⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢⬢命令集⬢
章节号 | 内容 |
---|---|
1图片格式(png) | 宽度大于610px,保持高宽比减低为620px |
1-1 | 应用 |
1-1-1 | 方法 |
第5章节 启动配置( Setup)
These are the minimum requirements for running an OS inside of Bochs:
使用Bochs虚拟机运行操作系统的最小需求为:
◆ 1、the Bochs executable
Bochs程序
◆ 2、the BIOS image (usually called BIOS-bochs-latest)
BIOS映像文件
◆ 3、the VGA BIOS image (e.g. VGABIOS-lgpl-latest or VGABIOS-elpin-2.40)
VBA BIOS映像文件
◆ 4、at least one bootable media, either as disk image (floppy, hard disk or CD-ROM) or physical disk (floppy or CD-ROM)
至少1个可引导启动的介质映像文件(软驱、硬盘、光驱等)或者物理介质。
The easiest way to setup Bochs for the first time is to use the example configuration file called bochsrc-sample.txt.Locate that file (location depends on the (host) OS and on the installation facility used) and copy it to a location where Bochs looks for that file
Bochs编译安装完成后,最简单的启动方式就是使用bochsrc-sample.txt文件。找到这个文件,并复制到Bochs需要它出现的位置即可(但是还要进行相关的设置)。
root@pop-os:/# whereis bochsrc-sample.txt
bochsrc-sample: /usr/local/bin/bochsrc-sample.txt
If your keyboard output inside of Bochs is wrong, you may also need a keymap file to remap your keyboard layout to the U.S. layout. A set of keymap files for the X window system and SDL (Linux port) is distributed with Bochs. If your keyboard layout is not supported yet, you can create your own one by following the instructions given in Section 4.4.
如果Bochs内键盘的输出有问题,还需要设置keymap。
A collection of disk images of different operating systems can be found at http://bochs.sourceforge.net/diskimages.html. Some disk images are the size of a floppy disk (1 meg compressed) and others are gigantic (160 meg compressed). If you want to create a disk image yourself, please see Section 8.2.
-
5-2 启动配置( Setup)—ROM images
Just like a real PC, Bochs needs a system BIOS and VGA BIOS to initialize the machine when it powers on or after a hardware reset. Bochs needs to load them from image file into the emulated memory. The Bochs package contains a set of system BIOS and VGA BIOS images.
System and VGA BIOS images
| File | Description |
| -------------------------------- | ------------------------------------------------------------ |
| BIOS-bochs-latest | default ROM BIOS image for Bochs |
| BIOS-bochs-legacy | ROM BIOS image without 32-bit init code (for i386 and ISA graphics card emulation) |
| bios.bin-1.7.5 | SeaBIOS ROM image |
| VGABIOS-elpin-2.40 | legacy VGA BIOS image for Bochs |
| VGABIOS-lgpl-latest | LGPL'd VGA BIOS image for Bochs |
| VGABIOS-lgpl-latest-debug | LGPL'd VGA BIOS image for Bochs with debug output to the logfile |
| VGABIOS-lgpl-latest-cirrus | LGPL'd VGA BIOS image for Bochs with the Cirrus extension enabled |
| VGABIOS-lgpl-latest-cirrus-debug | LGPL'd VGA BIOS image for Bochs with the Cirrus extension enabled and debug output to the logfile |
Bochs must be set up to use system and VGA BIOS like this:
romimage: file=BIOS-bochs-latest, address=0xe0000
vgaromimage: file=VGABIOS-lgpl-latest
We recommend to use the ROM images distributed with Bochs or one of the latest SeaBIOS images. BIOS images designed for real hardware mostly do not work properly.
真正为硬件设计的BIOS不能在Bochs中运行。
Bochs supports optional ROM images to be loaded into the ISA ROM space, typically between C8000 and EFFFF (see Section 4.3.10). The PCI versions of the Bochs network adapter emulation support loading a boot ROM into the PCI ROM space (see Section 4.3.34).
-
5-3 启动配置( Setup)— The configuration file “bochsrc(或者是bochsrc-sample.txt)”
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:
Bochs使用一个叫做“bochsrc”的配置文件来对运行环境的各项参数进行设定。下面是文件中的部分设置代码:
ata0-master: type=disk, path="30M.sample", cylinders=615, heads=6, spt=17
boot: disk
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 property=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.
代码设置格式非常严格,空格的数目不能错,字母大小写也要严格遵守规定。
我们剔除配置文件中的注释,看看关键的部分:
cpu: model=pentium, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
cpu: cpuid_limit_winnt=0
memory: guest=512, host=256
romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
mouse: enabled=0
pci: enabled=1, chipset=i440fx
private_colormap: enabled=0
floppya: 1_44=/dev/fd0, status=inserted
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
ata0-master: type=disk, mode=flat, path="30M.sample"
boot: disk
floppy_bootsig_check: disabled=0
log: bochsout.txt
panic: action=ask
error: action=report
info: action=report
debug: action=ignore, pci=report # report BX_DEBUG from module 'pci'
debugger_log: -
parport1: enabled=1, file="parport.out"
speaker: enabled=1, mode=sound
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:
配置文件bochsrc的语法,同时也适用于命令行中。如下可以带命令行方式设置启动bochs:
bochs 'boot:floppy' 'floppya: 1_44=a.img, status=inserted'
You can use environment variables with the dollar sign prefix in the bochsrc file, for example:
可以在bochsrc配置文件中,使用以$开头的环境变量如下:
floppya: 1_44="$IMAGES/bootdisk.img", status=inserted
boot: floppy
There are two environment variables with a built-in default value which is set at compile or installation 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 in the config files of the Bochs 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 to search in for Bochs plugins. The paths are separated by colons (on Windows: semicolons). 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.
这里有一个让我困惑许久的环境变量,$BXSHARE。文中提到说是在Makefile中,同时我也在bochs的安装目录下搜索过这个变量值:
eqweq@pop-os:/home/bochs-2.6.9$ grep 'BXSHARE' ./* -r
./1:# You can use the environment variable $BXSHARE to specify the location
./1:romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot
./1:#romimage: file=$BXSHARE/bios.bin-1.7.5 # http://www.seabios.org/SeaBIOS
./1:vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
Binary file ./bochs matches
./CHANGES: - $BXSHARE is the path where the BIOSes and keymaps are installed.
./CHANGES: $BXSHARE/BIOS-bios-latest. On win32, the $BXSHARE default is
./CHANGES: the $BXSHARE default is set to the path containing bochs.app.
./config.cc: sprintf(name, "%s/BIOS-bochs-latest", (char *)get_builtin_variable("BXSHARE"));
./config.cc: sprintf(name, "%s/VGABIOS-lgpl-latest", get_builtin_variable("BXSHARE"));
./config.cc: if (!strcmp(varname, "BXSHARE")) {
Binary file ./config.o matches
./dlxlinux/bochsrc.txt:romimage: file=$BXSHARE/BIOS-bochs-latest
./dlxlinux/bochsrc.txt:vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
./dlxlinux/bochsrc.txt:keyboard: keymap=$BXSHARE/keymaps/x11-pc-us.map
./dlxlinux/bochsrc.txt:#keyboard: keymap=$BXSHARE/keymaps/x11-pc-fr.map
./dlxlinux/bochsrc.txt:#keyboard: keymap=$BXSHARE/keymaps/x11-pc-de.map
./dlxlinux/bochsrc.txt:#keyboard: keymap=$BXSHARE/keymaps/x11-pc-es.map
./doc/docbook/user/user.dbk:at compile or installation time. $BXSHARE points to the
./doc/docbook/user/user.dbk:value. $BXSHARE is used in the config files of the Bochs disk images to
./doc/docbook/user/user.dbk:If $BXSHARE is not defined, Bochs will supply the default value.
./doc/docbook/user/user.dbk: romimage: file=$BXSHARE/BIOS-bochs-legacy
./doc/docbook/user/user.dbk:You can use the environment variable $BXSHARE to specify the location of the BIOS.
./doc/docbook/user/user.dbk: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
./doc/docbook/user/user.dbk: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus
./doc/docbook/user/user.dbk: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus
./doc/man/bochsrc.5:default value which is set at compile time. $BXSHARE points to the
./doc/man/bochsrc.5:value. $BXSHARE is used by disk images to locate the directory where
./doc/man/bochsrc.5:the BIOS images and keymaps can be found. If $BXSHARE is not defined, Bochs
./doc/man/bochsrc.5:You can use the environment variable $BXSHARE to specify the location of the BIOS.
./doc/man/bochsrc.5: romimage: file=$BXSHARE/BIOS-bochs-legacy
./doc/man/bochsrc.5: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
./main.cc: if(!getenv("BXSHARE"))
./main.cc: setenv("BXSHARE", bxshareDirPath, 1);
./main.cc: BX_INFO(("now my BXSHARE is %s", getenv("BXSHARE")));
./main.cc: if (getenv("BXSHARE") != NULL) {
./main.cc: BX_INFO(("BXSHARE is set to '%s'", getenv("BXSHARE")));
./main.cc: BX_INFO(("BXSHARE not set. using compile time default '%s'",
./main.cc: setenv("BXSHARE", BX_SHARE_PATH, 1);
Binary file ./main.o matches
./Makefile: dlxrc=$(INSTDIR)/dlxlinux/bochsrc; mv $$dlxrc.txt $$dlxrc.orig && sed < $$dlxrc.orig 's/$$BXSHARE/../' > $$dlxrc.bxrc && rm -f $$dlxrc.orig
./Makefile.in: dlxrc=$(INSTDIR)/dlxlinux/bochsrc; mv $$dlxrc.txt $$dlxrc.orig && sed < $$dlxrc.orig 's/$$BXSHARE/../' > $$dlxrc.bxrc && rm -f $$dlxrc.orig
Binary file ./_rpm_top/BUILD/bochs-2.6.9/config.o matches
./_rpm_top/BUILD/bochs-2.6.9/Makefile.in: dlxrc=$(INSTDIR)/dlxlinux/bochsrc; mv $$dlxrc.txt $$dlxrc.orig && sed < $$dlxrc.orig 's/$$BXSHARE/../' > $$dlxrc.bxrc && rm -f $$dlxrc.orig
./_rpm_top/BUILD/bochs-2.6.9/dlxlinux/bochsrc.txt:romimage: file=$BXSHARE/BIOS-bochs-latest
./_rpm_top/BUILD/bochs-2.6.9/dlxlinux/bochsrc.txt:vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
./_rpm_top/BUILD/bochs-2.6.9/dlxlinux/bochsrc.txt:keyboard: keymap=$BXSHARE/keymaps/x11-pc-us.map
./_rpm_top/BUILD/bochs-2.6.9/dlxlinux/bochsrc.txt:#keyboard: keymap=$BXSHARE/keymaps/x11-pc-fr.map
./_rpm_top/BUILD/bochs-2.6.9/dlxlinux/bochsrc.txt:#keyboard: keymap=$BXSHARE/keymaps/x11-pc-de.map
./_rpm_top/BUILD/bochs-2.6.9/dlxlinux/bochsrc.txt:#keyboard: keymap=$BXSHARE/keymaps/x11-pc-es.map
./_rpm_top/BUILD/bochs-2.6.9/CHANGES: - $BXSHARE is the path where the BIOSes and keymaps are installed.
./_rpm_top/BUILD/bochs-2.6.9/CHANGES: $BXSHARE/BIOS-bios-latest. On win32, the $BXSHARE default is
./_rpm_top/BUILD/bochs-2.6.9/CHANGES: the $BXSHARE default is set to the path containing bochs.app.
./_rpm_top/BUILD/bochs-2.6.9/.bochsrc:# You can use the environment variable $BXSHARE to specify the location
./_rpm_top/BUILD/bochs-2.6.9/.bochsrc:romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot
./_rpm_top/BUILD/bochs-2.6.9/.bochsrc:#romimage: file=$BXSHARE/bios.bin-1.7.5 # http://www.seabios.org/SeaBIOS
./_rpm_top/BUILD/bochs-2.6.9/.bochsrc:vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
Binary file ./_rpm_top/BUILD/bochs-2.6.9/bochs matches
./_rpm_top/BUILD/bochs-2.6.9/Makefile: dlxrc=$(INSTDIR)/dlxlinux/bochsrc; mv $$dlxrc.txt $$dlxrc.orig && sed < $$dlxrc.orig 's/$$BXSHARE/../' > $$dlxrc.bxrc && rm -f $$dlxrc.orig
Binary file ./_rpm_top/BUILD/bochs-2.6.9/main.o matches
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk:at compile or installation time. $BXSHARE points to the
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk:value. $BXSHARE is used in the config files of the Bochs disk images to
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk:If $BXSHARE is not defined, Bochs will supply the default value.
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk: romimage: file=$BXSHARE/BIOS-bochs-legacy
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk:You can use the environment variable $BXSHARE to specify the location of the BIOS.
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus
./_rpm_top/BUILD/bochs-2.6.9/doc/docbook/user/user.dbk: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus
./_rpm_top/BUILD/bochs-2.6.9/doc/man/bochsrc.5:default value which is set at compile time. $BXSHARE points to the
./_rpm_top/BUILD/bochs-2.6.9/doc/man/bochsrc.5:value. $BXSHARE is used by disk images to locate the directory where
./_rpm_top/BUILD/bochs-2.6.9/doc/man/bochsrc.5:the BIOS images and keymaps can be found. If $BXSHARE is not defined, Bochs
./_rpm_top/BUILD/bochs-2.6.9/doc/man/bochsrc.5:You can use the environment variable $BXSHARE to specify the location of the BIOS.
./_rpm_top/BUILD/bochs-2.6.9/doc/man/bochsrc.5: romimage: file=$BXSHARE/BIOS-bochs-legacy
./_rpm_top/BUILD/bochs-2.6.9/doc/man/bochsrc.5: vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
./_rpm_top/BUILD/bochs-2.6.9/main.cc: if(!getenv("BXSHARE"))
./_rpm_top/BUILD/bochs-2.6.9/main.cc: setenv("BXSHARE", bxshareDirPath, 1);
./_rpm_top/BUILD/bochs-2.6.9/main.cc: BX_INFO(("now my BXSHARE is %s", getenv("BXSHARE")));
./_rpm_top/BUILD/bochs-2.6.9/main.cc: if (getenv("BXSHARE") != NULL) {
./_rpm_top/BUILD/bochs-2.6.9/main.cc: BX_INFO(("BXSHARE is set to '%s'", getenv("BXSHARE")));
./_rpm_top/BUILD/bochs-2.6.9/main.cc: BX_INFO(("BXSHARE not set. using compile time default '%s'",
./_rpm_top/BUILD/bochs-2.6.9/main.cc: setenv("BXSHARE", BX_SHARE_PATH, 1);
./_rpm_top/BUILD/bochs-2.6.9/config.cc: sprintf(name, "%s/BIOS-bochs-latest", (char *)get_builtin_variable("BXSHARE"));
./_rpm_top/BUILD/bochs-2.6.9/config.cc: sprintf(name, "%s/VGABIOS-lgpl-latest", get_builtin_variable("BXSHARE"));
./_rpm_top/BUILD/bochs-2.6.9/config.cc: if (!strcmp(varname, "BXSHARE")) {
结果太过于复杂,对我来说难以抓到主干,还是回到文档中,提及这个变量在Makefile中,还是去Makefile中找找看。
prefix = /usr/local
exec_prefix = ${prefix}
srcdir = .
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
plugdir = ${exec_prefix}/lib/bochs/plugins
datarootdir = ${prefix}/share
mandir = ${datarootdir}/man
man1dir = $(mandir)/man1
man5dir = $(mandir)/man5
docdir = $(datarootdir)/doc/bochs
sharedir = $(datarootdir)/bochs
top_builddir = .
top_srcdir = $(srcdir)
DESTDIR =
果然找到关键几行代码。通过上述的复制,最终可以追溯到sharedir的值,文档中只说明BXSHARE的值看sharedir即可,我们就追溯到此,细节没有继续探索。
You can use the #include statement in the 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:
可以在bochsrc文件中加入#include代码,引入一个文件。这个文件内可以放置一些你认为通用的设置。
#include /etc/bochsrc1
Bochs now treats unknown options as device plugin names. It tries to load this plugin and if successful it tries to call the parser function for this configuration line which is located in the plugin. This mechanism is implemented for the Bochs network, sound and USB devices. If there is a typo in an option name or an obsolete option is used, Bochs will panic and exit with a plugin load failure error message. In that case the failing line in your bochsrc file must be reviewed and fixed.
此段含有部分我觉得有意义的信息,但是目前不明就里。
以下是所有的内设的选项介绍:
5-3-1. 启动配置( Setup)— The configuration file — plugin_ctrl
#=======================================================================
# PLUGIN_CTRL:
# Controls the presence of optional device nplugins. These plugins are loaded
# directly with this option and some of them install a config option that is
# only available when the plugin device is loaded. The value "1" means to load
# the plugin and "0" will unload it (if loaded before).
#
# These plugins will be loaded by default (if present): 'biosdev', 'extfpuirq',
# 'gameport', 'iodebug','parallel', 'serial', 'speaker' and 'unmapped'.
#
# These plugins are also supported, but they are usually loaded directly with
# their bochsrc option: 'e1000', 'es1370', 'ne2k', 'pcidev', 'pcipnic', 'sb16',
# 'usb_ehci', 'usb_ohci', 'usb_uhci', 'usb_xhci' and 'voodoo'.
#=======================================================================
#plugin_ctrl: unmapped=0, e1000=1 # unload 'unmapped' and load 'e1000'
Controls the presence of optional device plugins. These plugins are loaded directly with this option and some of them install a config option that is only available when the plugin device is loaded. The value "1" means to load the plugin and "0" will unload it (if loaded before).
These plugins will be loaded by default (if present): 'biosdev', 'extfpuirq', 'gameport', 'iodebug','parallel', 'serial', 'speaker' and 'unmapped'.
These plugins are also supported, but they are usually loaded directly with their bochsrc option: 'e1000', 'es1370', 'ne2k', 'pcidev', 'pcipnic', 'sb16', 'usb_ehci', 'usb_ohci', 'usb_uhci', 'usb_xhci' and 'voodoo'.
1是加载,0是不加载。
5-3-2. 启动配置( Setup)— The configuration file — config_interface
The configuration interface is a series of menus or dialog boxes that allows you to edit all the settings that control Bochs' behavior. Depending on the platform there are up to 3 choices of configuration interface: a text mode version called "textconfig" and two graphical versions called "win32config" and "wx". The text mode version uses stdin/stdout and is always compiled in, unless Bochs is compiled for wx only. The choice "win32config" is only available on win32 and it is the default there. The choice "wx" is only available when Bochs is compiled with wxWidgets support, see Section 3.4.13. If you do not write a config_interface line, Bochs will choose a default for you (usually textconfig).
The configuration interface就是一系列的图形对话框,方便对bochs进行设定。
例如:
config_interface: textconfig
config_interface: win32config
config_interface: wx
5-3-3. 启动配置( Setup)— The configuration file — 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 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.
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。
wxWidgets要同时设置interface和library。
display_library: x
display_library: sdl
Some display libraries now support specific options to control their behaviour. These options are supported by more than one display library:
一些显示库现在支持特定的选项来控制它们的行为。多个显示库支持这些选项:
"gui_debug" - use GTK debugger gui (sdl, x) / Win32 debugger gui (sdl, sdl2, win32)
"hideIPS" - disable IPS output in status bar (rfb, sdl, sdl2, vncsrv, win32, wx, x)
"nokeyrepeat" - turn off host keyboard repeat (sdl, sdl2, win32, x)
"timeout" - time (in seconds) to wait for client (rfb, vncsrv)
设置操作的范例:
display_library: sdl, options="fullscreen" # startup in fullscreen mode
display_library: sdl2, options="fullscreen" # startup in fullscreen mode
**Table 4-2. display_library values**
| Option | Description |
| --------- | ------------------------------------------------------------ |
| x | use X windows interface, cross platform |
| win32 | use native win32 libraries |
| carbon | use Carbon library (for MacOS X) |
| macintosh | use MacOS pre-10 |
| amigaos | use native AmigaOS libraries |
| sdl | use SDL 1.2.x library, cross platform, details in [Section 3.4.11](http://bochs.sourceforge.net/doc/docbook/user/compiling.html#COMPILE-SDL) |
| sdl2 | use SDL 2.x library, cross platform, details in [Section 3.4.12](http://bochs.sourceforge.net/doc/docbook/user/compiling.html#COMPILE-SDL2) |
| 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.9](http://bochs.sourceforge.net/doc/docbook/user/compiling.html#COMPILE-RFB) |
| vncsrv | use LibVNCServer for extended RFB(VNC) support, details in [Section 3.4.10](http://bochs.sourceforge.net/doc/docbook/user/compiling.html#COMPILE-VNCSRV) |
| wx | use wxWidgets library, cross platform, details in [Section 3.4.13](http://bochs.sourceforge.net/doc/docbook/user/compiling.html#COMPILE-WX) |
| nogui | no display at all |
5-3-4. 启动配置( Setup)— The configuration file — cpu
cpu: count=2, ips=10000000
This defines the parameters of the cpu inside Bochs:
model
Selects CPU configuration to emulate from pre-defined list of all supported configurations. When this option is used and the value is different from 'bx_generic', the parameters of the CPUID option have no effect anymore. See the Section 5.4 for supported values.
使用bochs --help cpu查看自己的虚拟机支持哪些cpu:
eqweq@pop-os:~/Desktop$ bochs --help cpu
========================================================================
Bochs x86 Emulator 2.6.9
Built from SVN snapshot on April 9, 2017
Compiled on Nov 25 2019 at 08:07:22
========================================================================
Supported CPU models:
bx_generic
pentium
pentium_mmx
amd_k6_2_chomper
p2_klamath
p3_katmai
p4_willamette
core_duo_t2400_yonah
atom_n270
00000000000i[SIM ] quit_sim called with exit code 0
count
Set the number of processors:cores per processor:threads per core when Bochs is compiled for SMP emulation. Bochs currently supports up to 14 threads (legacy APIC) or 254 threads (xAPIC or higher) running simultaniosly. If Bochs is compiled without SMP support, it won't accept values different from 1. For more information on SMP see Section 8.9.
设置处理器个数、每个处理器核心数、每个核心的线程数等。用以模拟Symmetrical Multi-Processing。
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 !
出现triple fault之后,重置CPU。否则继续执行的结果将不可预知。
cpuid_limit_winnt
Determine whether to limit maximum CPUID function to 2. This mode is required to workaround WinNT installation and boot issues.
解决WinNT的问题的关键。
mwait_is_nop
When this option is enabled MWAIT will not put the CPU into a sleep state. This option exists only if Bochs compiled with --enable-monitor-mwait
.
不会将CPU置于睡眠状态。
msrs
Define path to user CPU Model Specific Registers (MSRs) specification. See example in msrs.def.
定义MSR路径。
ignore_bad_msrs
Ignore MSR references that Bochs does not understand; print a warning message instead of generating #GP exception. This option is enabled by default but will not be avaiable if configurable MSRs are enabled.
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].
IPS用于校准Bochs模拟中的许多时间相关事件
Bochs | Speed | Machine/Compiler | Typical IPS |
---|---|---|---|
2.4.6 | 3.4Ghz | Intel Core i7 2600 with Win7x64/g++ 4.5.2 | 85 to 95 MIPS |
2.3.7 | 3.2Ghz | Intel Core 2 Q9770 with WinXP/g++ 3.4 | 50 to 55 MIPS |
2.3.7 | 2.6Ghz | Intel Core 2 Duo with WinXP/g++ 3.4 | 38 to 43 MIPS |
2.2.6 | 2.6Ghz | Intel Core 2 Duo with WinXP/g++ 3.4 | 21 to 25 MIPS |
2.2.6 | 2.1Ghz | Athlon XP with Linux 2.6/g++ 3.4 | 12 to 15 MIPS |
5-3-5. 启动配置( Setup)— The configuration file — cpuid
cpuid: level=6, mmx=1, sep=1, sse=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1
This defines features and functionality supported by Bochs emulated CPU. These settings are only valid and configurable if the cpu model is set to the default value 'bx_generic'.
这定义了Bochs模拟CPU支持的特性和功能。仅当model=bx_generic才起效果。
level
Set emulated CPU level information returned by CPUID. Default value is determined by configure option --enable-cpu-level. Currently supported values are 5 (for Pentium and similar processors) and 6 (for P6 and later processors).
family
Set family information returned by CPUID. Default family value determined by configure option --enable-cpu-level.
model
Set model information returned by CPUID. Default model value is 3.
stepping
Set stepping information returned by CPUID. Default stepping value is 3.
vendor_string
Set the CPUID vendor string returned by CPUID(0x0). This should be a twelve-character ASCII string.
brand_string
Set the CPUID brand string returned by CPUID(0x80000002 .. 0x80000004]). This should be at most a forty-eight-character ASCII string.
mmx
Select MMX instruction set support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 5.
apic
Select APIC configuration (LEGACY/XAPIC/XAPIC_EXT/X2APIC). This option exists only if Bochs compiled with BX_CPU_LEVEL >= 5.
sep
Select SYSENTER/SYSEXIT instruction set support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
simd
Select SIMD instructions support. Any of NONE/SSE/SSE2/SSE3/SSSE3/SSE4_1/SSE4_2/AVX/AVX2/AVX512 could be selected. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6. The AVX choises exists only if Bochs compiled with --enable-avx option.
sse4a
Select AMD SSE4A instructions support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
misaligned_sse
Select AMD Misaligned SSE mode support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
aes
Select AES instruction set support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
sha
Select SHA instruction set support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
movbe
Select MOVBE Intel(R) Atom instruction support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
adx
Select ADCX/ADOX instructions support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
xsave
Select XSAVE extensions support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
xsaveopt
Select XSAVEOPT instruction support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
avx_f16c
Select AVX float16 convert instructions support. This option exists only if Bochs compiled with --enable-avx
option.
avx_fma
Select AVX fused multiply add (FMA) instructions support. This option exists only if Bochs compiled with --enable-avx
option.
bmi
Select BMI1/BMI2 instructions support. This option exists only if Bochs compiled with --enable-avx
option.
fma4
Select AMD four operand FMA instructions support. This option exists only if Bochs compiled with --enable-avx
option.
xop
Select AMD XOP instructions support. This option exists only if Bochs compiled with --enable-avx
option.
tbm
Select AMD TBM instructions support. This option exists only if Bochs compiled with --enable-avx
option.
x86_64
Enable x86-64 and long mode support. This option exists only if Bochs compiled with x86-64 support.
1g_pages
Enable 1G page size support in long mode. This option exists only if Bochs compiled with x86-64 support.
pcid
Enable Process-Context Identifiers (PCID) support in long mode. This option exists only if Bochs compiled with x86-64 support.
smep
Enable Supervisor Mode Execution Protection (SMEP) support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
smap
Enable Supervisor Mode Access Prevention (SMAP) support. This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
mwait
Select MONITOR/MWAIT instructions support. This option exists only if Bochs compiled with --enable-monitor-mwait
.
vmx
Select VMX extensions emulation support. This option exists only if Bochs compiled with --enable-vmx
option.
svm
Select AMD SVM (Secure Virtual Machine) extensions emulation support. This option exists only if Bochs compiled with --enable-svm
option.
5-3-6. 启动配置( Setup)— The configuration file — memory
memory: guest=512, host=256
Set the amount of physical memory you want to emulate.
设置要模拟的物理内存量。
guest
Set amount of guest physical memory to emulate. The default is 32MB, the maximum amount limited only by physical address space limitations.
host
Set amount of host memory you want to allocate for guest RAM emulation. It is possible to allocate less memory than you want to emulate in guest system. This will fake guest to see the non-existing memory. Once guest system touches new memory block it will be dynamically taken from the memory pool. You will be warned (by FATAL PANIC) in case guest already used all allocated host memory and wants more.
5-3-7. 启动配置( Setup)— The configuration file — megs
megs: 32
megs: 128
This option sets the 'guest' and 'host' memory parameters to the same value. In all other cases the 'memory' option should be used instead.
设置'guest' and 'host' memory为相同的值。建议使用memory参数代替。
5-3-8. 启动配置( Setup)— The configuration file — romimage
romimage: file=bios/BIOS-bochs-latest, options=fastboot
romimage: file=$BXSHARE/BIOS-bochs-legacy
romimage: file=mybios.bin, address=0xfff80000
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 default ROM BIOS is usually loaded starting at address 0xfffe0000, and it is exactly 128k long. The legacy version of the Bochs BIOS is usually loaded starting at address 0xffff0000, and it is exactly 64k long. You can use the environment variable $BXSHARE to specify the location of the BIOS. The usage of external large BIOS images (up to 512k) at memory top is now supported, but we still recommend to use the BIOS distributed with Bochs. The start address is optional, since it can be calculated from image size. The Bochs BIOS currently supports only the option "fastboot" to skip the boot menu delay.
ROM BIOS控制PC首次开机时的操作。通常,可以在源或二进制发行版中使用名为BIOS bochs latest的预编译BIOS。默认ROM BIOS通常从地址0xfffe0000开始加载,它的长度正好是128k。Bochs BIOS的旧版本通常从地址0xffff0000开始加载,它的长度正好是64k。可以使用环境变量$BXSHARE指定BIOS的位置。现在支持在内存顶部使用外部大型BIOS映像(高达512k),但我们仍然建议使用与Bochs一起分发的BIOS。起始地址是可选的,因为它可以根据image大小计算。Bochs BIOS目前只支持“fastboot”选项来跳过引导菜单延迟。
5-3-9. 启动配置( Setup)— The configuration file — vgaromimage
vgaromimage: file=bios/VGABIOS-elpin-2.40
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus
This tells Bochs what VGA ROM BIOS to load (at 0xC0000).
5-3-10. 启动配置( Setup)— The configuration file — optromimage1, optromimage2, optromimage3 or optromimage4
optromimage1: file=optionalrom.bin, address=0xd0000
This enables Bochs to load up to 4 optional ROM images.
允许Bochs加载最多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).
确保把rom加载至只读区域。同时不能覆盖rom和vga rom区域。
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。
它还可以方便地在模拟中上载一些可以由引导加载程序检索的任意代码/数据。
5-3-11. 启动配置( Setup)— The configuration file — vga
vga: extension=cirrus, update_freq=10, realtime=1
vga: extension=vbe
This defines parameters related to the VGA display。
定义了与VGA显示相关的参数。
The 'extension' option can be used to specify the VGA display extension. With the value 'none' you can use standard VGA with no extension. Other supported values are 'vbe' for Bochs VBE (needs VGABIOS-lgpl-latest as VGA BIOS, see vgaromimage option) and 'cirrus' for Cirrus SVGA support (needs VGABIOS-lgpl-latest-cirrus as VGA BIOS).
The VGA update frequency specifies the number of display updates per second. This parameter can be changed at runtime. The default value is 5.
VGA更新频率指定每秒显示更新的次数。此参数可以在运行时更改。默认值为5。
The 'realtime' option specifies the operation mode of the VGA update timer. If set to 1, the VGA timer is based on realtime, otherwise it is based on the ips setting. If the host is slow (low ips, update_freq) and the guest uses HLT appropriately, setting this to 0 and "clock: sync=none" may improve the responsiveness of the guest GUI when the guest is otherwise idle. The default value is 1.
5-3-12. 启动配置( Setup)— The configuration file — voodoo
voodoo: enabled=1, model=voodoo1
This defines the Voodoo Graphics emulation (experimental). Currently supported models are 'voodoo1' and 'voodoo2'. The Voodoo2 support is not yet complete.
5-3-13. 启动配置( Setup)— The configuration file — keyboard
keyboard: type=mf, serial_delay=200, paste_delay=100000
keyboard: keymap=gui/keymaps/x11-pc-de.map
keyboard: user_shortcut=ctrl-alt-del
type 类型
Type of keyboard return 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.
serial_delay
Approximate time in microseconds that it takes one character to be transferred from the keyboard to controller over the serial path.
paste_delay
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.
If your OS is losing characters during a paste, increase the paste delay until it stops losing characters.
如果操作系统在粘贴过程中丢失字符,请增加粘贴延迟,直到它停止丢失字符为止。
keymap
This enables a remap of a physical localized keyboard to a virtualized us keyboard, as the PC architecture expects.
Keyboard mapping is available for the display libraries x, sdl (Linux port) and wx (GTK port). For SDL you have to use keymaps designed for SDL, the wxWidgets GUI uses the keymaps for X11.
user_shortcut
This defines the keyboard shortcut to be sent when you press the "user" button in the headerbar. The shortcut string is a combination of maximum 3 key names (listed below) separated with a '-' character.
Valid key names:
"alt", "bksl", "bksp", "ctrl", "del", "down", "end", "enter", "esc", "f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", "plus", "power", "print", "right", "scrlck", "shift", "space", "tab", "up" and "win".
5-3-14. 启动配置( Setup)— The configuration file — mouse
mouse: enabled=1
mouse: type=imps2, enabled=1
mouse: type=serial, enabled=1
mouse: enabled=0, toggle=ctrl+f10
This defines parameters for the emulated mouse type, the initial status of the mouse capture and the runtime method to toggle it.
type
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', 'serial_msys' (one com port requires setting 'mode=mouse', see com option) 'inport' and 'bus' (if present). To connect a mouse to a USB port, see the usb_uhci, 'usb_ohci', 'usb_ehci' or 'usb_xhci' options (requires PCI and USB support).
enabled
The Bochs gui creates mouse "events" unless the 'enabled' option is set to 0. The hardware emulation itself is not disabled by this. 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 (see headerbar and the 'toggle' option below).
可以在运行时切换鼠标的作用。
toggle
The default method to toggle the mouse capture at runtime is to press the CTRL key and the middle mouse button ('ctrl+mbutton'). This option allows to change the method to 'ctrl+f10' (like DOSBox) or 'ctrl+alt' (like QEMU) or 'f12'.
5-3-15. 启动配置( Setup)— The configuration file — pci
pci: enabled=1, chipset=i440fx # default if compiled with PCI support
pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k
This option controls the presence of a PCI chipset in Bochs. Currently it only supports the i430FX and i440FX chipsets. You can also specify the devices connected to PCI slots. Up to 5 slots are available. For these combined PCI/ISA devices assigning to slot is mandatory if you want to emulate the PCI model: cirrus, ne2k and pcivga. These PCI-only devices are also supported, but they are auto-assigned if you don't use the slot configuration: e1000, es1370, pcidev, pcipnic, usb_ohci, usb_ehci and usb_xhci.
5-3-16. 启动配置( Setup)— The configuration file — clock
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="Mon Jan 1 00:00:00 1990" # 631148400
clock: sync=realtime, time0=938581955 # Wed Sep 29 07:12:35 1999
clock: sync=realtime, time0="Sat Jan 1 00:00:00 2000" # 946681200
clock: sync=none, time0=1 # Now (localtime)
clock: sync=none, time0=utc # Now (utc/gmt)
Default value are sync=none, rtc_sync=0, time0=local
This defines the parameters of the clock inside Bochs:
sync
This defines the method how to synchronize the Bochs internal time with realtime. With the value 'none' the Bochs time relies on the IPS value and no host time synchronization is used. The 'slowdown' method sacrifices performance to preserve reproducibility while allowing host time correlation. The 'realtime' method sacrifices reproducibility to preserve performance and host-time correlation. It is possible to enable both synchronization methods.
rtc_sync
If this option is enabled together with the realtime synchronization, the RTC runs at realtime speed. This feature is disabled by default.
time0
Specifies the start (boot) time of the virtual machine. Use a time value as returned by the time(2) system call or a string as returned by the ctime(3) 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.
5-3-17. 启动配置( Setup)— The configuration file — cmosimage
cmosimage: file=cmos.img, rtc_init=time0
This defines a binary image file with size 128 bytes that can be loaded into the CMOS RAM at startup. The rtc_init parameter controls whether initialize the RTC with values stored in the image. By default the time0 argument given to the clock option is used. With 'rtc_init=image' the image is the source for the initial time.
5-3-18. 启动配置( Setup)— The configuration file — private_colormap
private_colormap: enabled=1
Requests that the GUI creates and uses 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.
5-3-19. 启动配置( Setup)— The configuration file — floppya/floppyb
2.88M 3.5" media:
floppya: 2_88=a:, status=inserted
1.44M 3.5" media (write protected):
floppya: 1_44=floppya.img, status=inserted, write_protected=1
1.2M 5.25" media:
floppyb: 1_2=/dev/fd0, status=inserted
720K 3.5" media:
floppya: 720k=/usr/local/bochs/images/win95.img, status=inserted
auto-detect floppy media type:
floppya: image=floppy.img, status=inserted
use directory as VFAT media:
floppya: 1_44=vvfat:path, status=inserted
1.44M 3.5" floppy drive, no media:
floppya: type=1_44
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).
如果设置从软驱启动,floppya必须指向可引导的软盘。可以直接从原始软驱读取软盘。
Following floppy media 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 media (does only work with images, not with raw floppy drives). In that case the size must match one of the supported types.
You can set the initial status of the media to ejected or inserted. Usually you will want to use inserted.
The parameter 'type' can be used to enable the floppy drive without media and status specified. Usually the drive type is set up based on the media type.
The optional parameter 'write_protected' can be used to control the media write protect switch. By default it is turned off.
5-3-20. 启动配置( Setup)— The configuration file —
ata0, ata1, ata2, ata3
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
These options enables up to 4 ata channels. For each channel the two base io addresses and the irq must be specified. ata0 and ata1 are enabled by default, with the values shown above.
5-3-21. 启动配置( Setup)— The configuration file — ata0-master, ata0-slave, ata1-, ata2-, ata3-*
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
**Table 4-4. 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 \| vpc \| vbox \| vvfat ] |
| 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 | [auto \| cmos \| none] |
| 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 | |
| journal | optional filename of the redolog for undoable, volatile and vvfat disks | |
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.2). It will help you choose the size and then suggest a line that works with it.
创建hard disk image,可以使用bximage工具。
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. In all cases the disk size reported from the image must be exactly CHS*512. Flat hard disk images from other projects might store additional information at the end of the file that makes this check fail. Only in this case it is safe to select "continue" when Bochs panics.
CHS寻址模式将硬盘划分为磁头(Heads)、柱面(Cylinder)、扇区(Sector)。
磁头(Heads):每张磁片的正反两面各有一个磁头,一个磁头对应一张磁片的一个面。因此,用第几磁 头就可以表示数据在哪个磁面。
柱面(Cylinder):所有磁片中半径相同的同心磁道构成“柱面",意思是这一系列的磁道垂直叠在一起,就形成一个柱面的形状。简单地理解,柱面数=磁道数。
扇区(Sector):将磁道划分为若干个小的区段,就是扇区。虽然很小,但实际是一个扇子的形状,故称为扇区。每个扇区的容量为512字节。
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)
Please see Section 8.17.2 for a discussion on translation scheme.
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 (aka VMDK)
undoable : read-only base file with commitable redolog
growing : growing file
volatile : read-only base file with volatile redolog
vpc: fixed / dynamic size VirtualPC image
vbox: fixed / dynamic size Oracle(tm) VM VirtualBox image (VDI version 1.1)
vvfat: local directory appears as VFAT disk (with volatile redolog / optional commit)
Please see Section 8.21 for a discussion on disk modes.
Default values are:
mode=flat, biosdetect=auto, translation=auto, model="Generic 1234"
5-3-22. 启动配置( Setup)— The configuration file — boot
boot: floppy
boot: cdrom, disk
boot: network, disk
boot: cdrom, floppy, disk
This defines the boot sequence. You can specify up to 3 boot drives, which can be 'floppy', 'disk', 'cdrom' or 'network' (boot ROM). Legacy 'a' and 'c' are also supported.
定义启动顺序,至多指定3个引导启动设备。
5-3-23. 启动配置( Setup)— The configuration file — floppy_bootsig_check
floppy_bootsig_check: disabled=1
This disables the 0xaa55 signature check on boot floppies The check is enabled by default.
取消启动软盘0xaa55 signature的检查功能。默认开启。
5-3-24. 启动配置( Setup)— The configuration file — log
log: bochsout.txt
log: -
log: /dev/tty (Unix only)
log: /dev/null (Unix only)
log: nul (win32 only)
Give the path of the log file you'd like Bochs debug and misc. verbiage to be to be written to. If you don't use this option or set the filename to '-' the output is written to the console. If you really don't want it, make it "/dev/null" (Unix) or "nul" (win32). :^(
5-3-25. 启动配置( Setup)— The configuration file — logprefix
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 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
5-3-26. 启动配置( Setup)— The configuration file — debug/info/error/panic
debug: action=ignore, pci=report
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), warn (show dialog with message and continue), report (print information to the console or log file), or ignore (do nothing). The recommended settings are listed in the sample above.
bochsrc中的debug、info、error和panic行控制Bochs在遇到每种类型的事件时将执行的操作。一共可以接受五种预设:fatal、ask、warn、report、ignore。建议的设置如上例。
It is also possible to specify the 'action' to do for each Bochs facility separately (e.g. crash on panics from everything except the cdrom, and only report those). See the log function module table for valid module names.
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."
5-3-27. 启动配置( Setup)— The configuration file — debugger_log
debugger_log: debugger.out
debugger_log: /dev/null (Unix only)
debugger_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 '-'.
5-3-28. 启动配置( Setup)— The configuration file — com[1-4]
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-client, dev=localhost:8888
com3: enabled=1, mode=socket-server, dev=localhost:8888
com4: enabled=1, mode=pipe-client, dev=\\.\pipe\mypipe
com4: enabled=1, mode=pipe-server, dev=\\.\pipe\mypipe
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.
When using socket* and pipe* (win32 only) modes Bochs becomes either socket/named pipe client or server. In client mode it connects to an already running server (if connection fails Bochs treats com port as not connected). In server mode it opens socket/named pipe and waits until a client application connects to it before starting simulation. This mode is useful for remote debugging (e.g. with gdb's "target remote host:port" command or windbg's command line option -k com:pipe,port=\.\pipe\pipename). Socket modes use simple TCP communication, pipe modes use duplex byte mode pipes.
Other serial modes are 'null' (no input/output), 'file' (output to a file specified as the 'dev' parameter and changeable at runtime), 'raw' (use the real serial port - partly implemented on win32), 'mouse' (standard serial mouse - requires mouse option setting 'type=serial', 'type=serial_wheel' or 'type=serial_msys').
暂时未知。
5-3-29. 启动配置( Setup)— The configuration file — parport[1-2]
parport1: enabled=1, file="parport.out"
parport2: enabled=1, file="/dev/lp0"
parport1: enabled=0
This defines a parallel (printer) port. When turned on and an output file is defined, the 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). The output file can be changed at runtime.
这定义了一个并行(打印机)端口。打开并定义输出文件后,模拟打印机端口将guest操作系统打印的字符发送到输出文件中。
5-3-30. 启动配置( Setup)— The configuration file — sound
sound: driver=default, waveout=/dev/dsp
sound: waveoutdrv=sdl, waveindrv=alsa, midioutdrv=dummy
This defines the lowlevel sound driver(s) for the wave (PCM) input / output and the MIDI output feature and (if necessary) the devices to be used. It can have several of the following properties. All properties are in the format sound: property=value.
waveoutdrv: This defines the driver to be used for the waveout feature. Possible values are 'file' (all wave data sent to file), 'dummy' (no output) and the platform-dependant drivers 'alsa', 'oss', 'osx', 'sdl' and 'win'.
waveout: This defines the device to be used for wave output (if necessary) or the output file for the 'file' driver.
waveindrv: This defines the driver to be used for the wavein feature. Possible values are 'dummy' (recording silence) and platform-dependent drivers 'alsa', 'oss', 'sdl' and 'win'.
wavein: This defines the device to be used for wave input (if necessary).
midioutdrv: This defines the driver to be used for the MIDI output feature. Possible values are 'file' (all MIDI data sent to file), 'dummy' (no output) and platform-dependent drivers 'alsa', 'oss', 'osx' and 'win'.
midiout: This defines the device to be used for MIDI output (if necessary).
driver: This defines the driver to be used for all sound features with one property. Possible values are 'default' (platform default) and all other choices described above. Overriding one or more settings with the specific driver parameter is possible.
See Section 5.6 for more information.
5-3-31. 启动配置( Setup)— The configuration file — speaker
speaker: enabled=1, mode=sound
This defines the PC speaker output mode. In the 'sound' mode the beep is generated by the square wave generator which is a part of the lowlevel sound support. The 'system' mode is only available on Linux and Windows. On Linux /dev/console is used for output and on Windows the Beep() function. The 'gui' mode forwards the beep to the related gui methods (currently only used by the Carbon gui).
分sound模式和system模式、gui模式。
5-3-32. 启动配置( Setup)— The configuration file — sb16
sb16: midimode=2, midifile=output.mid, wavemode=3, wavefile=output.wav, loglevel=2, log=sb16.log, dmatimer=600000
This defines the Sound Blaster 16 emulation, see the developer documentation for more information. It can have several of the following properties. All properties are in the usual "property=value" format.
enabled: This optional property controls the presence of the SB16 emulation. The emulation is turned on unless this property is used and set to 0.
midimode: This parameter specifies what to do with the MIDI output.
0 = no output
1 = output to device specified with the sound option (system dependent)
2 = MIDI or raw data output to file (depends on file name extension)
3 = dual output (mode 1 and 2 at the same time)
midifile: This is the file where the midi output is stored (midimode 2 or 3).
wavemode: This parameter specifies what to do with the PCM output.
0 = no output
1 = output to device specified with the sound option (system dependent)
2 = VOC, WAV or raw data output to file (depends on file name extension)
3 = dual output (mode 1 and 2 at the same time)
wavefile: This is the file where the wave output is stored (wavemode 2 or 3).
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.
It is possible to change the loglevel at runtime.
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 parameter of the cpu option. It is possible to adjust the dmatimer value at runtime.
5-3-33. 启动配置( Setup)— The configuration file — es1370
es1370: enabled=1, wavemode=1 # use 'sound' parameters
es1370: enabled=1, wavemode=2, wavefile=output.voc # send output to file
This defines the ES1370 sound emulation (recording and playback - except DAC1+DAC2 output at the same time). The parameter 'enabled' controls the presence of the device. The wave and MIDI output can be sent to device, file or both using the parameters 'wavemode', 'wavefile', 'midimode' and 'midifile'. See the description of these parameters at the SB16 directive.
5-3-34. 启动配置( Setup)— The configuration file — 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.
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
ne2k: mac=b0:c4:20:00:00:01, ethmod=socket, ethdev=40000 # use localhost
ne2k: mac=b0:c4:20:00:00:01, ethmod=socket, ethdev=mymachine:40000
ne2k: mac=b0:c4:20:00:00:01, ethmod=slirp, script=slirp.conf, bootrom=ne2k_pci.rom
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.
BOOTROM: The bootrom value is optional, and is the name of the ROM image
to load. Note that this feature is only implemented for the PCI version of
the NE2000.
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.
Module | Description | ethdev | script | Bochs version |
---|---|---|---|---|
fbsd | FreeBSD / OpenBSD packetmover. | Yes | No | 1 |
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 |
tap | TAP packetmover. | Yes | Yes | 1.4 |
tuntap | TUN/TAP packetmover - see Configuring and using a tuntap network interface. | Yes | Yes | 2 |
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 | Yes, for log file name | 2.2 |
slirp | Built-in Slirp support with DHCP / TFTP servers. Adds user mode networking to Bochs - see Using the 'slirp' networking module. The 'script' parameter can be used to set up an alternative IP configuration or additional features. The TFTP server uses the 'ethdev' value for the root directory and doesn't overwrite files. | Yes, for TFTP | Yes, for Slirp config | 2.6.5 |
socket | Connect up to 6 Bochs instances on the same or other machine with external program 'bxhub' (simulating an ethernet hub). It provides the same services as the 'vnet' module and assigns IP addresses like 'slirp' (10.0.2.x) (see Using the 'socket' networking module). | Yes, for base UDP port and (optional) the host to connect | No | 2.6.9 |
win32 | Win32 packetmover - WinPCap driver required. | Yes | No | 1.3 |
5-3-35. 启动配置( Setup)— The configuration file — pcipnic
pcipnic: enabled=1, mac=b0:c4:20:00:00:00, ethmod=vnet
To support the Bochs/Etherboot pseudo-NIC, Bochs must be compiled with the --enable-pnic configure option. It accepts the same syntax (for mac, ethmod, ethdev, script, bootrom) and supports the same networking modules as the NE2000 adapter.
5-3-36. 启动配置( Setup)— The configuration file — e1000
e1000: enabled=1, mac=52:54:00:12:34:56, ethmod=slirp, script=slirp.conf
To support the Intel(R) 82540EM Gigabit Ethernet adapter, Bochs must be compiled with the --enable-e1000 configure option. It accepts the same syntax (for mac, ethmod, ethdev, script, bootrom) and supports the same networking modules as the NE2000 adapter.
5-3-37. 启动配置( Setup)— The configuration file — usb_uhci
usb_uhci: enabled=1, port1=mouse, port2=disk:usbstick.img
usb_uhci: enabled=1, port1=hub:7, port2=disk:growing:usbdisk.img
usb_uhci: enabled=1, port2=disk:undoable:usbdisk.img, options2=journal:redo.log
usb_uhci: enabled=1, port2=disk:vvfat:vvfat, options2="debug,speed:full"
usb_uhci: enabled=1, port1=printer:printdata.bin, port2=cdrom:image.iso
usb_uhci: enabled=1, port2=floppy:vvfat:diskette, options2="model:teac"
This option controls the presence of the USB root hub which is a part of the i440FX PCI chipset.
With the portX option you can connect devices to the hub (currently supported: 'mouse', 'tablet', 'keypad', 'disk', 'cdrom', 'floppy, ''hub' and 'printer').
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' mode image as a USB hardisk you can use the 'disk' device with the path to the image separated with a colon. To use other disk image modes similar to ATA disks the syntax 'disk:mode:filename' must be used (see above).
To emulate a USB cdrom you can use the 'cdrom' device name and the path to an ISO image or raw device name also separated with a colon. An option to insert/eject media is available in the runtime configuration.
To emulate a USB floppy you can use the 'floppy' device with the path to the image separated with a colon. To use the VVFAT image mode similar to the legacy floppy the syntax 'floppy:vvfat:directory' must be used (see above). An option to insert/eject media is available in the runtime configuration.
The device name 'hub' connects an external hub with max. 8 ports (default: 4) to the root hub. To specify the number of ports you have to add the value separated with a colon. Connecting devices to the external hub ports is only available in the runtime configuration.
The device 'printer' emulates the HP Deskjet 920C printer. The PCL data is sent to a file specified in bochsrc.txt. The current code appends the PCL code to the file if the file already existed. The output file can be changed at runtime.
The optionsX parameter can be used to assign specific options to the device connected to the corresponding USB port. Currently this feature is used to set the speed reported by device ('low', 'full', 'high' or 'super'). The availabe speed choices depend on both HC and device. The option 'debug' turns on debug output for the device at connection time. For the USB 'disk' device the optionsX parameter can be used to specify an alternative redolog file (journal) of some image modes. For 'vvfat' mode USB disks the optionsX parameter can be used to specify the disk size (range 128M ... 128G). If the size is not specified, it defaults to 504M. For the USB 'floppy' device the optionsX parameter can be used to specify an alternative device ID to be reported. Currently only the model "teac" is supported (can fix hw detection in some guest OS). The USB floppy also accepts the parameter "write_protected" with valid values 0 and 1 to select the access mode (default is 0).
5-3-38. 启动配置( Setup)— The configuration file — usb_ohci
usb_ohci: enabled=1, port1=printer:printdata.bin
This option controls the presence of the USB OHCI host controller with a 2-port hub. The portX parameter accepts the same device types with the same syntax as the UHCI controller (see the usb_uhci option). The optionsX parameter is also available on OHCI.
5-3-39. 启动配置( Setup)— The configuration file — usb_ehci
usb_ehci: enabled=1, port1=tablet, options1="speed:high"
This option controls the presence of the USB EHCI host controller with a 6-port hub. The portX parameter accepts the same device types with the same syntax as the UHCI controller (see the usb_uhci option). The optionsX parameter is also available on EHCI.
5-3-40. 启动配置( Setup)— The configuration file — usb_xhci
usb_xhci: enabled=1, port1="disk:usbdisk.img"
This option controls the presence of the USB xHCI host controller with a 4-port hub. The portX parameter accepts the same device types with the same syntax as the UHCI controller (see the usb_uhci option). The optionsX parameter is also available on xHCI. NOTE: port 1 and 2 are USB3 and only support super-speed devices, but port 3 and 4 are USB2 and support speed settings low, full and high.
5-3-41. 启动配置( Setup)— The configuration file — pcidev
pcidev: vendor=0xbabe, device=0x2bad
Enables the mapping of a host PCI hardware device within the virtual PCI subsystem of the Bochs x86 emulator. The arguments 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.
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.
5-3-42. 启动配置( Setup)— The configuration file — gdbstub
gdbstub: enabled=1, port=1234, text_base=0, data_base=0, bss_base=0
gdbstub: enabled=0
This enables the GDB stub. See Section 8.15.
5-3-43. 启动配置( Setup)— The configuration file — magic_break
magic_break: enabled=1
This enables the "magic breakpoint" feature when using the debugger. The useless cpu instruction XCHG BX, BX causes Bochs to enter the debugger mode. This might be useful for software development.
5-3-44. 启动配置( Setup)— The configuration file — debug_symbols
debug_symbols: file=mysymbols.sym
debug_symbols: file=mysymbols.sym, offset=0x1000
This loads symbols from the specified file for use in Bochs' internal debugger. Symbols are loaded into global context. This is equivalent to issuing ldsym debugger command at start up.
5-3-45. 启动配置( Setup)— The configuration file — port_e9_hack
port_e9_hack: enabled=1
The 0xE9 port doesn't exists in normal ISA architecture. However, we define a convention here, to display on the console of the system running Bochs anything that is written to it. The idea is to provide debug output very early when writing BIOS or OS code for example, without having to bother with setting up a serial port or etc. Reading from port 0xE9 will will return 0xe9 to let you know if the feature is available. Leave this 0 unless you have a reason to use it.
5-3-46. 启动配置( Setup)— The configuration file — user_plugin
user_plugin: name=testdev
Load user-defined plugin. This option is available only if Bochs is compiled with plugin support. Maximum 8 different plugins are supported. See the example in the Bochs sources how to write a plugin device.
5-4. 启动配置( Setup)— How to write your own keymap table
Christophe Bothamy wrote the keymapping code for Bochs, and provided this documentation for how to create new keymaps. Keymapping was first implemented for X windows only, so there are many references to X-specific values in this section. In Bochs 2.0 keymapping is also available for SDL (Linux port) and wxWidgets (wxGTK port).
The standard US Keyboard looks like this:
-------------------------------------------
Top row Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
-------------------------------------------
2nd row ` 1 2 3 4 5 6 7 8 9 0 - = \ Back
-------------------------------------------
3rd row Tab Q W E R T Y U I O P [ ] Enter
-------------------------------------------
4rd row Caps A S D F G H J K L ; '
-------------------------------------------
5rd row lShift l\ Z X C V B N M , . / rShift
-------------------------------------------
6rd row lCtrl lAlt Space rAlt rCtrl
-------------------------------------------
Each key of the US keyboard maps to a Bochs constant named BX_KEY_symbol. You can find the current list of BX_KEY_symbol in the BX_KEY table, below. Please note that there is only one BX_KEY_symbol for each physical key.
Now, for each key of the US keyboard, look at which symbols you can type on your real keyboard. Each symbol maps to a X-windows XK_symbol constant. In X11/keysymdef.h, you will find the list of all possible XK_symbol on your system. Alternatively, you can use a small utility called "xev" that prints out the symbol names of a pressed key. Note that the symbol name given by xev does not contain the XK_ prefix. Don't forget to add a line for every symbol you can type on each key. For the key BX_KEY_A, you can type both lowercase 'a' and uppercase 'A', so you would need two different entries.
You can then create your own map file. Keymap files are found in the "gui/keymaps" directory in the source code, or in the "keymaps" directory in binary releases. Look at the existing keymap file as an example, and create a file containing one line for each symbol. The first column tells what key or combination of keys can be used to produce a given symbol. The second column is the ASCII equivalent for that symbol, or a special keyword (none, space, return, tab, backslash, or apostrophe). The third column is the X windows keysym for that symbol.
BX_KEY_0 '0' XK_0
BX_KEY_1 '1' XK_1
BX_KEY_2 '2' XK_2
BX_KEY_0+BX_KEY_SHIFT_L ')' XK_parenright
BX_KEY_1+BX_KEY_SHIFT_L '!' XK_exclam
BX_KEY_2+BX_KEY_SHIFT_L '@' XK_at
BX_KEY_A 'a' XK_a
BX_KEY_B 'b' XK_b
BX_KEY_A+BX_KEY_SHIFT_L 'A' XK_A
BX_KEY_B+BX_KEY_SHIFT_L 'B' XK_B
BX_KEY_TAB tab XK_Tab
BX_KEY_ENTER return XK_Return
BX_KEY_F1 none XK_F1
BX_KEY_F2 none XK_F2
BX_KEY_F3 none XK_F3
Now that there are several keymap files in the Bochs distribution, it is easiest to copy an existing keymap and follow the examples you see. When it works, be sure to send it to the mailing list or post it on Source Forge so that we can include it in the next release. You may need to look up some of your country specific X11 symbols in X11/keysymdef.h.
| BX_KEY constant | Keyboard Symbol |
| --------------------- | ----------------------- |
| BX_KEY_CTRL_L | left Ctrl |
| BX_KEY_SHIFT_L | left Shift |
| BX_KEY_F1 | F1 |
| BX_KEY_F2 | F2 |
| BX_KEY_F3 | F3 |
| BX_KEY_F4 | F4 |
| BX_KEY_F5 | F5 |
| BX_KEY_F6 | F6 |
| BX_KEY_F7 | F7 |
| BX_KEY_F8 | F8 |
| BX_KEY_F9 | F9 |
| BX_KEY_F10 | F10 |
| BX_KEY_F11 | F11 |
| BX_KEY_F12 | F12 |
| BX_KEY_CTRL_R | right Ctrl |
| BX_KEY_SHIFT_R | right Shift |
| BX_KEY_CAPS_LOCK | CapsLock |
| BX_KEY_NUM_LOCK | NumLock |
| BX_KEY_ALT_L | left Alt |
| BX_KEY_ALT_R | right Alt |
| BX_KEY_A | A |
| BX_KEY_B | B |
| BX_KEY_C | C |
| BX_KEY_D | D |
| BX_KEY_E | E |
| BX_KEY_F | F |
| BX_KEY_G | G |
| BX_KEY_H | H |
| BX_KEY_I | I |
| BX_KEY_J | J |
| BX_KEY_K | K |
| BX_KEY_L | L |
| BX_KEY_M | M |
| BX_KEY_N | N |
| BX_KEY_O | O |
| BX_KEY_P | P |
| BX_KEY_Q | Q |
| BX_KEY_R | R |
| BX_KEY_S | S |
| BX_KEY_T | T |
| BX_KEY_U | U |
| BX_KEY_V | V |
| BX_KEY_W | W |
| BX_KEY_X | X |
| BX_KEY_Y | Y |
| BX_KEY_Z | Z |
| BX_KEY_0 | 0 |
| BX_KEY_1 | 1 |
| BX_KEY_2 | 2 |
| BX_KEY_3 | 3 |
| BX_KEY_4 | 4 |
| BX_KEY_5 | 5 |
| BX_KEY_6 | 6 |
| BX_KEY_7 | 7 |
| BX_KEY_8 | 8 |
| BX_KEY_9 | 9 |
| BX_KEY_ESC | Esc |
| BX_KEY_SPACE | SpaceBar |
| BX_KEY_SINGLE_QUOTE | ' |
| BX_KEY_COMMA | , |
| BX_KEY_PERIOD | . |
| BX_KEY_SLASH | / |
| BX_KEY_SEMICOLON | ; |
| BX_KEY_EQUALS | = |
| BX_KEY_LEFT_BRACKET | [ |
| BX_KEY_BACKSLASH | \ |
| BX_KEY_RIGHT_BRACKET | ] |
| BX_KEY_MINUS | - |
| BX_KEY_GRAVE | ` |
| BX_KEY_BACKSPACE | BackSpace |
| BX_KEY_ENTER | Enter |
| BX_KEY_TAB | Tab |
| BX_KEY_LEFT_BACKSLASH | left \ |
| BX_KEY_PRINT | PrintScreen |
| BX_KEY_SCRL_LOCK | ScrollLock |
| BX_KEY_PAUSE | Pause |
| BX_KEY_INSERT | Ins |
| BX_KEY_DELETE | Del |
| BX_KEY_HOME | Home |
| BX_KEY_END | End |
| BX_KEY_PAGE_UP | PageUo |
| BX_KEY_PAGE_DOWN | PageDown |
| BX_KEY_KP_ADD | Numeric Keypad + |
| BX_KEY_KP_SUBTRACT | Numeric Keypad - |
| BX_KEY_KP_END | Numeric Keypad 1 |
| BX_KEY_KP_DOWN | Numeric Keypad 2 |
| BX_KEY_KP_PAGE_DOWN | Numeric Keypad 3 |
| BX_KEY_KP_LEFT | Numeric Keypad 4 |
| BX_KEY_KP_5 | Numeric Keypad 5 |
| BX_KEY_KP_RIGHT | Numeric Keypad 6 |
| BX_KEY_KP_HOME | Numeric Keypad 7 |
| BX_KEY_KP_UP | Numeric Keypad 8 |
| BX_KEY_KP_PAGE_UP | Numeric Keypad 9 |
| BX_KEY_KP_INSERT | Numeric Keypad 0 |
| BX_KEY_KP_DELETE | Numeric Keypad . |
| BX_KEY_KP_ENTER | Numeric Keypad Enter |
| BX_KEY_KP_MULTIPLY | Numeric Keypad * |
| BX_KEY_KP_DIVIDE | Numeric Keypad / |
| BX_KEY_UP | UpArrow |
| BX_KEY_DOWN | DownArrow |
| BX_KEY_LEFT | LeftArrow |
| BX_KEY_RIGHT | RightArrow |
| BX_KEY_WIN_L | Left Windows |
| BX_KEY_WIN_R | Right Windows |
| BX_KEY_MENU | Menu |
| BX_KEY_ALT_SYSREQ | Alt-Sysreq |
| BX_KEY_CTRL_BREAK | Ctrl-Break |
| BX_KEY_INT_BACK | Internet - back |
| BX_KEY_INT_FORWARD | Internet - forward |
| BX_KEY_INT_STOP | Internet - stop |
| BX_KEY_INT_MAIL | Internet - mail |
| BX_KEY_INT_SEARCH | Internet - search |
| BX_KEY_INT_FAV | Internet - favorites |
| BX_KEY_INT_HOME | Internet - home |
| BX_KEY_POWER_MYCOMP | Powerkeys - my computer |
| BX_KEY_POWER_CALC | Powerkeys - calculator |
| BX_KEY_POWER_SLEEP | Powerkeys - sleep |
| BX_KEY_POWER_POWER | Powerkeys - power |
| BX_KEY_POWER_WAKE | Powerkeys - wake |