在LINUX下安装BOCHS

    技术2022-05-18  17

                                           在LINUX下安装BOCHS 首先BOCHS是一个X86模拟器,可以用他来安装各种在x86系统上运行的的操作系统,当然还有其他的模拟器,但是我对BOCHS是比较偏爱的,应为他的调试功能能够让我监视操作系统在硬件层的运行状态.就象gdb一样.我是个freesoft爱好者,所以我决定死活都要在LINUX上安装BOCHS.下面开始了.

    你可以到bochs.sourceforge.net上下载最新的代码.然后输入tar -xvzf filename.tar.gz解压缩.应为我是需要带调试功能BOCHS,所以在输入configure的时候必需带上--enable-debugger --enable-disasm.这两个选项就是为后面生成带调试功能的BOCHS做准备的.此外我还选择了--with-sdl.整个操作如下:

    ./configure --enable-debugger --enable-disasm –with-sdl

    configure完了后再输入make.这样BOCHS就算是装完了.在你的当前工作目录下可以看到bochs文件,BOCHS运行需要.bochsrc文件,在LINUX下以.开头的文件都是隐藏文件,输入ls -a可以查看隐藏文件.在这里我不想讲.bochsrc文件,你可以在源程序目录的doc目录上找到它的说明文.或者到bochs.sourceforge.net上找到相关的说明文.

    输入bochs -q,可以看到一下的文字

    ========================================================================

    Bochs x86 Emulator 2.2.5

    Build from CVS snapshot on December 30, 2005

    ========================================================================

    00000000000i[ ] reading configuration from .bochsrc

    00000000000i[ ] WARNING: syntax has changed, please use 'vgaromimage: file=...' now

    00000000000e[ ] .bochsrc: floppy_command_delay is deprecated (now using hardware timing).

    00000000000e[ ] .bochsrc: usb ioaddr is now deprecated (assigned by BIOS).

    00000000000e[ ] .bochsrc: usb irq is now deprecated (assigned by BIOS).

    00000000000i[ ] installing sdl module as the Bochs GUI

    00000000000i[ ] Warning: no rc file specified.

    00000000000i[ ] using log file bochsout.txt

    Next at t=0

    (0) [0xfffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0

    <bochs:1>

    我在这浪费了很多时间,初次看到这断代码我以为是出了什么问题.因为这跟我早期用的BOCHS完全不一样,而且现在的安装过程比早期版本简单多了. 这个就是BOCHS的调试界面,输入c,哈哈,如果你的虚拟硬盘上装有OS并且没有其他问题.那么你可以看你OS 在BOCHS上开始跑了起来了.

    总结:

    玩LINUX要英语好,要有耐心看文档.自助者天助之.

     

    error:

     

    --checking for C compiler default output file name… configure: error: C compiler cannot create executables         解决方法: apt-get install libc6-dev --configure: error: C++ preprocessor "/lib/cpp" fails sanity check         解决方法:apt-get install build-essential -- X windows gui was selected, but X windows libraries were not found.        解决方法:参照04年课程论坛上的解决方法,配置的时候加上--with-nogui(不过后来试了,改成apt-get install xorg-dev也行 )

    ubuntu 9.04 安装带调试功能的bochs 2009-09-18 19:21 学习操作系统,下载了bochs最新版本,但是不会编译安装,老是出错,用了一会简单的无调试功能的bochs但是感觉缺少点什么,想用带调试功能的,网上搜索了好多资料,终于自己完成了编译安装的bochs,不容易啊,赶紧分享一下,linux版本是ubuntu 9.04 虚拟己版本是bochs 2.4.1 不带调试功能的简单安装方法: sudo apt-get install bochs 带调试功能的bochs安装 sudo apt-get install build-essential  安装编译环境 tar vxzf bochs-2.4.1.tar.gz cd bochs-2.3.5 ./configure --enable-debugger --enable-disasm 这一步问题出来了,没注意配置时出现的问题就接着make了,导致make的时候,老是说83行遗漏分隔符。后来注意到了configure 的时候最后一行出现了一句:

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

    后来解决了, sudo aptitude install xorg-dev (参考http://blog.163.com/i.kenting/blog/static/1226902032009625102310341/)

    When install bochs, While I compile come file with ./configure there give a msg:

    > configure: WARNING: Bochs for wxWidgets cannot be compiled here, disabling it

    > checking for default gui on this platform... x11

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

    I just follow this :

    You need to install the development libraries. To compile a wxWidgets

    program you need libwxbase2.4-dev, libwxbase2.4-dev, and

    libwxgtk2.4-contrib-dev (for a wx2.4 program) or libwxgtk2.6-dev (for a

    wx2.6 program). For an X11 program you need x-window-system-dev, which

    should pull in all the dependencies you need.

    but I couldn't install the x-window-system-dev with: sudo apt-get install x-window-system-dev

    the to solved this just:

    sudo aptitude install xorg-dev  everything is fine with the ./configure now .

     

    sudo apt-get install xorg-dev无法安装,吼吼,又学到了个aptitude 。 再./configure 试试,晕,又有错误,错误提示是 checking for display libraries...  X11 Package gtk+-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+-2.0' found 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). 这个安装了个 gtk就解决了 sudo aptitude install libgtk2.0-dev (这个是自己猜的,安装上果然可以了,呵呵,还有点天分) 然后make,make 的时候也出了点问题。 proc_ctrl.cc:654: 错误: ‘CheckPDPTR’在此作用域中尚未声明 proc_ctrl.cc:668: 错误: ‘CheckPDPTR’在此作用域中尚未声明 make[1]: *** [proc_ctrl.o] 错误 1 make[1]:正在离开目录 `/media/disk-1/Linux/bochs-2.4.1/cpu' make: *** [cpu/libcpu.a] 错误 2 上网搜的是那个文件出了错proc_ctrl.cc参考 http://forum.ubuntu.org.cn/viewtopic.php?f=56&t=210457 make时的错误 proc_ctrl.cc:654: error: ‘CheckPDPTR’ was not declared in this scope proc_ctrl.cc:668: error: ‘CheckPDPTR’ was not declared in this scope make[1]: *** [proc_ctrl.o] Error 1 Google无果,还望哪位大哥指点一二 GCC版本gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3 自己解决: 代码: 650行开始 #if BX_SUPPORT_VMX VMexit_CR3_Write(i, val_32); if (BX_CPU_THIS_PTR cr0.get_PG() && BX_CPU_THIS_PTR cr4.get_PAE() && !long_mode()) { if (! CheckPDPTR(val_32)) { BX_ERROR(("SetCR3(): PDPTR check failed !")); exception(BX_GP_EXCEPTION, 0, 0); } } SetCR3(val_32); BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_MOV_CR3, val_32); break; #endif #if BX_CPU_LEVEL > 3 case 4: // CR4 #if BX_SUPPORT_VMX val_32 = VMexit_CR4_Write(i, val_32); if (BX_CPU_THIS_PTR cr0.get_PG() && (val_32 & (1<<5)) != 0 /* PAE */ && !long_mode()) { if (! CheckPDPTR(BX_CPU_THIS_PTR cr3)) { BX_ERROR(("SetCR4(): PDPTR check failed !")); exception(BX_GP_EXCEPTION, 0, 0); } } // Protected mode: #GP(0) if attempt to write a 1 to // any reserved bit of CR4 if (! SetCR4(val_32)) exception(BX_GP_EXCEPTION, 0, 0); break; #endif #endif default: BX_ERROR(("MOV_CdRd: #UD - control register %d index out of range", i->nnn())); exception(BX_UD_EXCEPTION, 0, 0); } } 683结束 代码: @@ -649,7 +649,6 @@ case 3: // CR3 #if BX_SUPPORT_VMX VMexit_CR3_Write(i, val_32); -#endif if (BX_CPU_THIS_PTR cr0.get_PG() && BX_CPU_THIS_PTR cr4.get_PAE() && !long_mode()) { if (! CheckPDPTR(val_32)) { BX_ERROR(("SetCR3(): PDPTR check failed !")); @@ -659,11 +658,11 @@ SetCR3(val_32); BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_MOV_CR3, val_32); break; +#endif #if BX_CPU_LEVEL > 3 case 4: // CR4 #if BX_SUPPORT_VMX val_32 = VMexit_CR4_Write(i, val_32); -#endif if (BX_CPU_THIS_PTR cr0.get_PG() && (val_32 & (1<<5)) != 0 /* PAE */ && !long_mode()) { if (! CheckPDPTR(BX_CPU_THIS_PTR cr3)) { BX_ERROR(("SetCR4(): PDPTR check failed !")); @@ -676,6 +675,7 @@ exception(BX_GP_EXCEPTION, 0, 0); break; #endif +#endif default: BX_ERROR(("MOV_CdRd: #UD - control register %d index out of range", i->nnn())); exception(BX_UD_EXCEPTION, 0, 0); make问题解决了,然后 sudo make install 就可以了 错误还真多,幸好一开始己把ubuntu 上网的问题解决了,呵呵,能上网一切都好解决。 有点乱,弄了一天了,先记录一下,免得忘记了。。。。 (俺是新手,开源爱好者,呵呵,有问题一起讨论)

     

     


    最新回复(0)