Class Virtual Machine setup instructions
We prepared a class virtual machine (VM) to make it simpler for you to work on the programming assignments. The VM runs Ubuntu 12.04.It comes with necessary tools such as git. Download the compressed VM here and uncompress it. Since the VM is large, we recommend you download the VM with your machine plugged into the CS wired network.
To run the VM, install either VMware Workstation for Windows or Linux,or VMware Fusion for Mac. A CS account will provide access to VMware licenses and software at no additional cost. Once the VM boots, please login with user name w4118 and password w4118. Moreover if you wanted to have it on your machines then first of all you need to install the Virtualization Software on your host machine. Following are few virtualization softwares:
We are going to use VMWare as our virtualization software because it is bit faster than Virtual Box and also have some more advantages over other softwares. You can download them from given links.
User Manual Download Guide: Download Guide
User Manual Installation Guide: Installation Guide
Download Ubutnu Vdi file : Download
Login from PUCIT Labs under PUCIT local network:
If you want to work on Linux Environment you have multiple ways. If you are sitting in PUCIT lab under PUCIT local network you can use multiple client software. From logging in using lab computers you have to follow the steps:
- You must have secure shell (ssh) account for using client software installed on lab computers. We have ssh installed in our lab.
- Start the ssh application on your desktop.
- Give the IP address 172.16.0.21 for machine which is providing you ssh service running in PUCIT.
- Enter your roll number as user authentication after that don’t change anything and move next.
- Give your default password which will be given when your accounts will be created.
- After successful login you have screen in front of you this is Linux bash where you can run commands of Linux.
Login from your machines under PUCIT network:
If you are having you are having Ubuntu or any other Linux distribution installed on your machines you can make login to secure shell server from your machines as well.
- Connect to the university local network and start your Linux distribution installed on your machines.
- Start the terminal and run the following command:
$ ssh email@example.com
- Where the username will be your roll number and after this it will ask for your secure shell account password. Now you are connected to the ssh server of PUCIT
Git is a distributed version control software. Version Control Software means if you want to have multiple copies of your code on different stages you need to make copies and backups on your hard drive and with particular names. git already has functionality of implementing this. And we call this versioning. We will be using git for our all kernel program assignments. To learn about Git, take a look at the Git user’s manual, or, if you are already familiar with other version control systems, you may want to read this Git overview. To have basic idea about how to work with git read this Simple Guide to Git.
QEMU setup instructions
QEMU is a modern and fast PC emulator. Unfortunately, QEMU’s debugging facilities, while powerful, are somewhat immature, so we highly recommend that you use version of QEMU patched by MIT folks instead of the stock version that may come with your distribution. To download and build your own patched version of QEMU on CLIC machines:
- Clone the QEMU git repositorygit clone http://pdos.csail.mit.edu/6.828/qemu.git -b 6.828-0.15
- Configure the source code./configure [–prefix=PFX] [–target-list=”i386-softmmu x86_64-softmmu”]The prefix argument specifies where to install QEMU; without it QEMU will install to /usr/local by default. For your convenience,set PFX to be inside your home directory. The target-list argument simply slims down the architectures QEMU will build support for.
- Run make && make install
You may also install QEMU on your host machine. On Linux, you may need to install the SDL development libraries to get a graphical VGA window. On Debian/Ubuntu, this is the libsdl1.2-dev package. You can find more information about the version of QEMU we’re using
Running xv6 with make
The Makefile provided with xv6 has several phony targets for running the system:
- make qemu
Build everything and run xv6 with QEMU, with a VGA console in a new window and the serial console in the terminal where you typed this command. Close the VGA window or press Ctrl-C orCtrl-A X to stop.
- make qemu-nox
Run xv6 without the VGA console.
- make qemu-gdb
Run xv6 with GDB port open. Refer to the GDB section.
- make qemu-nox-gdb
Run xv6 with GDB port open, without the VGA console.
GDB debug instructions
QEMU supports debugging with GDB. To debug with GDB:
- Run xv6 with GDB port open
depending on whether you want the VGA console.
- Run GDB with the kernel binary
and GDB will automatically connect to the GDP port.
Refer to the GDB Manual for a complete instruction of GDB. Some commands are proved to be useful.
- Ctrl-C (when in execution)
Halt the execution and break into GDB at the current instruction.
Continue execution to the next breakpoint, or till the next
Step in, execute one instruction and halt.
- b *addr
Set a breakpoint at EIP address addr. EIP addresses can be
found in .asm files.
- b func
Set a breakpoint at function of name func.
- b file:N
Set a breakpoint at line N of source code file.
- info registers
Print the general purpose registers, eip, eflags, and the segment
selectors. For more detailed result use info registers in the QEMU
- x/Nx addr
Dump in hex N words starting at virtual address
- x/Ni addr
Display N assembly instructions starting at virtual address
- symbol-file file
Switch to symbol file file.
- set print pretty
Print arrays and structs in a pretty easy-to-read format.
QEMU itself has a built-in monitor available to inspect and modify the machine state. Press Ctrl-A C in the terminal running QEMU to get into the monitor. Refer to the QEMU Manual for a complete instruction of QEMU monitor.
Some commands are pariticularly useful:
- xp/Nx paddr
Dump in hex N words starting at physical address
- info registers
Display a full detailed dump of registers.
- info mem
Display the page table in a compact form.
- info pg
Display the current page table structure. Different from info mem, this
command distinguishes between PDE and PTE. Unbroken sequences of PDE’s
or PTE’s with identical permissions are compressed into a single line.
This command is added by MIT folks.
You can work remotely by connecting to a machine via SSH. If you desktop runs Linux or MacOS, you should be able to instal an SSH client easily. For example, on Ubuntu, run
$ sudo apt-get install openssh-client
If your desktop runs Windows, you’ll need to install two programs. First, you need an SSH client, such as the putty SSH client or Cygwin with the OpenSSH package. To get the GUI window working on your desktop, you also need an X server, such as the Xming X Server or the XWin32 Server. Configure your SSH client to forward X11 streams.