Introduction by IBM

Introduction by Michael

K42 and Running K42 at the University of Toronto

Parts of K42

K42 source code
from IBM CVS repository; we normally work with an up to date tree and commit our changes back to it.
Linux-K42
from public Linux sources, with patches from IBM; this is built per-site. Raymond is the local maintainer.
Packages
that run on K42, such as ls, tar, gcc, etc.. 64-bit powerpc versions can be hard to find, so IBM provides these to each site. Raymond is the local maintainer.
Support tools
used to build and run K42. Includes a cross compiler for building K42 and K42 applications, plus various tools to automate parts of the building and running process. Many of the latter are specific to Toronto.

Paths and Environment Variables

As promised, here is a list of required paths:

/bin
/usr/bin
***Your k42 root path***/install/tools/Linux/powerpc
/itchy-scr/fingas/toolchain/bin
/stumm/d/d0/tornado/tools/i686/bin
/kitchawa/k42/Linux/i686/kitchawa/tools/bin
/guest/kitchawa/bin
***Your projects path***/tools/kpanel
***Your projects path***/tools/scripts

And environment variables (optional ones marked with a *):

LD_LIBRARY_PATH=/stumm/d/d0/tornado/tools/i686/lib
K42_SITE=toronto
*KPANEL_MODE=k42
*KPANEL_NFS_ROOT=/itchy-scr/$USER/???/install/powerpc/???Deb/kitchroot
*KPANEL_KERN_PATH=10.1.1.2:/scr/$USER/???/powerpc/???Deb/os/chrpboot.tok

Checkout Local Tools

cvs co -d /stumm/d/d0/tornado/torncvs co projects/tools

And build them:

cd projects/tools/kpanel; make

Checkout K42

Use the ibmcvs script from the local tools; it is just a CVS wrapper to use the IBM external K42 repository.

ibmcvs co -D "2004/02/21" kitchsrc

The -D flag gets a version that is a few weeks old. There is a new version of Linux-K42 that uses a 2.6 kernel that is not yet installed at Toronto, requiring us to use a slightly older tree until a new Linux-K42 is installed.

Build K42

First copy over powerpc-hw.cfg into your tree. This file has changed from the IBM copy recently due to a hardware failure at Toronto.

cp ~kitchawa/bin/powerpc-hw.cfg kitchsrc/tools/misc/

Then set up links so that the build directories can be NFS mounted when K42 is booted on hardware. There is a script to do that.

mklinks

Then build K42.

cd kitchsrc; make full_snapshot

Boot K42

Run kpanel, our tool to partially automate booting K42. There should be three terminals embedded in it when it runs, but sometimes it doesn't work. If they don't all show up, close it and try again.

cd projects/tools/kpanel; kpanel

The first (red) terminal is the service processor console. It is for configuring the hardware and booting the main processors. The second and third consoles are for thinwire, a low level protocol we use to speak to the K42 kernel and to connect a debugger to the kernel. The bottom thinwire console is usually the most interesting, since the kernel console gets displayed in it.

Select and lock a victim machine in kpanel. Double check that your NFS root and kernel paths are correct. Select the reconnect-k42 action and click do. After fifteen seconds or so the bottom panel should present the kernel console. If the machine is turned off or crashed, you should power it off. You will need to power it on, then select boot-k42 before clicking do. Waiting for the whole machine to boot (as opposed to just K42) takes several minutes.

Connect Kernel Debugger and Reboot

From the kernel console, enter 0 (command menu) then G (connect gdb). Change to your kernel path directory and run powerpc64-linux-gdb. For example:

cd /itchy-scr/k42test/0/powerpc/partDeb/os; powerpc64-linux-gdb

Then within the debugger, load the symbols and connect to K42 at the correct port and machine (the middle panel should display the port number on the last line). We'll connect to tk5:

file boot_image.dbg
target remote itchy.local:2403

You then have full source-level debugging of the K42 kernel. Once we have finished with the debugger we can continue. Maybe we'd like to reboot. K42 has a fast reboot mode that just reinitializes the OS without resetting the hardware or reloading the kernel from the NFS host or thinwire. From the kernel console, choose 0 for command, then X for fast reboot.

Login and Debug User Programs

Login to the chosen victim and run a program that may crash, for example:

rlogin tk5
./crash

If it crashes, connect the debugger directly to the machine on the port specified. If you compiled with debugging information you can get source level debugging of user applications as well. Assuming you are in a directory containing the binary you want to debug, such as the directory it is NFS mounted on the victim from:

powerpc64-linux-gdb
file crash
target remote tk5:2223

Loading a New Kernel

If we build a new kernel we can download it from within K42. From the kernel console, type 0 for the command menu and D to download a new kernel. Then type 0 again and X to reboot to the new kernel.

Shutting Down K42

Now we're done with booting and playing with K42, so we will disconnect thinwire and leave it for the next person to use. From the kernel console, type 0 for command menu and XX for shutdown and disconnect thinwire. Then unlock the victim and close kpanel.

Presentation of Student Work

Presentation used some slides to show the work of Raymond Fingas, Adrian Tam, David Tam, and Reza Azimi.