All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: non-static init in a basic kernel module
Date: Wed, 11 Jun 2014 06:29:42 -0700	[thread overview]
Message-ID: <20140611132942.GA27236@kroah.com> (raw)
In-Reply-To: <5395620D.7050507@penguintechs.org>

On Mon, Jun 09, 2014 at 12:28:13AM -0700, Warren Turkal wrote:
> Hey,
> 
> I was writing a basic hello world module. I am using Ubuntu, so I 
> installed linux-headers package that corresponded to my kernel. It's 
> strange because all of the examples that I saw (including from modules 
> in the kernel itself) show things like the following for the init function:
> 
> static int netcat_init(void)
> {
>      ...
>      return 0;
> }
> 
> module_init(netcat_init);
> 
> However, I was not able to get it to work with "static". My 
> hello_world_init function looks like the following:
> 
> int __init hello_world_init(void)
> {
>      ...
>      return 0;
> }
> 
> module_init(hello_world_init);
> 
> The command that is used to make the kernel module is the one suggested 
> in Documentation/kbuild/modules.txt. It looks like this:
> make -C /lib/modules/`uname -r`/build M=$PWD
> 
> Does anyone know why the "static" version would not work?

What exactly were the errors you got?

  reply	other threads:[~2014-06-11 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09  7:28 non-static init in a basic kernel module Warren Turkal
2014-06-11 13:29 ` Greg KH [this message]
2014-06-16 10:29 ` sanjeev sharma
  -- strict thread matches above, loose matches on Subject: below --
2014-06-09 16:44 Warren Turkal
2014-06-09 16:49 ` Pranay Srivastava

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=20140611132942.GA27236@kroah.com \
    --to=greg@kroah.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.