bochs 2.4.2 ubuntu 安裝運行問題《orange's 一個操作系統的實現》第二章 調試篇

用源碼安裝完後會遇到的問題:

《1》 運行可能碰到如下問題:
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
這樣纔算安裝 完畢了。
《2》 、啓動問題
點進入系統後控制檯出現下面的提示:
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那個
《3》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, address=0xf0000
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

 

後在是《orange's 一個操作系統的實現》第二章關於bochsrc配置文件內容的修改:

安裝好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
#vgaromimage: /usr/local/share/vgabios/vgabios.bin
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest

# 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/roothoo/a   #我們切換到a.img 和 bochsrc所在的文件夾,
bochs     -f    bochsrc    #以bochsrc爲配置文件啓動bochs
然後選擇6,
然後再按c鍵,
OK!!!
ENJOY! -_-

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章