From: a.othieno@bluewin.ch (Arthur Othieno)
To: Steve Hemond <steve.hemond@sympatico.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Inserting a module (2.6 kernel)
Date: Wed, 9 Jun 2004 02:40:43 +0200 [thread overview]
Message-ID: <20040609004043.GA1380@mars> (raw)
In-Reply-To: <20040608203342.2aa2522c.steve.hemond@sympatico.ca>
On Tue, Jun 08, 2004 at 08:33:42PM -0400, Steve Hemond wrote:
> Hi people,
>
> I am new to kernel module writing and I base myself on the Linux Device Drivers book from O'reilly. I have written this simple module :
>
> #include <linux/module.h>
>
> int init_module(void)
> {
> printk("<1>Module inserted\n");
> return 0;
> }
>
> void cleanup_module(void)
> {
> printk("<1>Module removed\n");
> }
http://lwn.net/Articles/21817/
> And this is the Makefile :
>
> KERNELDIR = /usr/src/linux
>
> include $(KERNELDIR)/.config
>
> CFLAGS = -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include \
> -O -Wall
>
> ifdef CONFIG_SMP
> CFLAGS += -D__SMP__ -DSMP
> endif
>
> all : moduletest.o
>
> clean :
> rm -f *.o *~ core
>
http://lwn.net/Articles/21823/
> And look at this :
>
> bash-2.05b# make
> gcc -D__KERNEL__ -DMODULE -I/usr/src/linux/include -O -Wall -c -o moduletest.o moduletest.c
> bash-2.05b# insmod ./moduletest.o
> insmod: error inserting './moduletest.o': -1 Invalid module format
http://kernel.org/pub/linux/utils/kernel/module-init-tools/
http://lwn.net/Articles/22197/ "Kernel version checking"
> Anyone know what needs to be added or changed for kernel 2.6, or maybe its simply my own mistake?
>
> (By the way, if you know of a kernel-beginner mailing list that would be better suited about this, tell me)
http://kernelnewbies.org/mailinglist.php3
$ echo subscribe kernelnewbies | mail listar@nl.linux.org
> Thanks a lot in advance,
>
> Best regards,
>
> Steve
Arthur
next prev parent reply other threads:[~2004-06-09 0:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-09 0:33 Inserting a module (2.6 kernel) Steve Hemond
2004-06-09 0:40 ` Arthur Othieno [this message]
[not found] <24Zio-6xX-3@gated-at.bofh.it>
2004-06-09 9:47 ` Andi Kleen
2004-06-12 21:08 ` Sam Ravnborg
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=20040609004043.GA1380@mars \
--to=a.othieno@bluewin.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=steve.hemond@sympatico.ca \
/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