开始GeekOS之路(搭建GeekOS实验环境)

lazymonkey posted @ 2012年5月07日 22:13 in 操作系统 with tags GeekOS , 3553 阅读

搭建实验环境

基本系统安装好后GeekOS实验环境需要安装的组件只有bochs和nasm,直接使用源中的软件包即可:

$ sudo pacman -S bochs nasm

这里下载geekos-0.3软件包。 解压缩后会得到一个geekos-0.3.0目录

开始GeekOS之路

首先试试第一个项目:

 

$ cd ~/workspace/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’
make: *** [geekos/gdt.o] 错误 1

这是因为Makefile中默认的编译选项过于严格,把警告都当成错误来看待,我们可以修改一下Makefile将这个过于严格的编译选项去掉:

149 CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror

改为:

149 CC_GENERAL_OPTS := $(GENERAL_OPTS)

继续make,会出现错误提示:

fmtout.c:(.text+0x85b): undefined reference to `__stack_chk_fail'
make: *** [geekos/kernel.exe] 错误 1

这是因为gcc在编译是开启了栈保护,打开Makefile关闭gcc的栈保护:

148 GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS)

修改为:

148 GENERAL_OPTS := -O -Wall -fno-stack-protector $(EXTRA_C_OPTS)

继续make,这次没有了错误提示,现在生成了一个包含Project0编译好的软盘镜像fd.img和bochs模拟器的配置文件.bochsrc,运行bochs却提示错误:

========================================================================
Bochs x86 Emulator 2.4.2
Build from CVS snapshot on November 12, 2009
========================================================================
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/bochs/VGABIOS-lgpl-lates
romimage: file=/usr/share/bochs/BIOS-bochs-latest
megs: 8
boot: a
floppya: 1_44=fd.img, status=inserted
log: ./bochs.out
keyboard_serial_delay: 200
vga_update_interval: 300000
mouse: enabled=0
keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-us.map
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

成功启动了,说明GeekOS可以在Arch Linux上运行起来了,环境搭建成功!

  • 无匹配

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter