Pintos Installation
For the installation and setup of Pintos, I followed the steps mentioned here. All the steps performed for this installation and the issues and errors faced along with their solutions are listed below: NOTE:
- The library “stropts.h” is included in some files in pintos. This library does not work for latest Ubuntu versions after 18.04 (e.g. 20.04). So, I used Ubuntu version 14.04.
- Replace /home/fatimamujahid with /home/your-user-name at all places in the document.
Step 1:
Install qemu on your machine using the command:
- sudo apt-get install qemu
Run following commands to check if qemu was properly installed.
- qemu
- qemu-system-x86
commands did not work for me.
- qemu-system-x86_64
ran successfully and a qemu window popped up.
Step 2:
Download pintos from http://web.stanford.edu/class/cs140/projects/pintos/pintos.tar.gz
Create a directory os-pintos in /home/fatimamujahid and paste the extracted pintos directory inside os-pintos.
Step 3:
Open the file pintos-gdb present in /home/fatimamujahid/os-pintos/pintos/src/utils and changed line number 4 to
- GDBMACROS=/home/fatimamujahid/os-pintos/pintos/src/misc/gdb-macros
Step 4:
Open the Makefile present in the utils directory and replaced line number 5 by
- LDLIBS = -lm
Step 5:
Use the
- make
command to compile the utils folder.
Step 6:
Open the file Make.vars present in /home/fatimamujahid/os-pintos/pintos/src/threads and changed the last line to
- SIMULATOR = –qemu
Step 7:
Use the
- make
command to compile the pintos kernel in the threads directory.
Step 8:
Open the file pintos present in the utils directory and change line number 103 to
- $sim = “qemu” if !defined $sim;
Change line number 259 to
- my $name = find_file (“/home/fatimamujahid/os-pintos/pintos/src/threads/build/kernel.bin”);
Change line number 623 to
- my (@cmd) = (‘qemu-system-x86_64’);
Step 9:
Open the file Pintos.pm present in the utils directory and change line number 362 to
- $name = find_file (“/home/fatimamujahid/os-pintos/pintos/src/threads/build/loader.bin”) if !defined $name;
Step 10:
Run
- pintos run alarm-multiple
command in the utils directory. (In my case, it was not recognized. I found the solution for this issue in the comment section of the link mentioned at the start of the document. Then I tried
- ./pintos run alarm-multiple
command which worked.) It will create 5 threads and the output will be displayed both in the terminal and in the qemu window.
Step 11:
Open the file .bashrc present in /home/fatimamujahid using
- ls -a | grep bashrc
command and add
- export PATH=$HOME/os-pintos/pintos/src/utils:$PATH
at the end of this file and restart the terminal.
Step 12:
Then run the following three commands to ensure successful pintos installation:
- cd os-pintos/pintos/src/threads
- make
- make check The 'make' command compiles the code but in this case, as we have already run this command in the threads directory, so nothing will happen. The 'make check' runs all the tests for this project. (But here I encountered the timeout issue. All the tests got a timeout fault.)
(To solve the timeout problem, I opened shutdown.c present in /home/fatimamujahid/os-pintos/pintos/src/devices and added
- outw (0xB004, 0x2000);
after line number 104 in the function shutdown_power_off(). Then ran the 'make' and 'make check' commands again in the threads directory.) The output screenshots are shown below in which all the tests run, and the final result will be displayed, indicating the number of failed and passed tests.
.
.
20 of 27 tests failed and the remaining passed. This is the output required. Hence, Pintos will be successfully installed.