All of lore.kernel.org
 help / color / mirror / Atom feed
* Kernel module compilation errors
@ 2016-08-11 19:25 Matt M
  2016-08-11 19:40 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Matt M @ 2016-08-11 19:25 UTC (permalink / raw)
  To: kernelnewbies

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

Thanks in advance for any help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160811/aacb7cd0/attachment.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Kernel module compilation errors
  2016-08-11 19:25 Kernel module compilation errors Matt M
@ 2016-08-11 19:40 ` Greg KH
  2016-08-11 21:50   ` Matt M
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2016-08-11 19:40 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Kernel module compilation errors
  2016-08-11 19:40 ` Greg KH
@ 2016-08-11 21:50   ` Matt M
  2016-08-12 17:44     ` Matt M
  0 siblings, 1 reply; 5+ messages in thread
From: Matt M @ 2016-08-11 21:50 UTC (permalink / raw)
  To: kernelnewbies

Thank you

On Thu, Aug 11, 2016 at 7:40 PM Greg KH <greg@kroah.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160811/9b8238da/attachment.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Kernel module compilation errors
  2016-08-11 21:50   ` Matt M
@ 2016-08-12 17:44     ` Matt M
  2016-08-12 17:46       ` Matt M
  0 siblings, 1 reply; 5+ messages in thread
From: Matt M @ 2016-08-12 17:44 UTC (permalink / raw)
  To: kernelnewbies

I actually found this, which was exactly what I needed.

On Thu, Aug 11, 2016 at 4:50 PM Matt M <cmorrow132@gmail.com> wrote:

> Thank you
>
> On Thu, Aug 11, 2016 at 7:40 PM Greg KH <greg@kroah.com> wrote:
>
>> 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160812/a9241fde/attachment.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Kernel module compilation errors
  2016-08-12 17:44     ` Matt M
@ 2016-08-12 17:46       ` Matt M
  0 siblings, 0 replies; 5+ messages in thread
From: Matt M @ 2016-08-12 17:46 UTC (permalink / raw)
  To: kernelnewbies

Seems like My link didn;'t paste in on the last message -
http://www.tldp.org/LDP/lkmpg/2.6/lkmpg.pdf

On Fri, Aug 12, 2016 at 12:44 PM Matt M <cmorrow132@gmail.com> wrote:

> I actually found this, which was exactly what I needed.
>
> On Thu, Aug 11, 2016 at 4:50 PM Matt M <cmorrow132@gmail.com> wrote:
>
>> Thank you
>>
>> On Thu, Aug 11, 2016 at 7:40 PM Greg KH <greg@kroah.com> wrote:
>>
>>> 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
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160812/8312ddcc/attachment.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-12 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11 19:25 Kernel module compilation errors Matt M
2016-08-11 19:40 ` Greg KH
2016-08-11 21:50   ` Matt M
2016-08-12 17:44     ` Matt M
2016-08-12 17:46       ` Matt M

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.