MIT——6.828:操作系统工程——第-1章:环境配置

MIT——6.828是一门操作系统课程,课程在6.828
这里记录一下自己所学的东西,这一章主要介绍环境配置。

1. 硬件环境

VMware 15 + debian 8.x

2. 编译器工具链

编译工具链是一个工具集包括c编译器,汇编编译器,链接器。执行命令

gcc -m32 -print-libgcc-file-name

输出

/usr/lib/gcc/i486-linux-gnu/version/libgcc.a

或者

 /usr/lib/gcc/x86_64-linux-gnu/version/32/libgcc.a

则不需要构建自己的编译器工具链了。
否则执行
sudo apt-get install -y build-essential gdb
进行安装。
在64位的机器上还需要安装32位支持库
sudo apt-get install gcc-multilib
否则后面make的时候可能会出现"__udivdi3 not found"或者"__muldi3 not found的情况。

3. qemu

qemu是一款虚拟机,我们采用该课程的补丁版本
执行命令

git clone https://github.com/mit-pdos/6.828-qemu.git qemu
cd qemu
./configure --disable-kvm --disable-werror --prefix=你想要安装的路径 --target-list="i386-softmmu x86_64-softmmu"
make
make install
sudo ln -s 你想要的安装目录/bin/qemu-system-i386 /usr/bin/qemu

3.1 编译过程中出现的问题:

问题一

ERROR: Cannot use 'python', Python 2.4 or later is required.
       Note that Python 3 or later is not yet supported.
       Use --python=/path/to/python to specify a supported Python.

./configure不支持python3,解决方法是安装python2,调整命令行为

./configure --disable-kvm --disable-werror --prefix=你想要安装的路径 --target-list="i386-softmmu x86_64-softmmu" --python=/usr/bin/python2

问题二

Disabling libtool due to broken toolchain support

ERROR: glib-2.12 gthread-2.0 is required to compile QEMU

解决方法安装依赖 libglib2.0-dev
问题三

ERROR: pixman >= 0.21.8 not present. Your options:
         (1) Preferred: Install the pixman devel package (any recent
             distro should have packages as Xorg needs pixman too).
         (2) Fetch the pixman submodule, using:
             git submodule update --init pixman

解决方法安装依赖 libpixman-1-dev
问题四

LINK  qemu-ga
/usr/bin/ld: qga/commands-posix.o: in function `dev_major_minor':
/home/kali/qemu/qga/commands-posix.c:633: undefined reference to `major'
/usr/bin/ld: /home/kali/qemu/qga/commands-posix.c:634: undefined reference to `minor'
collect2: error: ld returned 1 exit status
make: *** [Makefile:288:qemu-ga] 错误 1

解决方法在qga/commands-posix.c文件中加上头文件<sys/sysmacros.h>。

4. 实验代码

执行命令

git clone https://pdos.csail.mit.edu/6.828/2018/jos.git lab

下载课程实验代码
开始编译安装

cd lab
make
make qemu

出现
图片描述
编译成功

4.1 编译过程中出现的问题

问题一

+ as kern/entry.S
kern/entry.S: error: STABS debugging information is obsolete and not supported anymore [-Werror]
cc1: all warnings being treated as errors
make: *** [kern/Makefrag:56:obj/kern/entry.o] 错误 1

在GNUmakefile中添加

CFLAGS += -Wno-error
posted @ 2022-12-16 12:39  buguoliujibugaiming  阅读(154)  评论(0编辑  收藏  举报