Ubuntu 10.4安裝Bochs2.4.5筆記 (解決很多問題)

來源:互聯網
上載者:User

1.到Bochs官方下載源碼包,因為用到了調試功能。 Bochs 2.4.5 http://sourceforge.net/projects/bochs/

2.安裝G++編譯器

 

sudo apt-get install g++

 

如果不安裝G++編譯器, 在執行configure時就會出現一些錯誤。

 

 

 

 3.執行配置,開啟調試和反組譯碼

./configure --enable-debugger --enable-disasm

 

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

出現這個錯誤時,請安裝xorg-dev包

 

sudo apt-get install xorg-dev

 

5.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 variableNo package 'gtk+-2.0' foundERROR: 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

 

6.重新執行配置(出錯處理如上)

 

 

./configure --enable-debugger --enable-disasm

 

然後運行make

 

 

make

 

再install

 

 

sudo make install

 

我試過不用sudo來直接執行,會出錯的,出錯提示不明確,應該是許可權不夠

 

 

make: *** [install_bin] 錯誤 1

 

7.完成,執行bochs,嘻嘻,來個

 

 

配置bochs:
安裝好bochs之後,我們需要對bochs進行配置,其實就是對檔案bochrsc進行修改!
《orange's :一個作業系統的實現》的附帶光碟片裡有一個已經配置好的bochrsc,但
是它是針對bochs2.3版本的,所以不能用!!!我們需要重新修改bochrsc!
首先將附帶光碟片裡的chapter1子目錄下的檔案夾a 移動到/home/roothoo/,(主要是為
是讓a.img 和 bochsrc在同一檔案夾下),然後對bochrc進行修改如下:
注意,#是注釋符號!即#之後的語句是無效的,其實#就相當於C+語言中的//
###############################################################
# Configuration file for Bochs
###############################################################

# how much memory the emulated machine will have
megs: 32

# filename of ROM images
romimage: file=/usr/local/share/bochs/BIOS-bochs-latest

#romimage: file=$BXSHARE/BIOS-bochs-latest (適用於bochs安裝在windows下)
vgaromimage: /usr/local/share/vgabios/vgabios.bin
#vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest(適用bochs安裝在windows下)

# what disk images will be used
floppya: 1_44=a.img, status=inserted

# choose the boot disk.
boot: floppy

# where do we send log messages?
# log: bochsout.txt

# disable the mouse
mouse: enabled=0

# enable key mapping, using US layout as default.
keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-us.map

修改好之後,別忘了儲存!
最後,我們運行bochs
cd      /home/使用者名稱   #我們切換到a.img 和 bochsrc所在的檔案夾,
bochs     -f    bochsrc    #以bochsrc為設定檔啟動bochs
然後選擇6,
然後再按c鍵,
OK!!!
ENJOY! -_-

 

問題一、安裝bochs在terminal下輸入下列代碼
sudo apt-get install bochs
這樣安裝結束後,在我使用bochs的時候出現了下列錯誤:
Event type: PANIC
Device: [     ]
Message: dlopen failed for module 'x': file not found
這是由於在安裝的時候,少安裝了個bochs-x包
這個包可以在http://packages.ubuntu.com/dapper/misc/bochs-x找到
也可以在terminal下面輸入
sudo apt-get install bochs-x
這樣才算安裝完畢了。
  問題二、啟動問題
點進入系統後控制台出現下面的提示:

Please choose one: [6] 6
00000000000i[ ] installing win32 module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
========================================================================
Event type: PANIC
Device: [MEM0 ]
Message: ROM: System BIOS must end at 0xfffff

A PANIC has occurred. Do you want to:
cont - continue execution
alwayscont - continue execution, and don't ask again.
This affects only PANIC events from device [MEM0 ]
die - stop execution now
abort - dump core
Choose one of the actions above: [die]
問題原因:
在2.3.5以前的bochs使用的BIOS-bochs-latest是64k的,那個時候需要加上
romimage: file=BIOS-bochs-latest,address=0xf0000(舉例)
在2.3.5中的BIOS-bochs-latest更新了,變成了128k的,這個時候配置需要改為
romimage: file=$BXSHARE/BIOS-bochs-latest (舉例,也就是要去掉address=0xf000)

解決方案:
去掉設定檔中的address那個
問題三、bochs的啟動設定檔bochsrc
一般網上的資料都會提示你安裝好後會有如下工具:
/usr/bin/bochs     Bochs啟動程式
/usr/bin/bximage     Bochs帶的製作磁碟鏡像檔案的工具
/usr/bin/bxcommit     把redolog放進flat磁碟鏡像檔案中去的互動工具
/usr/share/doc/bochs/bochsrc-sample.txt     Bochs設定檔的例子
/usr/share/bochs/BIOS-bochs-*     ROM BIOS鏡像檔案
/usr/share/bochs/VGABIOS-*     與VGA BIOS鏡像檔案相關的檔案
/usr/bin/bochs-dlx     啟動Bochs中DLX linux的程式
/usr/share/bochs/dlxlinux/     DLX Linux的目錄,包含它的磁碟鏡像檔案和設定檔
/usr/share/bochs/keymaps/*.map     X11和SDL的keymap列表
其實在終端安裝的卻沒有第四、第七和第八項,就連第二第三項也要另外安裝:
       sudo apt-get install bximage
       sudo apt-get install bxcommit
所以,網上那些bochsrx在Ubuntu是運行不了的,就因為這點,我搞近一個下午,開始我老以為是設定檔不對呢。
普通的bochsrc:
romimage: file=$BXSHARE/BIOS-bochs-latest,

vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
但是在Ubuntu下壓根就沒有VGABIOS-lgpl-latest
例如:
lzel@lzel-desktop:/usr/share/bochs$ ls
BIOS-bochs-latest  BIOS-bochs-legacy  BIOS-qemu-latest   keymaps
lzel@lzel-desktop:/usr/share/bochs$
後來我才發現,從終端下安裝bochs時它把VGA專門作為了一個程式安裝在了/usr/share/vgabios/中了。
lzel@lzel-desktop:/usr/share/bochs$ ls /usr/share/vgabios/
vgabios.bin  vgabios.cirrus.bin  vgabios.cirrus.debug.bin  vgabios.debug.bin
lzel@lzel-desktop:/usr/share/bochs$
這樣設定檔就要改為:
   romimage: file=$BXSHARE/BIOS-bochs-latest
   megs:4
   floppya: image=./boot.img,status=inserted
   vgaromimage: file=/usr/share/vgabios/vgabios.bin
  boot:a                                                                                                                                                  
  log:out.bochs

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.