给同学的毕业赠言,信宜市玉都风情网,蕲春县房价
mit 6.828是操作系统中最经典的一门课程。完成所有的lab就相当于完成了一个迷你的操作系统。我跟的是2018年的课程,课程首页在。当然所有资料都是英文的,所以难度也不低,这里推荐几本非常有用的参考书:《x86汇编语言-从实模式到保护模式》,《程序员的自我修养-链接、装载与库》,《深入理解计算机系统》,很多知识在这些书中都有提到,参考着看会有奇效。
本文主要讲解实验前的环境搭建,主要分为两个部分,一个是x86模拟器qemu的安装,另一个是编译工具链。参考资料:
我的机子装的win10的系统,现在win10支持wsl,在windows上也能享受到原生linux一样的体验。我一般用xshell登陆本地wsl,体验很不错。
首先从官网clone实验的框架代码到本地:git clone https://pdos.csail.mit.edu/6.828/2018/jos.git lab
编译工具链是一个工具集包括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
进行安装(ubuntu系统下)。在64位的机器上还需要安装32位支持库sudo apt-get install gcc-multilib
否则后面make的时候可能会出现"__udivdi3 not found"的情况。
qemu是一款模拟器,按照的提示我们需要从源码安装针对课程定制过的qemu。步骤如下:
./configure --disable-kvm --target-list="i386-softmmu x86_64-softmmu"
。这一步可能会报错:
error: python not found. use --python=/path/to/python
--python=python3
,还是不行提示note that python 3 or later is not yet supported
。安装python2.7,然后使用--python2.7
选项error: pkg-config binary 'pkg-config' not found
apt-get install -y pkg-config
error: zlib check failed. make sure to have the zlib libs and headers installed.
sudo apt-get install zlib1g-dev
error: glib-2.12 gthread-2.0 is required to compile qemu
sudo apt-get install libglib2.0-dev
error: pixman >= 0.21.8 not present.
sudo apt-get install libpixman-1-dev
vl.c: in function ‘main’: vl.c:2778:5: error: ‘g_mem_set_vtable’ is deprecated [-werror=deprecated-declarations] g_mem_set_vtable(&mem_trace); ^ in file included from /usr/include/glib-2.0/glib/glist.h:32:0, from /usr/include/glib-2.0/glib/ghash.h:33, from /usr/include/glib-2.0/glib.h:50, from vl.c:59: /usr/include/glib-2.0/glib/gmem.h:357:7: note: declared here void g_mem_set_vtable (gmemvtable *vtable); ^ cc1: all warnings being treated as errors rules.mak:57: recipe for target 'vl.o' failed make: *** [vl.o] error 1
make && make install
。至此qemu安装完毕。在lab源码根目录下执行make,如果看到
就说明编译成功了。然后执行make qume,看到如下信息就说明环境搭建好了。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论