How to install Pintos on QEMU

UPDATE (Dec 2010) : I wrote this article in fall 2008. Now the files of PINTOS have changed and so this tutorial may not work. But still you can read to take hints on setting up.

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 !!

This entry was posted in Linux, Pintos and tagged , , . Bookmark the permalink.

39 Responses to How to install Pintos on QEMU

  1. Gautam says:

    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 says:

    @Gautam

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

  3. Mukund says:

    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 says:

    @mukund
    Thanks

  5. Pankaj says:

    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 says:

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

  7. spsneo says:

    @Pankaj
    Done !

  8. venkat says:

    thanks a lot dude

  9. Neependra says:

    Thanks a lot..

  10. Alma says:

    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 says:

    @alma

    Here ~ is the path to your home directory

  12. Alma says:

    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 says:

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

  14. Pankaj says:

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

  15. Amin says:

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

  16. spsneo says:

    Thaks Aveek. I have updated the link

  17. Sebastian says:

    Thank you, this helped my alot.

  18. matias says:

    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

  19. Shubham says:

    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.

  20. Souri says:

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

  21. Souri says:

    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?

  22. Mahdi says:

    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…

  23. @Mahdi

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

  24. Arun says:

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

  25. Waqar Hameed says:

    Great Article! Thanks! Made Installing Pintos real easy!

  26. bala says:

    i’m unable to find line 24 in pintos file containing os.dsk. Infact i couldn’t find the pattern os.dsk in the entire file. Help me out.

  27. Bhanu says:

    When try to run pintos I am getting the following error message

    bvemula@bvemula-laptop:~$ pintos run alarm-multiple
    Can’t locate /bin/Pintos.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /bin/pintos line 11.
    BEGIN failed–compilation aborted at /bin/pintos line 11.
    bvemula@bvemula-laptop:~$

    How do I proceed. Also I do not see os.dsk created

    bvemula@bvemula-laptop:~/cs342/pintos/src/threads/build$ ls
    devices kernel.bin kernel.o lib loader.bin Makefile tests threads
    bvemula@bvemula-laptop:~/cs342/pintos/src/threads/build$

    Any help appreciated

  28. houqp says:

    Thanks for your guide!
    I’ve managed to have my pintos running now.
    But may be the scripts pintos has changed now, and I can’t find any information about os.dsk in the script.
    Also I comment out the line below to avoid an error:
    #push (@cmd, ‘-no-kqemu’);

  29. kafka says:

    i can’t find os.dsk in pintos …i have completed the remaining procedure…it is currently giving “cannot find kernel” when i run pintos run alarm-multiple

    Please suggest

  30. mailper says:

    content
    “Line no.24: replace ‘os.dsk’ with ‘~/cs342/pintos/src/threads/build/os.dsk’”
    is not longer available.

    the source file has been changed? the new Line no.24 is:
    our (@puts); # Files to copy into the VM.

    and there is no “os.dsk” anywhere in “pintos” file.

  31. mailper says:

    I ran the command “pintos run alarm-multiple” without editing the os.dsk (because it is not anywhere), I got the error message about not finding pintos.pm file, I copied the pintos.pm file from pintos/src/misc directory, and ran the ‘pintos run alarm-multiple’ again. Got the following error message:

    qemu -no-kqemu -hda /tmp/mLMynr0hqL.dsk -m 4 -net none -serial stdio
    qemu: invalid option — ‘-no-kqemu’
    command failed

  32. Pranav Agarwal says:

    Im trying to install PintOS on Ubuntu 9.10
    I followed the steps as described above.
    But i wasn’t able to locate os.dsk in the pintos file.
    and if i ignore it and run pintos from command line, it says “Cannot Find Kernel”.
    pls help !!

  33. praveen says:

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

    I followed as mentioned exactly on fedora10.
    But I could not find os.dsk in threads/build after the make in threads dir. Nor i could find the word os.dsk in the file pintos.

    can someone figure out this?

  34. Gaurav says:

    I dont have any build directory in my threads directory within the src…. so build/os.dsk cant be supplied in pintos perl script. What to do ?

  35. vahab says:

    i don’t have ‘os.dsk’ in pintos file, also this file in that directory … i did them many time,but again i have same problem … please tell to me, what can i do?

  36. vahab says:

    hi,i install it successfully,but when i want to test it i have an error
    it is:
    bash:/home/vahab/pintos/crs/utils :P ermission denied
    what should i do?
    please answer asap.thank you

  37. vahab says:

    hi, again
    can i test pintos without vmware.
    i mean that i don’t install vmware

  38. Priyank says:

    Hello all!

    If you are getting the ‘Cannot find kernel’, then go to the “~/pintos/src/threads/build” and then run the command.

    Also, os.dsk wsa not found anywhere and it didn’t affect anything :D .

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>