我使用的操作系统为Debian GNU/Linux 6,基本系统安装好后GeekOS实验环境需要安装的组件只有bochs和nasm,直接使用源中的软件包即可:
# apt-get install build-essential # apt-get install bochs bochs-x nasm
下载得到一个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’
$ vim Makefile用vim编辑器打开,找到第149行的-Werror:
CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror修改为:
CC_GENERAL_OPTS := $(GENERAL_OPTS):wq保存退出
$ 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
# 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
得到如下画面:
说明生成的镜像已经启动成功了。