关于我在安装2.6.9版本bochs虚拟机时遇到的问题以及解决过程

Posted brandon0807

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于我在安装2.6.9版本bochs虚拟机时遇到的问题以及解决过程相关的知识,希望对你有一定的参考价值。

更新于:2019.7.2

在阅读《一个64位操作系统的设计与实现》过程中,搭建实验环境遇到的诸多困难。

本人的实验环境:vmware15.0 下安装有kali-liunx虚拟机里进行的安装实验,如果有小伙伴对这款操作系统感兴趣

kail操作系统镜像:

链接:https://pan.baidu.com/s/1jkYI2RQ_lcgCPaENMQwEYg
提取码:94s9


=====================     正文   ======================

1、安装bochs

下载各个版本的bochs:传送门0            bochs的用户使用手册:传送门1              有关configure选项的含义:传送门2

在kail linux操作系统下,我选择bochs-2.6.9.tar.gz,为了实现调试功能我们必须自己下载源码编译。

技术图片

或者您也可以使用SVN checkout命令获取自2000年3月以来任何版本的Bochs源代码。命令是:

svn co http://svn.code.sf.net/p/bochs/code/tags/tagname/bochs bochs

下载解压:

tar -xvf bochs-2.6.8.tar.gz

在含有comfigure文件的目录下打开命令行输入回车:

./configure --with-x11 --with-wx --enable-plugins --enable-debugger --enable-debugger-gui --enable-readline --enable-disasm --enable-xpm --enable-show-ips --enable-logging --enable-assert-checks --enable-idle-hack --enable-cpu-level=6 --enable-fpu --enable-x86-64 --enable-vmx=2 --enable-svm --enable-avx --enable-x86-debugger --enable-alignment-check --enable-configurable-msrs --enable-long-phy-address --enable-a20-pin --enable-large-ramfile --enable-repeat-speedups --enable-fast-function-calls --enable-handlers-chaining --enable-all-optimizations --enable-pci --enable-iodebug --enable-usb 

下表是文档中相关参数的具体含义,根据该文档我更改了一些参数:

去除掉了:--enable-cpp --enable-smp --enable-3dnow --enable-monitor-mwait --enable-voodoo --enable-ltdl-install --enable-trace-linking --enable-evex 

            Table 3-7. Configure Options to Select the Display Library (optional)

OptionComments
--with-x11 Use X windows user interface. On many operating systems, Bochs will use X windows by default.
--with-win32 Use the native Win32 GUI. This is the default on win32 platforms.
--with-carbon Compile for MacOS X with the Carbon GUI. See the .conf.macosx file for the correct MacOS X compile options. WARNING: This Bochs feature is not maintained yet and may fail.
--with-amigaos Compile for Amiga MorphOS. This code is written by Nicholai Benalal.
--with-rfb Enable support for the RFB protocol to talk to AT&T‘s VNC Viewer. Refer to Section 3.4.9 for details.
--with-vncsrv Enable support for an extended RFB(VNC) GUI using the LibVNCServer library. Refer to Section 3.4.10 for details.
--with-sdl Enable support for the SDL 1.2.x GUI interface; see Section 3.4.11.
--with-sdl2 Enable support for the SDL 2.x GUI interface; see Section 3.4.12.
--with-term Use text-only gui with curses library. Almost certainly won‘t work right with the debugger or the textconfig interface.
--with-macos Use Macintosh/CodeWarrior environment. This is for running configure on a platform which supports running configure, so that you may then transfer the configured code over to the real compile environment. WARNING: This Bochs feature is not maintained yet and may fail.
--with-wx Enable support for wxWidgets configuration and display interface; see Section 3.4.13.
--with-svga Use SVGALIB library for Linux. This allows a full-screen text and graphics display without X windows. The SVGALIB port was written by Igor Popik. WARNING: This Bochs feature is not maintained yet and may fail.
--with-nogui No native GUI; just use blank stubs. This is if you don‘t care about having video output, but are just running tests.
--with-all-libs Automatically detect which libraries are installed on your system and enable them. This option is still experimental; it might enable libraries that are not usable and cause the compile to fail. If you have trouble, just list the --with-* options for the specific display libraries that you want.

            Table 3-8. Configure Options (General)

