记录下ubuntu16.04下bochs环境配置遇到的小问题

最近在看《一个操作系统的实现》时决定动手实际试一试,有关bochs,nasm的源代码安装,网上其他的博客已经讲的很清楚了,下面主要复现一下我遇到的问题以及解决办法。前面都进行的很顺利,一直到我按照网上的方法安装配置完毕,然后在终端输入

$bochs

 出现画面

恩,没问题,对着,继续回车,输入c,出现问题

 从得到的信息:BIOS  NO bootable device 初步推断可能是引导文件某处的错误,把网上多篇博客的安装步骤又看了一遍,大致判断是bochsrc文件配置的问题

搜索关键词 bochs ubuntu bochsrc配置    继续学习

然后了解到bochsrc文件的重点在于romimagevgaromimage

这两个后面的 BIOS-bochs-latest 和 VGABIOS-lgpl-latest 文件的绝对路径是不能直接按照网上的方法直接复制粘贴,要找到自己电脑上这两个文件的位置,并按绝对路劲写出来。(这点想明白后后简单,但新手往往为徒方便直接复制粘贴网上的导致最后失败)

还有 floppya: 1_44=/home/zpl/coding/os/a.img, status=inserted 这句

其中的文件a.img前也要写自己电脑上的绝对路径,我的bochsrc文件如下

# 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, address=0xfffe0000
vgaromimage: file=/usr/local/share/bochs/VGABIOS-lgpl-latest

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

# choose the boot disk
boot: floppy

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

# disable the mouse
mouse: enabled=0

# enable key mapping, using US layout as default
keyboard: type=mf, serial_delay=200, paste_delay=100000

然而一番修改后,之前的错误仍然出现,原理上没有问题,但依然是找不到引导文件,这让我有些疑惑,继续查看其他人博客上的安装配置步骤,直到我看到了这句话

 http://mayuan.is-programmer.com/posts/23314.html

如果我们在启动Bochs时没有在命令行上指定配置文件,那么Bochs会按以下的顺序寻找默认配置文件:

  1. .bochsrc in the current directory

  2. bochsrc in the current directory

  3. bochsrc.txt in the current directory

  4. (win32 only) bochsrc.bxrc in the current directory

  5. (Unix only) .bochsrc in the user's home directory

  6. (Unix only) bochsrc in the /etc directory 

配置环境已经在bochsrc文件里说的很清楚了,而出现NO bootable device的错误会不会是因为bochs没有找到我的配置文件bochsrc,

于是直接cd到我bochsrc文件的目录下继续运行bochs,结果成功

 

原文地址:https://www.cnblogs.com/pathjh/p/7712733.html