public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: "Richard Copeman" <richard.copeman@lauterbach.co.uk>
To: linux-omap-open-source@linux.omap.com
Subject: How to build Kernel Modules
Date: Thu, 13 Jul 2006 16:00:01 +0100	[thread overview]
Message-ID: <008301c6a68d$041f5680$642aa8c0@Buffy> (raw)
In-Reply-To: <20060713083220.9E5768062E@linux.omap.com>

Hi,

I don't know if this is the right place to ask...

I have OMAP 5912OSK with a 2.6.15 kernel cross compiled from SUSE 9.2 using
GCC 3.4.1. That works and I am happy with it. I can build my own tasks and
include them into my RAM disk image.

The next challenge is to build a kernel module. I followed the guidelines in
Peter Salzman's book/FAQ/tutorial and tried to adapt it for cross compiling:

Arm-linux-gcc -c hellomod.c -Wall

This produced hellomod.o but when I tried to insmod it on my target I got an
error:

/ # ls
ascii       etc         lib         proc        sys         var
bin         hello       linuxrc     sbin        tmp
dev         hellomod.o  lost+found  sieve       usr
/ # insmod ./hellomod.o
Using ./hellomod.o
No module found in object
insmod: cannot insert `./hellomod.o': Invalid module format (-1): Exec
format error
/ # _

I suspect I haven't done something right in the build stage for my KO. 

My source code is simple and looks like this:

#define __KERNEL__
#define MODULE

#include "/usr/local/arm/3.4.1/arm-linux/include/linux/module.h"
#include "/usr/local/arm/3.4.1/arm-linux/include/linux/kernel.h"

#include "/usr/local/arm/3.4.1/arm-linux/include/linux/tty.h"

int init_module()
{
	console_print("Hello World from Rico\n");
	return 0;
}

void cleanup_module()
{
	console_print("Goodbye from Rico!\n");
}

Can somebody point me at an FAQ or how to for cross compiling Kernel Modules
please?

TIA,

Richard.

       reply	other threads:[~2006-07-13 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060713083220.9E5768062E@linux.omap.com>
2006-07-13 15:00 ` Richard Copeman [this message]
2006-07-13 15:24 How to build Kernel Modules Woodruff, Richard
2006-07-13 15:37 ` Richard Copeman
  -- strict thread matches above, loose matches on Subject: below --
2006-07-13 15:43 Woodruff, Richard
2006-07-14  2:08 Ishigami, Tatsuya

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='008301c6a68d$041f5680$642aa8c0@Buffy' \
    --to=richard.copeman@lauterbach.co.uk \
    --cc=linux-omap-open-source@linux.omap.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