kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: lexa@cfotr.com (aleksey)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Problem with module spanning from multiple files
Date: Wed, 18 Jul 2012 11:34:37 +0400	[thread overview]
Message-ID: <1342596877.3829.3.camel@calculate.local> (raw)

Hello. 

I want to build kernel module which consist from two files. 

test.c: 
#include <linux/kernel.h>
#include <linux/module.h>

int my_module_init(void)
{
	pr_emerg("Hello, world - this is the kernel speaking\n" ) ;
	return 0;
}

MODULE_DESCRIPTION("test driver" ) ;
MODULE_LICENSE("GPL v2" ) ;
MODULE_VERSION("0.1" ) ;

module_init(my_module_init) ;
module_exit(my_module_exit) ;

test_sub.c: 
#include <linux/kernel.h>  
#include <linux/module.h>  
	
void my_module_exit()
{
	pr_emerg("Short is the life of a kernel module\n" ) ;
}
Makefile: 
obj-m = test.o 
test-objs = test_sub.o
all: 
		$(MAKE) -C $(KDIR) M=$(shell pwd) modules

The module is building without any warnings. 

When i execute insmod none of message is appear. It's look like
my_module_init function does not executed at all. 

             reply	other threads:[~2012-07-18  7:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18  7:34 aleksey [this message]
2012-07-18  8:14 ` Problem with module spanning from multiple files Philipp Ittershagen
2012-07-18  8:40   ` aleksey
2012-07-18  9:27     ` Philipp Ittershagen
2012-07-18  9:40       ` aleksey
2012-07-18 14:40     ` Jonathan Neuschäfer

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=1342596877.3829.3.camel@calculate.local \
    --to=lexa@cfotr.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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;
as well as URLs for NNTP newsgroup(s).