GNU/Linux环境下搭建GeekOS实验环境

我使用的操作系统为Debian GNU/Linux 6,基本系统安装好后GeekOS实验环境需要安装的组件只有bochs和nasm,直接使用源中的软件包即可:

# apt-get install build-essential
# apt-get install bochs bochs-x nasm

下载geekos-0.3软件包,地址为:

http://sourceforge.net/projects/geekos/files/

下载得到一个geekos-0.3.0.zip

复制到任意目录,比如~/work,解压缩:
$ unzip geekos-0.3.0.zip 
解压缩后会得到一个geekos-0.3.0目录。

我们首先试试第一个项目:
$ cd ~/work/geekos-0.3.0/src/project0/build$ 
$ make depend
$ make
在make后会提示错误,
cc1: warnings being treated as errors
In file included from ../src/geekos/gdt.c:11:
../include/geekos/segment.h:43: error: ‘packed’ attribute ignored for field of type ‘uchar_t’

这是因为makefile中默认的编译选项过于严格,把警告都当成错误来看待,我们可以修改一下Makefile将这个过于严格的编译选项去掉。
$ vim Makefile
用vim编辑器打开,找到第149行的-Werror:
CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror 
修改为:
CC_GENERAL_OPTS := $(GENERAL_OPTS)
:wq保存退出
接下来再make,编译就可以通过了。
$ ls -a
.   .bochsrc  common      fd.img  libc   user
..  Makefile  depend.mak  geekos  tools
现在生成了一个包含工程0编译好的软盘镜像fd.img和bochs模拟器的配置文件.bochsrc,运行bochs却提示错误:
$ bochs
========================================================================
                       Bochs x86 Emulator 2.4.5
              Build from CVS snapshot, on April 25, 2010
========================================================================
00000000000i[     ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins'
00000000000i[     ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[     ] reading configuration from .bochsrc
00000000000p[     ] >>PANIC<< .bochsrc:4: vgaromimage directive malformed.
00000000000e[CTRL ] notify called, but no bxevent_callback function is registered
00000000000i[CTRL ] quit_sim called with exit code 1

仔细看看配置文件是针对很古老的版本的bochs(2.0.2?)写的,甚至文件里面的内容和文件路径都完全不正确,那么我们需要修改这个文件,将vgaromimage和romimage的路径修改正确,并且删除提示错误的行,得到如下文件:
# An example .bochsrc file.
# You will need to edit these lines to reflect your system.
vgaromimage: file=/usr/share/vgabios/vgabios.bin
romimage: file=/usr/share/bochs/BIOS-bochs-latest
megs: 8
boot: a
floppya: 1_44=fd.img, status=inserted
#floppya: 1_44=fd_aug.img, status=inserted
log: ./bochs.out
keyboard_serial_delay: 200
vga_update_interval: 300000
mouse: enabled=0
private_colormap: enabled=0
i440fxsupport: enabled=0
# Uncomment this to write all bochs debugging messages to
# bochs.out.  This produces a lot of output, but can be very
# useful for debugging the kernel.
#debug: action=report
再次启动bochs:
$ bochs

得到如下画面:


说明生成的镜像已经启动成功了。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值