How to compile and run xv6 on windows?
-
26-01-2021 - |
Question
We are being taught xv6 in our course. Currently we use to login to linux server of our school using putty in windows.
There we make changes in source of xv6 (using vim), then compile and run it in qemu simply
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).
What emulator I can use for above kind work? (edit code, compile and run) and how?
Solution
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.
OTHER TIPS
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.
If you wanna use WSL (Windows sub-system for Linux) on Windows 10, this might help.
Follow Instructions regarding Windows here or
Step 1: enable and setup WSL following this.
Step 2: run WSL bash and install required stuffs on WSL.
- open CMD
- type
cd <xv6-source-path>
- type
bash
and this will switch CMD into WSL bash - then
sudo apt-get update && sudo apt-get install git nasm build-essential qemu gdb
Step 3: disable video device for qemu in Makefile.
open Makefile in xv6 source directory with any text editor.
find the line starting with
QEMUOPTS =
- append
-display none
to this line and save the file.
Step 4: type linux like commands in that terminal i.e
- first
make
- then
make qemu
Now if everything is okay, you should be in the xv6 terminal
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.
I had tried the above but make qemu-nox
gave me this error:
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.
After that I ran:
make
make qemu-nox
This worked for me even though nothing else worked.