OptionDefaultComments
--enable-plugins no Plugins are shared libraries that can be loaded on demand. Example: the serial device is implemented as a plugin. In Unix, the serial plugin is called libbx_serial.so. When Bochs reads its configuration file, if the serial device is enabled it loads libbx_serial.so. See the Features section for supported platforms.
--enable-debugger no Compile in support for Bochs internal command-line debugger. This has nothing to do with x86 hardware debug support. It is a more powerful and non-intrusive native debugger. Enabling this will of course slow down the emulation. You only need this option if you know you need it. After you have run ./configure, you may want to edit config.h to customize the debugger further; see Section 8.14 for more information.
--enable-debugger-gui yes if debugger is on Enable support for the gui frontend of the Bochs debugger. This feature is supported on Windows hosts and on hosts with GTK2 installed.
--enable-readline detected by configure Compile the debugger with the GNU readline library, which gives command line editing and history.
--enable-gdb-stub no Enable support for the remote GDB stub. See Using Bochs and the remote GDB stub. NOTE: This feature cannot be used if the Bochs debugger is also enabled. WARNING: This Bochs feature is not maintained yet and may fail.
--enable-disasm yes Compile in support for built-in disassembler. Bochs has a built-in disassembler, which is useful if you either run the built-in debugger (--enable-debugger), or want disassembly of the current instruction when there is a panic in bochs.
--enable-docbook detected Build the docbook documentation in doc/docbook. The configure script will enable this option automatically if you have a program called docbook2html installed.
--enable-instrumentation=directory no Compile in support for instrumentation. This allows you to collect instrumentation data from bochs as it executes code. You have to create your own instrumentation library and define the instrumentation macros (hooks in bochs) to either call your library functions or not, depending upon whether you want to collect each piece of data.
--enable-xpm yes Enables the check for the XPM library. This option is only valid if the x display library is enabled (--with-x11).
--enable-show-ips yes Enables logging of measured IPS, see the ips parameter of the cpu option.
--enable-logging yes By default, Bochs generates logfile output that can be configured with bochsrc options and at runtime. Use --disable-logging to turn off this feature completely.
--enable-assert-checks yes if debugger is on BX_ASSERT event causes a panic on assertion failure if enabled (logging feature must be enabled, too).
--enable-cpp no Use .cpp as C++ suffix. Renames all the .cc files to .cpp for use with compilers which want that, like older MS C++ compilers. Don‘t use this option unless you know you need it.
--enable-idle-hack no Enables Roland Mainz‘s experimental idle code, which is intended to keep Bochs from always using 100% of CPU time. When Bochs is waiting around for an interrupt, the idle code uses a select() loop and some X11 tricks to wait until user input arrives. This is designed to keep Bochs responsive while still yielding to other processes when Bochs is idle. It only works with X11 or term GUI.

            Table 3-9. Configure Options (CPU & Memory)

