[关闭]
@SovietPower 2021-12-16T16:33:37.000000Z 字数 2027 阅读 1173

OS 实验1 pintos安装

OS



安装pintos

使用qemu

参考:https://blog.csdn.net/geeeeeker/article/details/108104466 https://www.youtube.com/watch?v=CI5FHJhXv38
如果是用的bochs,可能容易很多(而且教程也多)(不过遇到的问题还是出在pintos)。
注:qemu最后又出了问题,所以最好用bochs。

遇到的问题:
make时出现:fatal error: stropts.h: 没有那个文件或目录

https://www.cnblogs.com/KevinT/p/3810833.html
https://blog.csdn.net/lushl9301/article/details/8504945

这里有人修过这个辣鸡bug,不过好像是mac。

一般情况,好像可以直接在/usr/include新建一个空文件stropts.h。因为现在的系统不需要也不支持该头文件。注意给文件添加755权限。

Since the stropts.h is required for a successful compilation, the most simple way to solve the issue is to create a blank file named stropts.h under /usr/include. You may want to put any comments there, this way you won’t forget what was the reason to create this file.

但pintos里有用到stropts.h里的内容。。所以不能用空文件,要照下面链接的做。
下载glibc-2.11,解压后,将stropts.h复制到指定路径(注意新版glibc里没有这个文件):

  1. cp ./glibc-2.11/streams/stropts.h /usr/include
  2. cp ./glibc-2.11/bits/stropts.h /usr/include/bits
  3. cp ./glibc-2.11/sysdeps/x86_64/bits/xtitypes.h /usr/include/bits

然后你会获得:squish-pty.c:(.text+0xced): undefined reference to isastream。估计,还是系统根本不支持。。

然后,我直接把squish-pty.c里用到isastream的那几句删了。目前没什么问题。

反复提示Booting from hard disk,无法运行

似乎有两种解决方案:
https://stackoverflow.com/questions/44269968/qemu-gets-stuck-at-booting-from-hard-disk#
进入到bios系统将硬盘重新设置为第一启动

但我没解决。所以还是用bochs。

使用bochs

https://blog.csdn.net/qq_41999455/article/details/102757092

下载bochs,解压tar zxvf bochs-2.7.1.tar.gz

安装一些东西:

  1. sudo apt-get install build-essential
  2. sudo apt-get install xorg-dev
  3. sudo apt-get install g++-multilib

第二个可换成下面?(因为安装的太多了)

  1. sudo apt-get install libncurses5-dev
  2. sudo apt-get install libx11-dev
  3. sudo apt-get install libxrandr-dev
  4. sudo apt-get install binutils

在bochs文件夹:
1. 配置bochs:./configure --enable-gdb-stub --with-x --with-x11 --with-term --with-nogui
2. make(如果出现许多XRR错误,则是1没配置,或没安装全)
3. sudo make install

然后就可以使用bochs命令了。

配置pintos
~目录,打开.bashrc,在最后一行加入:
export PATH="$PATH:/home/USER_NAME/OS/pintos/src/utils"(指pintos解压目录,以下同理)。
运行bash更新文件。

cd /root(如果无权限,则sudo chmod 777 /root -R),同样打开.bashrc,在最后加入同样的行。
运行bash更新文件。

进入pintos/src/utils
pintos-gdb第4或5行改为GDBMACROS=/home/USER_NAME/OS/pintos/src/misc/gdb-macros
Makefile的第5行改为LDLIBS= -lm

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注