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
cvs co -d /stumm/d/d0/tornado/torncvs co projects/tools
And build them:
cd projects/tools/kpanel; make
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.
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
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.
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
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.
target remote itchy.local:2403
Login to the chosen victim and run a program that may crash, for example:
rlogin tk5
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:
./crash
powerpc64-linux-gdb
file crash
target remote tk5:2223
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.
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 used some slides to show the work of Raymond Fingas, Adrian Tam, David Tam, and Reza Azimi.