Debug the kernel using two computers

From KolibriOS wiki
Revision as of 10:42, 31 December 2012 by Hidnplayr (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To debug the kernel, you could make use of virtual machines. But sometimes it is needed to test your code on live hardware.

Both computers are connected to my home network. The develop computer runs a TFTP server (Tftpd32 in my case) wich hosts two files, the KolibriOS kernel and the Floppy image containing the programs etc. To easily update a driver or program in the virtual floppy, you can mount it on the develop computer using VFD

The debug computer boots from a floppy wich contains this bootloader (source code mirror here) This bootloader only works with RTL8139 cards. Another options is to Boot from PXE.

I also connected the 2 machines via RS232 (null-modem) cable. This cable sends the debug output from the debug machine to the develop machine. I have included an option (at compile time) in the KolibriOS kernel to enable this debug output. You can view the debug info on the other computer using putty or another program. The advantage of putty is, it's free, and it can save the received input into a log file.

So, when the driver/kernel code you're debugging crashes, you'll know where because of all the debug output you placed in your code, and you'll be able to easily fix it, recompile it and just reboot your debug PC.

Once TCP works stable, you'll be able to use Synergy to share the same keyboard and mouse for both machines !

To automate the process even further, I created a batch file to compile all files of interest, and copy them to the virtual floppy drive and kernel file locations.