kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Kernelnewbies Digest, Vol 69, Issue 18
       [not found] <mailman.1.1471017601.30710.kernelnewbies@kernelnewbies.org>
@ 2016-08-13  4:10 ` Yubin Ruan
  0 siblings, 0 replies; only message in thread
From: Yubin Ruan @ 2016-08-13  4:10 UTC (permalink / raw)
  To: kernelnewbies

> On Thu, Aug 11, 2016 at 07:25:45PM +0000, Matt M wrote:
> > I am just getting started with kernel module development, and I can't get
> > anything to compile.
> > 
> > I get the following errors:
> > 
> > In file included from main.c:1:0:
> > /usr/src/linux/include/linux/init.h:142:13: error: expected ?=?, ?,?, ?;?,
> > ?asm? or ?__attribute__? before ?load_default_modules?
> > ?void __init load_default_modules(void);
> > ? ? ? ? ? ? ?^~~~~~~~~~~~~~~~~~~~
> > /usr/src/linux/include/linux/init.h:143:12: error: expected ?=?, ?,?, ?;?,
> > ?asm? or ?__attribute__? before ?init_rootfs?
> > ?int __init init_rootfs(void);
> > ? ? ? ? ? ? ^~~~~~~~~~~
> > /usr/src/linux/include/linux/init.h:285:13: error: expected ?=?, ?,?, ?;?,
> > ?asm? or ?__attribute__? before ?parse_early_param?
> > ?void __init parse_early_param(void);
> > ? ? ? ? ? ? ?^~~~~~~~~~~~~~~~~
> > /usr/src/linux/include/linux/init.h:286:13: error: expected ?=?, ?,?, ?;?,
> > ?asm? or ?__attribute__? before ?parse_early_options?
> > ?void __init parse_early_options(char *cmdline);
> > 
> > 
> > The errors go on and on, but the majority look like that.
> > 
> > My code:
> > 
> > #include <linux/init.h>
> > #include <linux/module.h>
> > 
> > int main() {
> > return 0;
> > }
> > 
> > 
> > The compile command:
> > gcc -I /usr/src/linux/include/ main.c
> 
> That's not how you compile a Linux kernel module, sorry.
> 
> Please read the very good documentation for how to set up a Makefile for
> building a kernel module.  It's in the kernel's Documentation/
> directory.
> 
> best of luck,
> 
> greg k-h
 
Alternatively, try this doc on TLKD:
    http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html
it's kind of outdated, but some code there still compile against the newest
kernel.

good luck,
Ruan.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-13  4:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1.1471017601.30710.kernelnewbies@kernelnewbies.org>
2016-08-13  4:10 ` Kernelnewbies Digest, Vol 69, Issue 18 Yubin Ruan

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).