Re: Kernel and drivers

Andrew E. Mileski (
Thu, 5 Sep 1996 21:09:13 -0400 (EDT)

> I am writing a device driver for linux. Of course , I modify some of
> kernal source file. How can I make a patch file for that drvier so that
> I can add the driver in the furthure ? And how can I debug in the kernal ?

I suggest the following:
1) Put a virgin kernel in /usr/src/linux-X.X.XX
where X.X.XX is the kernel version

2) Have your _MODIFIED_ kernel in /usr/src/linux

3) diff -u --recursive --new-file linux-X.X.XX linux > my_patch
gzip -9 my_patch # creates my_patch.gz

4) If you want to mail the patch out:
uuencode my_patch my_patch > my_patch.uue
then append it to your mail message, which MUST include
a description of the patch, and the kernel version it is for.
(I use Elm, which uses vi as the editor "<ESC>:r my_patch.uue")

DO _NOT_ USE MIME! Many people can't read MIME messages!

Note that Step 1 will put the kernel version in the patch! :-)
This is exremely helpful, but you should also state the version
in the text of your message!

Debugging the kernel can be done with strategic placements of
printk() ... unless you want to force a panic and get a register dump.
This is not fancy, but it works :-)

A fancy way to debug: create a /proc entry that spews out useful
info. This is a really easy thing to do. Just be sure to remove
any code for your debugging entry BEFORE sending the patch out!!!

Andrew E. Mileski 
Linux Plug-and-Play Project Leader
PGP public keys are available from