From: Daniel Phillips <phillips@bonn-fries.net>
To: corbet@lwn.net (Jonathan Corbet),
Patrick Ouellet <patrick.ouellet@microtecsecurite.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: In great need
Date: Thu, 25 Oct 2001 22:10:39 +0200 [thread overview]
Message-ID: <20011025200943Z16552-698+435@humbolt.nl.linux.org> (raw)
In-Reply-To: <20011025163450.706.qmail@eklektix.com>
In-Reply-To: <20011025163450.706.qmail@eklektix.com>
On October 25, 2001 06:34 pm, Jonathan Corbet wrote:
> > Were should I start.
>
> KernelNewbies.org is intended to be a starting place for kernel hackers.
>
> May I also humbly suggest _Linux_Device_Drivers_? It's online at
>
> http://www.xml.com/ldd/chapter/book/index.html
>
> But, of course, you'll want to buy a copy at the bookstore of your choice
> as well :)
Yes, that's where I started. Being somewhat impatient, I just flipped to
chapter two, which has a 4 line example of a kernel module which I'll
paraphrase here:
#define MODULE
#include <linux/module.h>
int init_module(void) { printk("Hello kernel!\n"); return 0; }
void cleanup_module(void) { printk("Goodbye kernel!\n"); }
Then I did (more or less):
cc -c hello.c -I/usr/src/2.4.12/include
su
insmod hello.o
dmesg
lsmod
rmmod hello
dmesg
lsmod
So my first kernel hack took about 5 minutes, with the help of this book.
Note: some of that 5 minutes was spent figuring out that kernel messages
don't get printed to the console if you're running X, hence the dmesg's.
You'll have to update the example in the book - simply doing "cc -c hello.c"
works only when the /usr/include/version.h happens to match your running
kernel, which isn't very likely.[1]
The big advantage of starting with module programming is, you don't
necessarily have to understand the entire kernel to get started - the
interfaces available to modules tend to be easier to understand and work with
than the other, often subtle and sparsely documented interfaces used
internally by the kernel itself.
And yes, I do have to go out and get the 2nd edition of LDD, co-starring you
:-)
[1] Because /usr/include/linux is no longer allowed to symlink to
/usr/src/linux/include/linux.
--
Daniel
next prev parent reply other threads:[~2001-10-25 20:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-25 15:32 Patrick Ouellet
2001-10-25 15:58 ` Rik van Riel
2001-10-25 18:52 ` Daniel Phillips
2001-10-25 19:37 ` EvilTypeGuy
2001-10-25 19:45 ` Jonathan Corbet
2001-10-25 19:54 ` Tahar
2001-10-25 20:08 ` EvilTypeGuy
2001-10-25 20:13 ` Robert Love
2001-10-26 16:41 ` basic questions of memory management Hong Hsu
2001-10-25 16:34 ` In great need Jonathan Corbet
2001-10-25 20:10 ` Daniel Phillips [this message]
[not found] <fa.jh1e0kv.4k8ujg@ifi.uio.no>
2001-10-25 16:14 ` John Weber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011025200943Z16552-698+435@humbolt.nl.linux.org \
--to=phillips@bonn-fries.net \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=patrick.ouellet@microtecsecurite.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®