[CSE]  Advanced Operating Systems 
 COMP9242 2004/S2 
UNSW

PRINTER Printer-Friendly Version
Administration               
- Notices
- Course Intro
- Consultations
- Survey Results
 
Work
- Lectures
- Selected Papers
- Project Spec
- Project FAQ
- Exam
 
Documentation
- Project Resources
- ASysT Lab
- Using Sulima
- L4 Debugging Guide
- L4Ka::Pistachio FAQ
- L4 source browser
- SOS source browser
- L4 reference manual
- Sulima ISA Simulator
R4x00 ISA Summary 
MIPS R4700 ReferenceMIPS R4000 User Manual 
- GT64111

 
Related Info
- Aurema OS Prize
- OS Hall of Fame
 
History
- 2003
- 2002
- 2000
- 1999
- 1998
 
Staff
- Gernot Heiser (LiC)
- Kevin Elphinstone
- Guest Lecturers (TBA)
 
Stureps
- Student Reps

 
Valid HTML 4.0!

Milestone 0: Familiarisation

This is a simple exercise designed to get you started on L4. It contains very detailed instructions, together with the existing source code and the L4 manual you should have no problem doing it.

Your Environment

Most of the 9242 binaries (eg. cross compilers) are in /home/disy/crossdev/$ARCH/bin. You can add this to your path with:
    ~ % export PATH=$PATH:/home/disy/crossdev/$ARCH/bin
  
If you are lazy you can just use the 9242 command for the cs9242 shell:
    ~ % 9242
    newclass starting new subshell for class COMP9242...
    ~ % mips64-elf-ld
    mips64-elf-ld: no input files
  

Building the L4 Kernel

  • Get a copy of the Pistachio release 0.4. Either from l4ka or the local mirror.
  • Setup the kernel build:
        ~/cs9242 % tar jxvf pistachio-0.4.tar.bz2
        ~/cs9242 % cd pistachio-0.4
        ~/cs9242/pistachio-0.4 % mkdir build
        ~/cs9242/pistachio-0.4 % cd kernel
        ~/cs9242/pistachio-0.4/kernel % make BUILDDIR=`pwd`/../build/u4600-kernel
        ~/cs9242/pistachio-0.4/kernel % cd ../build/u4600-kernel
        ~/cs9242/pistachio-0.4/kernel % make menuconfig
          
  • Using menuconfig, configure the kernel as follows
    • Hardware
      • MIPS-64 Basic Architecture
      • MIPS-64 R4X00 Processor Type
      • U4600 Platform
      • [ ] Run CPU uncached
      • No need to change Miscellaneous
    • Kernel
      • [ ] Fast IPC Path
      • [Y] Enable Debugging Mode
    • Debugger
      • [Y] Enable Kernel Debugger
      • [ ] Enable Disassembler
      • [ ] Enter kernel debugger on startup
      • [Y] Kernel debugger breakin
      • [ ] Disable all ASSERT, WARNING, TRACE, etc.
      • Trace Settings
        • [Y] Verbose initializion
        • [Y] Enable Tracepoints
        • [Y] Enable tracing of kernel memory
  • Now type make. When it completes you should have a shiny new mips64-kernel file.

Building the L4 User Code (libl4, sigma0)

  • Patch libio for a print.cc that is compatible with gcc-3.2. Using this print.cc, copy it over pistachio-0.4/user/lib/io/print.cc
       ~ % mv print.cc ~/cs9242/pistachio-0.4/user/lib/io
          
  • Patch elfloader with a linker.lds and main.cc to work with the 8mb U4600 boxes.

    Using this linker.lds, copy it over pistachio-0.4/user/contrib/elf-loader/platform/u4600/

    Using this main.cc, copy it over pistachio-0.4/user/contrib/elf-loader/platform/u4600/

       ~ % mv main.cc linker.lds ~/cs9242/pistachio-0.4/user/contrib/elf-loader/platform/u4600
          
  • Create a u4600-user build directory in pistachio. Make sure the --with-kerneldir path is correct for your setup.
        ~ % cd ~/cs9242/pistachio-0.4/build
        ~/cs9242/pistachio-0.4/build % mkdir u4600-user
        ~/cs9242/pistachio-0.4/build % cd u4600-user
        ~/cs9242/pistachio-0.4/build/u4600-user % ../../user/configure --host=mips64 --with-kerneldir=~/cs9242/pistachio-0.4/build/u4600-kernel/
        ~/cs9242/pistachio-0.4/build/u4600-user % make
          
  • You should now be able to boot the pingpong test program.
        ~/cs9242/pistachio-0.4/build/u4600-user % cp contrib/elf-loader/mips64-loader /tftpboot/kernel.img
    	
    then on the u4600 prompt do the following (see the Asyst lab notes or using sulima, for further information):
    
        mips15> boot
        Loading file: 129.94.209.95:kernel.img  (elf)
         0x80400000/456152 + 55 syms/
        Entry address is 80401c38
        mips15> g
    
    	
    and see some output and the pingpong program.

Building SOS

  • Get yourself a copy of the skeleton SOS.
  • Build and run the sample code.
    1. tar zxvf sos04.tar.gz
    2. cd sos
    3. Edit Makefile to make sure the paths are sane, in particular the L4ROOT and L4BUILDDIR variables.
    4. make
    5. This should create /tftpboot/sos.$USER
  • The example skeleton operating system includes an application tty_test which starts up, prints out its thread id, and then goes into a loop.
  • The example includes a printf implementation that outputs data to L4's debug console. In fact it uses the provided l4e_print_string function. This function should only be used for internal SOS debugging, not as a console for applications, so, your task is to modify the printf function to send data to the other serial port.

The second part of milestone zero is to find a partner for the rest of the project. The project is to be completed unless prior permission has been obtained from the LiC.

Patching SOS

The initial supplied code has some bugs in it. Patches for these can be found at this page.

Don't forget to uncomment the harware_init call in sos/main.c

Recommended procedure

  1. Read (and understand) the code in sos/main.c and the code in the tty_test application.
  2. Read the documentation on libserial.
  3. Design an IPC protocol to transfer data from the user program to your operating system.
  4. Write a client side implementation called tty_send_string (or similar) in ttyout.c.
  5. Change the syscall_loop in main.c to handle recognise your new protocol, and print out a debug message when you receive one of these messages.
  6. Edit tty_test.c so that it tests your tty_send_string function.
  7. Change the server side so that it now prints the data to the serial port.
  8. Change the implementation of printf to use your new tty_send_string function.
  9. Test that all of tty_test's output now goes to the second serial line, not the console debugger.

Assessment

You will need to demonstrate applications printing to the 2nd console, running on the U4600 hardware to the tutor during the demonstration period. You should be prepared to show your tutor which files you modified in your solution, and explain any design decisions you made.

You will let the tutor know who your partner is so that group accounts can be created for you.


Last modified: 05 Dec 2004.