Just wanted to share my experience of installing Pintos on Qemu.

First of all install Qemu. In Ubuntu it is available in Universe repository. It is also available in Fedora repositories.

Ubuntu users can install qemu by typing in:

$ sudo apt-get install qemu

and Fedora users can install Qemu by typing in the following command as root user:

# yum install qemu

Note: Fedora 9 users need to make some extra changes as mentioned by Mukund in his comments to the post.

Now we are ready to install Pintos. Download Pintos from here. Extract it in some directory say ~/cs342/

Copy the perl scripts ‘backtrace’ , ‘pintos’, ‘pintos-gdb’, ‘pintos-mkdisk’ from ~/cs342/pintos/src/utils to a directory in PATH. I have added ~/bin into PATH. so i copied these scripts in ~/bin

Now open the script ‘pintos-gdb’ (the one you copied in the ~/bin) in any text editor. Find the variable GDBMACROS and set it to point to ‘~/cs342/pintos/src/misc/gdb-macros’. Now you have installed pintos-gdb.

Next go back to ~/cs342/pintos/src/utils and compile the rest Pintos utilities by typing make.

$ cd ~/cs342/pintos/src/utils

$ make

Copy the script ’squish-pty’ in the ~/bin folder or wherever you saved scripts mentioned above.

Compile pintos :

$ cd ~/cs342/pintos/src/threads/

$ make

Now open the file ~/cs342/pintos/src/threads/Make.vars in any text editor. change the last line to:

SIMULATOR = --qemu

Next open the file ~/bin/pintos (the one you copied in the PATH) in any text editor and edit the following lines:

Line no.24: replace ‘os.dsk’  with  ‘~/cs342/pintos/src/threads/build/os.dsk’

Note: Replace ~ with absolute path as perl doesnt identify ~ (Thanks to Kholu :) )

Line no.88 :    $sim = “qemu” if !defined $sim;

Line no.110:    --qemu (default) Use QEMU as simulator

Line no.111:  --bochs Use bochs as simulator

This is all. Now you are ready to run pintos. Check your installation by typing in the terminal:

$ pintos run alarm-multiple

This will create 5 threads and sleep for some predefined times. You can see all these messages in the terminal as well as in a Qemu terminal. Now you are ready to implement changes and enhance pintos.

Happy Coding !!

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Google Bookmarks
  • Reddit
  • Facebook
  • TwitThis
  • Live
  • Technorati
  • Furl
  • Sphinn
  • blogmarks
  • LinkedIn
  • Pownce



26 Comments to “How to install Pintos on QEMU”

  1. Gautam | August 4th, 2008 at 1:29 am

    Very useful post – thanks to this the installation turned out to be a cakewalk.

    Remember not to use ‘~’ for the home directory in the pintos file (as I did initially) – perl does not recognize that character. Use the full path instead.

  2. spsneo | August 4th, 2008 at 1:31 am

    @Gautam

    Thanks for reminding this. I will add it in the post.

  3. Mukund | August 5th, 2008 at 1:18 pm

    For those enlightened folks running Fedora 9…

    While making utils/, gcc will complain about a missing stropts.h
    Google says that stropts.h provides an interface for STREAMS, which have not been supported in any version of Linux for years.

    What is means for F9 users: no package will push the error away. We need to modify the code slightly to work around this problem. Nothing much, just 3 locations in 2 files.

    At squish-pty.c:10, you will find #include . Comment this out.
    Comment out squish-pty.c:289-296. There is some comment here about System V needing STREAMS configuration.

    In squish-unix.c, comment out the #include

    Since no Linux actually provides an underlying implementation, these are just dummy function calls, and should be safe even on Ubuntu.

  4. spsneo | August 5th, 2008 at 4:56 pm

    @mukund
    Thanks

  5. Pankaj | August 8th, 2008 at 12:32 pm

    why don’t you use different font for writing codes
    e.g. you may use This is a code thing!
    or change the font to courier new!

  6. Pankaj | August 8th, 2008 at 12:34 pm

    @the earlier comment
    you may have written SIMULATOR = --qemu or whatever!

  7. spsneo | August 8th, 2008 at 4:59 pm

    @Pankaj
    Done !

  8. venkat | August 16th, 2008 at 9:04 am

    thanks a lot dude

  9. Neependra | November 5th, 2008 at 9:19 pm

    Thanks a lot..

  10. Alma | January 27th, 2009 at 3:31 pm

    Hi Spsneo,
    you said:” Replace ~ with absolute path as perl doesnt identify ~ ”
    I don’t know that ~ shoud be replced with what full path?
    it’s the path of place which perl is installed?
    tnx.

  11. spsneo | January 27th, 2009 at 3:36 pm

    @alma

    Here ~ is the path to your home directory

  12. Alma | January 29th, 2009 at 5:30 pm

    I know it, but my question was when I want edit “~/cs342/pintos/src/threads/Make.vars”, ~ should be raplaced whit what absolute path, the path of perl intallation folder?

    thanks a lot.

  13. Sharif Students | February 4th, 2009 at 1:06 pm

    Thank You very much!
    It works and my pintos is ready t run.
    be HAPPY!

  14. Pankaj | February 15th, 2009 at 2:38 pm

    @Alma
    you should edit it as “/home//cs342/pintos/src/threads/Make.vars”

  15. Amin | February 24th, 2009 at 10:42 am

    It was more helpful than you can imagine! :P Thnx alot!

  16. Aveek Sen | June 27th, 2009 at 7:49 am

    The Pintos download page has been changed to http://www.scs.stanford.edu/07au-cs140/pintos/pintos.html

  17. spsneo | July 18th, 2009 at 1:58 am

    Thaks Aveek. I have updated the link

  18. Sebastian | September 10th, 2009 at 6:01 pm

    Thank you, this helped my alot.

  19. matias | January 5th, 2010 at 1:19 pm

    thanks for the info on getting squish-pty/unix to compile. i’m running Linux Fedora 12 and the comment by Mukund helped me get things to compile correctly. much appreciated. fwiw, i used yum to install qemu *first*, then bochs. i can run pintos with both.

    also, that link location is pointing to the cs140 homepage for the autumn 2007 quarter. this is the more general stanford homepage for pintos: http://www.stanford.edu/class/cs140/projects/pintos/pintos.html

    HTH,

    matias

  20. Shubham | January 25th, 2010 at 6:21 pm

    Thanx a lot for this post.
    This is one of the most helpful posts I have ever found on the web.
    Worked in one go.
    Thanx a lot.

  21. Souri | February 9th, 2010 at 10:34 pm

    Thanks alot for this helpful topic.
    I installed pintos.
    May I ask you a few questions about improving pintos code?

  22. Souri | February 10th, 2010 at 6:58 pm

    Hi,
    I followed your mentioned steps.
    But qemu simulator does not work on pintos.
    Maybe because my linux is Ubuntu.
    can you help me in this regard?

  23. Mahdi | March 1st, 2010 at 6:50 pm

    Hi,
    I’ve done all of your instructions. But i faced the following problem:
    ~$ pintos run alarm-multiple
    Cannot find OS disk
    Please help me about that…

  24. Siddharth Prakash Singh | March 2nd, 2010 at 11:49 am

    @Mahdi

    This is because you have not given proper path of os.dsk in ~/bin/pintos file.

  25. Arun | March 5th, 2010 at 4:23 pm

    while running following
    pintos -f -q
    it is giving init.c -f is invalid option

  26. Waqar Hameed | March 11th, 2010 at 7:11 pm

    Great Article! Thanks! Made Installing Pintos real easy!

Leave a Comment