python环境配置实验步骤_1 搭建实验环境

系统版本:Ubuntu 18.04.3

0 介绍

mit6.828是一门经典的操作系统课程,通过这门课程可以学习到操作系统的设计与实现。

据说会对linux开发很有帮助,作为一个即将工作的菜鸟,又不擅长基础理论的学习,我决定从这门课入手,希望能对操作系统有深入的认识和了解。

框图(没必要看,我就是想放放提升逼格):

ec675f0e1482

本节框图

1 安装工具包

需要安装的工具包如下:

ec675f0e1482

工具包

执行如下指令:

sudo apt-get install -y build-essential libtool* libglib2.0-dev libpixman-1-dev zlib1g-dev git libfdt-dev gcc-multilib gdb python

2 安装qemu

qemu是一个与bochs和pearpc类似的模拟器,或者说是仿真器,完全的软件模拟,他能模拟很多类型的cpu。

2.1 下载

执行如下指令:

git clone https://github.com/mit-pdos/6.828-qemu.git qemu

该指令会在当前目录创建qemu文件夹,并克隆代码到本地。

2.2 编译&安装

首先进入到qemu文件夹下:

cd qemu

执行指令:

./configure --disable-kvm --disable-sdl --target-list="i386-softmmu x86_64-softmmu"

如果没有安装Python,这一步会报错:

出现报错 ERROR: Python not found. Use --python=/path/to/python

需要安装Python 2.7才能正常配置。

如果出现:

disanbling libtool due to broken toolchain support

说明没有安装到所需要的libtool,在上一节我已经把指令改成了安装所有libtool工具,应该不会再出现这个报错。

上述执行完毕没有报错,就可以执行编译安装指令:

make -j8 && make install

可能出现的三个错误如下:

错误1

qga/commands-posix.c: In function ‘dev_major_minor’:

qga/commands-posix.c:633:13: error: In the GNU C Library, "major" is defined

by . For historical compatibility, it is

currently defined by as well, but we plan to

remove this soon. To use "major", include

directly. If you did not intend to use a system-defined macro

"major", you should undefine it after including . [-Werror]

*devmajor = major(st.st_rdev);

^~~~~~~~~~~~~~~~~~~~~~~~~~

错误中已经给出了解决方案,在 qga/commands-posix.c文件中的 #include 下面增加#include 即可。紧接着的那个错误也是这个引起的,改了就都会解决的。

错误2

block/blkdebug.c: In function ‘blkdebug_refresh_filename’:

block/blkdebug.c:749:31: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4086 [-Werror=format-truncation=]

"blkdebug:%s:%s",

这个不是错误,只需要把qemu文件夹下的config-host.mak文件中的-Werror去掉就好了(直接ctrl+F搜索Werror)

错误3

install -d -m 0755 "/usr/local/share/qemu"

install: cannot change permissions of ‘/usr/local/share/qemu’: No such file or directory

Makefile:382: recipe for target 'install-datadir' failed

make: *** [install-datadir] Error 1

这是安装时报错,主要是我没有使用管理员账户,没有成功创建文件夹。可以再执行一次sudo make install即可。

3 下载实验源码

退出qemu文件夹,下载实验源码:

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

出现找不到代码库,可能是源码有更新,可以尝试更改2018那个年份

参考资料

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值