From: Sam Ravnborg <sam@ravnborg.org>
To: Andi Kleen <ak@muc.de>
Cc: Steve Hemond <steve.hemond@sympatico.ca>, linux-kernel@vger.kernel.org
Subject: Re: Inserting a module (2.6 kernel)
Date: Sat, 12 Jun 2004 23:08:20 +0200 [thread overview]
Message-ID: <20040612210820.GA2405@mars.ravnborg.org> (raw)
In-Reply-To: <m3oentkqpd.fsf@averell.firstfloor.org>
On Wed, Jun 09, 2004 at 11:47:58AM +0200, Andi Kleen wrote:
>
> Now since 2.6.5 or so it needs:
>
> /* MODULE is not needed anymore */
> #define __KERNEL__1
> #include <linux/module.h>
>
> int init_module(void)
> {
> printk("Hello world\n");
> return 0;
> }
>
> struct module __this_module
> __attribute__((section(".gnu.linkonce.this_module"))) = {
> .name = "hello",
> .init = init_module,
> };
Most of the glue above can be deleted if you just accept to use kbuild when
building modules.
So to compile your module use a simple Makefile:
obj-m := mymodule.o
Then to compile the module use:
make -C path/to/kernel/src M=`pwd`
And to install it use:
make -C path/to/kernel/src M=`pwd` modules_install
And to clean up in the directory where the module is being compiled:
make -C path/to/kernel/src M=`pwd` clean
Sam
next prev parent reply other threads:[~2004-06-12 21:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <24Zio-6xX-3@gated-at.bofh.it>
2004-06-09 9:47 ` Andi Kleen
2004-06-12 21:08 ` Sam Ravnborg [this message]
2004-06-09 0:33 Steve Hemond
2004-06-09 0:40 ` Arthur Othieno
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=20040612210820.GA2405@mars.ravnborg.org \
--to=sam@ravnborg.org \
--cc=ak@muc.de \
--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
all inboxes | Powered by JetHome®