OptionDefaultComments
--enable-cpu-level=3,4,5,6 6 Select which CPU level to emulate. Choices are 3,4,5,6 which mean to target 386, 486, Pentium, or Pentium Pro and later emulation.
--enable-smp no Compile in support for SMP simulation. This allows you to boot Linux and maybe other OSes in SMP mode, and bochs will simulate all the different CPUs and communication between them. Do not expect this option to speed up your simulation! On the contrary, it has to spend extra time simulating the different CPUs (even if they‘re mostly idle) and the communication between them. Use it to try out an SMP OS if you don‘t have an SMP machine, or to debug SMP OS drivers. Refer to Section 8.9 for more details on SMP in Bochs.
--enable-fpu yes If you want to compile Bochs to make use of the FPU emulator written by Stanislav Shwartsman, use this option.
--enable-3dnow no 3DNow! instruction set support (incomplete)
--enable-x86-64 no Add support for x86-64 instruction set, written by Peter Tattam and Stanislav Shwartsman.
--enable-vmx no Intel Virtualization Extensions (VMX) support
--enable-svm no AMD SVM (Secure Virtual Machine) extensions emulation support
--enable-avx no AVX instructions support
--enable-x86-debugger no X86 debugger support. If the software you run in bochs needs to use the x86 hardware debugging facilities such as DR0..DR7, instruction and data breakpoints etc., then you should use this option. Otherwise don‘t use it, as it will slow down the emulation.
--enable-monitor-mwait no MONITOR/MWAIT instructions support (still experimental)
--enable-alignment-check yes if cpu level >= 4 support for alignment check in the CPU and #AC exception
--enable-configurable-msrs no support for user configurations of emulated MSR registers (see example in msrs.def)
--enable-long-phy-address no support for guest physical address larger than 32 bit
--enable-a20-pin yes support for the A20 pin
--enable-large-ramfile yes support for guest memory larger than the host supports
--enable-repeat-speedups no enable support repeated I/O and memory copy speedups
--enable-fast-function-calls no enable support for fast function calls (gcc on x86 only)
--enable-handlers-chaining no enable support for handlers chaining optimization
--enable-all-optimizations no Turn on the enables for all speed optimizations that the developers believe are safe to use: --enable-repeat-speedups, --enable-fast-function-calls, --enable-handlers-chaining.

            Table 3-10. Configure Options (Devices)

OptionDefaultComments
--enable-cdrom yes Enable use of a real CDROM/DVD drive. The cdrom emulation and the portable ISO image file support are always present. You can use this option to compile in support for accessing the media in your workstation‘s cdrom drive. The supported platforms are Linux, Solaris, FreeBSD, OpenBSD, MacOS X and Windows. For other platforms, a small amount of code specific to your platform must be written.
--enable-sb16 no Enable Sound Blaster emulation. The available lowlevel sound interfaces are autodetected. See section Using Sound for supported platforms and more info. This option also enables the standard PC gameport which is a part of the SB16. If you don‘t want to use it, you might use --disable-gameport.
--enable-es1370 no Enable ES1370 sound emulation. Just like the SB16 option, the available lowlevel sound interfaces are autodetected and the gameport is turned on.
--enable-gameport no Enables the standard PC gameport. This option is only necessary if you want to have a gameport, but no SB16 or ES1370 (see above). The connection to a real joystick is currently supported on Linux and win32 only.
--enable-ne2000 no Enable NE2000 network card support. This requires a low-level component to be written for each OS (supported on FreeBSD, OpenBSD, Linux, and Windows 9x/NT/2K/XP). When enabled and configured, the NE2000 device model can talk to any computer on the network EXCEPT FOR the local host. Exception: Under most circumstances, Bochs can talk to the local host on Windows, and in the ethertap interface for Linux.
--enable-pnic no Enable PCI pseudo NIC (network card) support.
--enable-e1000 no Enable Intel(R) 82540EM Gigabit Ethernet adapter support.
--enable-clgd54xx no Enable Cirrus Logic GD54xx (CL-GD5430 ISA or CL-GD5446 PCI) video card support. For more information see Section 8.20.
--enable-voodoo no Enable experimental 3dfx Voodoo Graphics emulation. Currently only the Voodoo1 model is known to work (Voodoo2 is under construction).
--enable-iodebug yes if debugger is on Dave Poirier has written an experimental interface to the debugger using I/O ports, so that software running in the guest OS can access features of the debugger. You only want this option if you are developing guest OS code for use in Bochs. In other words, most people don‘t. Also, it should only be used with --enable-debugger. See the developer documentation for details.
--enable-pci yes Enable limited i440FX / i430FX PCI support. This is still incomplete, but usable.
--enable-pcidev no Enable PCI host device mapping support. This requires --enable-pci to be set as well as Linux 2.4, 2.6 or 3.x as host. WARNING: This Bochs feature is not maintained yet and may fail.
--enable-usb no Enable i440FX PCI USB support (UHCI). The host controller with 2-port root hub and 8 USB device types are available.
--enable-usb-ohci no Enable USB OHCI support. The host controller with 2-port root hub is available (USB device types: same as UHCI).
--enable-usb-ehci no Enable USB EHCI support. The host controller with 6-port root hub is available (USB device types: same as UHCI).
--enable-usb-xhci no Enable USB xHCI support. The host controller with 4-port root hub is available (USB device types: same as UHCI).
--enable-raw-serial no Enable support for the serial port emulation to access to the host‘s serial port. This feature is partly implemented for Windows hosts only.

 

