MIT 6.828实验环境配置
环境:ubuntu 20.04
新的改变
1,首先安装最基本的工具包`
sudo apt-get install -y build-essential libtool libglib2.0-dev libpixman-1-dev zlib1g-dev git libfdt-dev gcc-multilib gdb
2、在主目录下创建一个6828的文件夹然后下载所需代码
git clone https://github.com/mit-pdos/6.828-qemu.git qemu
进入qemu文件夹,打开终端
./configure --disable-kvm --disable-sdl --target-list="i386-softmmu x86_64-softmmu"
make && make install
报错
CC qga/commands-posix.o
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 <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "major", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"major", you should undefine it after including <sys/types.h>. [-Werror]
*devmajor = major(st.st_rdev);
^~~~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-posix.c:634:13: error: In the GNU C Library, "minor" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "minor", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"minor", you should undefine it after including <sys/types.h>. [-Werror]
*devminor = minor(st.st_rdev);
^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
解决方法
找到qga/commands-posix.c 文件,在文件中加 #include <sys/sysmacros.h>
继续报错
nstall: cannot create directory ‘/share’: Permission denied Makefile:382: recipe for target 'install-datadir' failed
解决方法:进入root权限安装
再执行,make和make install安装就成功了
再进入6828文件夹下克隆lab文件
git clone https://pdos.csail.mit.edu/6.828/2018/jos.git lab
进入lab文件夹,打开终端
执行make
make后会提示有出现一个kernel的img镜像文件,有这个,你就可以在lab文件夹下打开终端输入
make qemu
如果出现了新的控制台,即成功。