如何在 Windows 上编译和运行 xv6?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7534388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:08:45  来源:igfitidea点击:

How to compile and run xv6 on windows?

windowsunixcompilationvirtual-machinexv6

提问by SMUsamaShah

We are being taught xv6in our course. Currently we use to login to linux server of our school using puttyin windows.

我们在课程中教授xv6。目前我们在windows下使用putty登录我们学校的linux服务器。

There we make changes in source of xv6 (using vim), then compile and run it in qemusimply

在那里我们对 xv6 的源代码进行了更改(使用 vim),然后简单地在qemu 中编译和运行它

make clean
make
make qemu-nox

It is not always possible to connect to their servers therefore I want to be able to compile and run xv6 withing windows (in some emulator obviously).

并不总是可以连接到他们的服务器,因此我希望能够在 Windows 中编译和运行 xv6(显然在某些模拟器中)。

What emulator I can use for above kind work? (edit code, compile and run) and how?

我可以使用什么模拟器进行上述工作?(编辑代码,编译和运行)以及如何?

采纳答案by Morass

Well, there are reasonable instructions on how to construct environment for building and using XV6 under Windows in the site http://www.cs.mta.ac.il/~carmi/Teaching/OS.xv6/index.html. The emulator they are using for actually running it is Bochs.

嗯,在http://www.cs.mta.ac.il/~carmi/Teaching/OS.xv6/index.html站点中有关于如何构建在 Windows 下构建和使用 XV6 的环境的合理说明。他们用于实际运行它的模拟器是 Bochs。

回答by TMN

You can run Linux inside VirtualBox, that would give you the same environment on your machine that you use on the school's server. Then you could continue to run xv6 within qemu. You'll need a reasonably capable machine for this, though -- a dual-core CPU with 4G of memory is the minimum I'd attempt this with.

您可以在VirtualBox 中运行 Linux ,这将在您的机器上为您提供在学校服务器上使用的相同环境。然后你可以继续在 qemu 中运行 xv6。不过,您需要一台性能合理的机器——具有 4G 内存的双核 CPU 是我尝试的最低要求。

回答by Subangkar KrS

If you wanna use WSL (Windows sub-system for Linux) on Windows 10, this might help.

如果您想在Windows 10上使用 WSL(Linux 的 Windows 子系统),这可能会有所帮助。

Follow Instructions regarding Windows hereor

按照此处有关 Windows 的说明

Step 1:enable and setup WSL following this.

第 1 步:此之后启用和设置 WSL 。

Step 2:run WSL bash and install required stuffs on WSL.

第 2 步:运行 WSL bash 并在 WSL 上安装所需的东西。

  • open CMD
  • type cd <xv6-source-path>
  • type bashand this will switch CMD into WSL bash
  • then sudo apt-get update && sudo apt-get install git nasm build-essential qemu gdb
  • 打开CMD
  • 类型 cd <xv6-source-path>
  • 输入bash,这会将 CMD 切换到 WSL bash
  • 然后 sudo apt-get update && sudo apt-get install git nasm build-essential qemu gdb

Step 3:disable video devicefor qemu in Makefile.

第 3 步:Makefile 中禁用qemu 的视频设备

  • open Makefile in xv6 source directory with any text editor.

  • find the line starting with

  • 使用任何文本编辑器打开 xv6 源目录中的 Makefile。

  • 找到以开头的行

QEMUOPTS =

QEMUOPTS =

  • append-display noneto this line and save the file.
  • 追加-display none到这一行并保存文件。

Step 4:type linux like commands in that terminal i.e

第 4 步:在该终端中输入类似 linux 的命令,即

  • first make
  • then make qemu
  • 第一的 make
  • 然后 make qemu

Now if everything is okay, you should be in the xv6 terminal

现在如果一切正常,你应该在 xv6 终端

回答by Timo Geusch

I'd go for some sort VM solution (as suggested by TMN) as well, but it might be worth a try building it on Cygwin if you don't have the hardware to run a sufficiently specced VM.

我也会去寻求某种 VM 解决方案(如 TMN 所建议的那样),但如果您没有运行足够规格的 VM 的硬件,可能值得尝试在 Cygwin 上构建它。

回答by Aliza Miller

I had tried the above but make qemu-noxgave me this error:

我已经尝试了上述但make qemu-nox给了我这个错误:

Cannot set up guest memory 'pc.ram': Cannot allocate memory

I opened up the Virtual Box GUI, right clicked on the VM, when it was turned off (on halt), I right-clicked on the VM, then clicked the "system" tab, and then changed the motherboard memory to over 2000MB.

我打开Virtual Box GUI,右键单击VM,当它关闭(暂停)时,我右键单击VM,然后单击“系统”选项卡,然后将主板内存更改为2000MB以上。

After that I ran:

之后我跑了:

make
make qemu-nox

This worked for me even though nothing else worked.

这对我有用,即使没有其他工作。