Some Tips for Project Development


  1. Subversion
  2. Debugging
  3. Testing on a PC (not on a VMware Player)

1. Subversion

To make it easier to access the project's SVN repository at https://redmine.fe.up.pt, I have installed the subversion-base Minix 3 package on both VMware Players of all PCs in the lab. (If you wish to do the same on your own PC, please visit the appropriate page on Minix 3's Users Guide.)

Although the SVN client in this package is a command line client, in the labs set up it is more convenient than for example Eclipse's SVN package. This is because Eclipse's is running on Linux, and thus any checkout would create a working copy on Linux rather than in Minix. Thus, you would have to make yet another copy from Linux to Minix 3 on the VMware Player. And, in order to save your changes to the repository, you would have to copy the modified files back to Linux from Minix 3, before committing to the repository.

Instead, with the command line client, you can create a working copy on Minix (in a VMware Player), change it and commit once you are done, without additional copies.

Roughly, your session will be as follows:

  1. Login on Linux as user lcom
  2. Start Minix 3 on a VMware Player
  3. Login on Minix 3 as root
  4. Create a directory for your project under /usr/src/drivers/ in Minix 3
  5. Change the ownership of that directory to user lcom
  6. Logout and login again on Minix 3, this time as user lcom
  7. Checkout your repository, using the command line SVN client in Minix 3, to the directory you created above
  8. Use Eclipse's RSE package, in Linux, to develop your project
  9. Test your Minix 3 code as you have done in the lab classes
  10. When ready, commit your changes to the working copy in Minix 3 to the repository

For more details on the SVN commands please check:

2. Debugging

Given that Minix 3 does not have any generic debugging tool, such as a debugger, printf() will be your main debugging tool.

This is (more or less) OK when you use the video card in text mode, because the output of printf() executed by privileged processes is displayed on the first virtual terminal, or the console. However, when you use the video card in graphics mode you do not see what is being printed by your program. However, nothing is lost: privileged processes printf() output is not only sent to the console, the first virtual terminal, if the video card is in text mode, but also to the file /usr/log/messages. Therefore, to see the output printed by your program, all you need to do is to read /usr/log/messages. Although you can use any editor for that, or even a pager, like more, a utility that can be very convenient is tail, which displays the "tail" of a file, i.e. the last few lines of a file.

Using a Linux terminal, ssh to login "remotely" in Minix, and executing the command tail -f, allows you to see what your application is printing as it executes, i.e. as if you were on the console, with the advantage that there are Linux terminals that support scrolling, and therefore you can scroll the output generated by your application.

3. Testing on a PC (not on a VMware Player)

Once you have tested your project on VMware Player, you are expected to test it by running it directly on a PC. If you are using the speaker, you will want to do it sooner than later.

The problem is that the network card of the PCs is not supported by Minix 3, and therefore in order to copy the code to the Minix 3 partition on the PC's hard disk, you will have to use ... a floppy.

Access to floppies by Minix and by Linux is simpler if you use Minix 3's dosdir/dosread/doswrite utilities and GNU's mtoolsutilitiesutilities on Linux.

Because your program is likely to be composed of a relatively large set of files, it is better to create first an archive file, using for example the tar utility, which you can find in both Linux and Minix 3. Thus the testing session would be more or less as follows:

  1. In Minix3 on VMware Player, clean the directory with your project (we can recompile the project)
  2. In Minix3 on VMware Player, create an archive file of your project directory
  3. Copy that file from Minix 3 on VMware to Linux
  4. Use mtools, actually mcopy to copy the archive to the floppy, in Linux
  5. Reboot your PC (make sure that you have saved all your changes, otherwise they will be wiped out.
  6. On the PC's boot menu select Minix 3
  7. Login as root
  8. Copy the archive file from the floppy to the hard disk, on Minix 3
  9. Unpack the archive file in the right place
  10. Compile your project again, this time on the PC's hard disk, and run it
  11. Make corrections, if any, using either vi or nano, and test again
  12. Once you are done, make a new archive with the changed files, and copy it back to Minix 3 on VMware Player, using the floppy

IMP It may be convenient to include the /etc/system.conf file in the archive.