601.418/618 (S24): Setup Instructions

Setup Instructions

To develop the Pintos projects, you’ll need two essential sets of tools:

This page contains instructions to help you with the setup of the core development environment needed for Pintos on your own machines. They are intended for Unix and Mac OS machines. If you are running Windows, we recommend you to run a virtual machine with Linux or you will have to setup Cygwin first. This guide, and the course in general, assumes you are familiar with Unix commands.

Getting Started

To get started, you need to clone the Pintos repository we provided.

git clone https://github.com/jhu-cs318/pintos.git

1. Development Environment

Option A: JHU CS Lab Machine

The CS department’s lab machines already have these tools available under /usr/local/data/cs318/x86_64. You just need to modify your PATH setting to include it.

If you are using macOS to connect to the CS Lab machine, you should install XQuartz, so that you can get GUI windows to show up locally in your macOS for the exercise 0.1 in Lab 0.

Choosing option A, you do NOT need to follow steps 2-4 below.

Option B: Your Own Machine

Besides the lab machines, you may want to work on the projects on your own laptop/desktop to be more productive.

Info

For virtual-machine-based development, you can choose our pre-built VirtualBox VM running Ubuntu 18.04 with the necessary toolchain installed. The VM image is available here. The image is large (2.5 GB), so the downloading can take a while. The md5sum for the VM image is 69c89938d4b768bdcca4362fd39f06e4. The initial login password is jhucs318.

Info

If you would like to build/use your own virtual machine, Vagrant is a popular tool to make VM-based development environment convenient. We have provided a Vagrant configuration that you can use to set up your Pintos dev box.

Info

Unless you are using our pre-built VM, you have to follow steps 2-4 below to install the compiler toolchain, the emulator, and the Pintos utility tools.

2. Compiler Toolchain

You will need a compiler toolchain that can target the i386-elf architecture.

2.1 Install a prebuilt toolchain

If you are using Linux or MacOS, we recommend that you download and install a prebuilt compiler toolchain. To do so, visit the following link and follow the instructions:

https://github.com/jhu-cs318/cross-compiler-toolchain

Note that you should click on the “Pre-built toolchain binaries” link under “Releases” on the right-hand side of the page in order to get access to the toolchain download files.

Info

On Linux, the binaries in the prebuilt toolchain may require shared libraries that you don’t have installed. On Ubuntu 22.04, you can install them with the command

sudo apt install libncurses5 libpython2.7

2.2 Build a toolchain from source

In theory you could compile the toolchain from source code. The Building a toolchain from source document has instructions for doing so. However, these instructions are not likely to work using recent versions of gcc, so we don’t recommend trying this.

3. Emulator

Besides the cross-compiler toolchain, we also need an x86 emulator to run Pintos OS. We will use two popular emulators QEMU and Bochs.

3.1 QEMU

Info

Recent versions of Ubuntu have a QEMU package that should work well for Pintos. You can install QEMU with all supported architectures (including x86) with the command

sudo apt install qemu-system

3.2 Bochs

src/misc/bochs-2.6.2-build.sh $SWD/x86_64
Reminder

To reiterate, if you are using macOS, you should install XQuartz 2.7.11 and do not upgrade it to higher version!. Otherwise, the bochs build will fail.

4. Pintos Utility Tools

The Pintos source distribution comes with a few handy scripts that you will be using frequently. They are located within src/utils/. The most important one is the pintos Perl script, which you will be using to start and run tests in pintos. You need to make sure it can be found in your PATH environment variable. In addition, the src/misc/gdb-macros is provided with a number of GDB macros that you will find useful when you are debugging Pintos. The pintos-gdb is a wrapper around the i386-elf-gdb that reads this macro file at start. It assumes the macro file resides in ../misc.

The commands to do the above setup for the Pintos utilities are: (make sure SWD is set previously to the correct directory path)

dest=$SWD/x86_64
cd pintos/src/utils && make
cp backtrace pintos Pintos.pm pintos-gdb pintos-set-cmdline pintos-mkdisk setitimer-helper squish-pty squish-unix $dest/bin
mkdir $dest/misc
cp ../misc/gdb-macros $dest/misc

5. Others

Happy hacking :)