等待结束后,输入命令:

make

2、不得不说一下make命令:

我们先要配置好configure文件用于生成makefile文件。然后,make。如果你安装失败需要重新make,建议先运行:make all-clean,最后make install

3、此处根据个人编译环境不同可能报错如下:

<1> 出现

1“ERROR: X windows gui was selected, but X windows libraries were not found.

解决办法:

sudo apt-get install libx11-dev xserver-xorg-dev xorg-dev

 

<2> 出现

1 “ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package. Install pkg-config and the gtk+
development package, or disable the gui debugger, or the wxWidgets display library (whichever is being used).”
2 ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package.Install pkg-config and the gtk+
development package,or disable the gui debugger, or the wxWidgets display library (whichever is being used)

解决办法:

sudo apt-get install libgtk2.0-dev

<3> 出现

 1 checking for C compiler default output file name… configure: error: C compiler cannot create executables

解决?法:

sudo apt-get install libc6-dev


<4> 出现 

1 configure: error: C++ preprocessor "/lib/cpp" fails sanity check

解决?法

sudo apt-get install build-essential

<5> 出现

 1 X windows gui was selected, but X windows libraries were not found.

解决?法:

sudo apt-get install xorg-dev

?家在解决完?项之后再次输?:./configure .......

等待完成输入: 

make

<6>如果提?:

/usr/bin/ld: gui/libgui.a(gtk_enh_dbg_osdep.o): undefined reference to symbol [email protected]@GLIBC_2.1
//lib/i386-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error:ld
returned 1 exit statusmake: *** [bochs]

解决?法:
在?件管理器的搜索栏?搜索:makefile
会搜出很多名叫“makefile”的?件,找到??为29kb的那个“makefile”,注意,有的图标上会带着?个锁,
有的没有,我们找不带锁的那个,打开后下拉到90?左右,内容为:

LIBS = -lm -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype


在这条指令后?加上:-lz -lrt -lpthread,完整的如下:

LIBS = -lm -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lz -lrt -lpthread

保存后退出,此时再次在命令??输?:

make

 

 <7> 如果你启用了‘--enable-cpp’将会出现:

make: *** No rule to make target ‘misc/bximage.cc‘, needed by ‘misc/bximage.o‘.  Stop.

 解决方法:

cp misc/bximage.cpp misc/bximage.cc

cp iodev/hdimage/hdimage.cpp iodev/hdimage/hdimage.cc

cp iodev/hdimage/vmware3.cpp iodev/hdimage/vmware3.cc

cp iodev/hdimage/vmware4.cpp iodev/hdimage/vmware4.cc

cp iodev/hdimage/vpc-img.cpp iodev/hdimage/vcp-img.cc

cp iodev/hdimage/vbox.cpp iodev/hdimage/vbox.cc

继续出现:

 技术图片

我猜测这是我之前选择 --enable-cpp 搞出来的事情,所以我们还是不要--enable-cpp了,重新configure一下,再来过。

可以看到安装成功后的目录结构:

技术图片

以上是关于关于我在安装2.6.9版本bochs虚拟机时遇到的问题以及解决过程的主要内容,如果未能解决你的问题,请参考以下文章

《操作系统真象还原》bochs安装

虚拟机安装(Vmware14)

VMware Workstation安装虚拟机时遇到的”拦路虎“

我在启动VMware workstation虚拟机时,提示:无法打开内核设备\\. \

关于centos7 开机时遇到initramfs-xxx.img not found错误导致虚拟机无法开启

新的 Angular CLI 项目 core-js@2.6.9 安装后错误