kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* help please first module
@ 2016-07-25 18:04 hinawa
  2016-07-25 18:16 ` Mike Krinkin
  0 siblings, 1 reply; 4+ messages in thread
From: hinawa @ 2016-07-25 18:04 UTC (permalink / raw)
  To: kernelnewbies

hello i am starting to write modules and this code does not compile

hello.c:

/********************

  Modulo experimental

********************/*

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Alberto Cerezo <ac90869@gmail.com>");
MODULE_DESCRIPTION("\"Hola Mundo\" Modulo experimental");
MODULE_VERSION("printk");

static int __init hola_init(void)
{
	printk(KERN_INFO "Hola mundo\n");
	return 0;
}


static void __exit hola_exit(void)
{
	printk(KERN_INFO "Adios, me marcho\n");
}

module_init(hola_init);
module_exit(hola_exit);


Makefile:

obj-m += hello.o

all:
	make -C /lib/modules/$(shell uname -r)/build M=${PWD} modules
clean:
	make -C /lib/modules/$(shell uname -r)/build M=${PWD} clean


error:

In file included from 
/usr/src/linux-headers-4.6.0-1-common/include/linux/init.h:4:0,
                  from 
/home/hinawa/Documentos/programasC/modulos/mod1/hello.c:9:
/usr/src/linux-headers-4.6.0-1-common/include/linux/compiler.h:89:1: 
error: expected identifier or ?(? before ?struct?
  struct ftrace_branch_data {
  ^
make[4]: *** [/home/hinawa/Documentos/programasC/modulos/mod1/hello.o] 
Error 1
make[3]: *** [_module_/home/hinawa/Documentos/programasC/modulos/mod1] 
Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2



I do not get to find the error because the code appears to be correct ...

thks

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

* help please first module
  2016-07-25 18:04 help please first module hinawa
@ 2016-07-25 18:16 ` Mike Krinkin
  2016-07-26  1:40   ` Rajesh Bhaskaran
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Krinkin @ 2016-07-25 18:16 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 25, 2016 at 08:04:41PM +0200, hinawa wrote:
> hello i am starting to write modules and this code does not compile
> 
> hello.c:
> 
> /********************
> 
>   Modulo experimental
> 
> ********************/*

Probably, error is in the line above.

> 
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> 
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Alberto Cerezo <ac90869@gmail.com>");
> MODULE_DESCRIPTION("\"Hola Mundo\" Modulo experimental");
> MODULE_VERSION("printk");
> 
> static int __init hola_init(void)
> {
> 	printk(KERN_INFO "Hola mundo\n");
> 	return 0;
> }
> 
> 
> static void __exit hola_exit(void)
> {
> 	printk(KERN_INFO "Adios, me marcho\n");
> }
> 
> module_init(hola_init);
> module_exit(hola_exit);
> 
> 
> Makefile:
> 
> obj-m += hello.o
> 
> all:
> 	make -C /lib/modules/$(shell uname -r)/build M=${PWD} modules
> clean:
> 	make -C /lib/modules/$(shell uname -r)/build M=${PWD} clean
> 
> 
> error:
> 
> In file included from 
> /usr/src/linux-headers-4.6.0-1-common/include/linux/init.h:4:0,
>                   from 
> /home/hinawa/Documentos/programasC/modulos/mod1/hello.c:9:
> /usr/src/linux-headers-4.6.0-1-common/include/linux/compiler.h:89:1: 
> error: expected identifier or ?(? before ?struct?
>   struct ftrace_branch_data {
>   ^
> make[4]: *** [/home/hinawa/Documentos/programasC/modulos/mod1/hello.o] 
> Error 1
> make[3]: *** [_module_/home/hinawa/Documentos/programasC/modulos/mod1] 
> Error 2
> make[2]: *** [sub-make] Error 2
> make[1]: *** [all] Error 2
> make: *** [all] Error 2
> 
> 
> 
> I do not get to find the error because the code appears to be correct ...
> 
> thks
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

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

* help please first module
  2016-07-25 18:16 ` Mike Krinkin
@ 2016-07-26  1:40   ` Rajesh Bhaskaran
  2016-07-26 13:47     ` hinawa
  0 siblings, 1 reply; 4+ messages in thread
From: Rajesh Bhaskaran @ 2016-07-26  1:40 UTC (permalink / raw)
  To: kernelnewbies

Yes the way comments are included within / ... / is wrong as there is an Asterisk after the / too . Compiler is not able to recognise the same.




via CloudMagic Email [https://cloudmagic.com/k/d/mailapp?ct=pa&cv=8.5.49&pv=6.0.1&source=email_footer_2] On Mon, Jul 25, 2016 at 11:48 PM, Mike Krinkin < krinkin.m.u at gmail.com [krinkin.m.u@gmail.com] > wrote:
On Mon, Jul 25, 2016 at 08:04:41PM +0200, hinawa wrote:
> hello i am starting to write modules and this code does not compile
>
> hello.c:
>
> /********************
>
> Modulo experimental
>
> ********************/*

Probably, error is in the line above.

>
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Alberto Cerezo <ac90869@gmail.com>");
> MODULE_DESCRIPTION("\"Hola Mundo\" Modulo experimental");
> MODULE_VERSION("printk");
>
> static int __init hola_init(void)
> {
> printk(KERN_INFO "Hola mundo\n");
> return 0;
> }
>
>
> static void __exit hola_exit(void)
> {
> printk(KERN_INFO "Adios, me marcho\n");
> }
>
> module_init(hola_init);
> module_exit(hola_exit);
>
>
> Makefile:
>
> obj-m += hello.o
>
> all:
> make -C /lib/modules/$(shell uname -r)/build M=${PWD} modules
> clean:
> make -C /lib/modules/$(shell uname -r)/build M=${PWD} clean
>
>
> error:
>
> In file included from
> /usr/src/linux-headers-4.6.0-1-common/include/linux/init.h:4:0,
> from
> /home/hinawa/Documentos/programasC/modulos/mod1/hello.c:9:
> /usr/src/linux-headers-4.6.0-1-common/include/linux/compiler.h:89:1:
> error: expected identifier or ?(? before ?struct?
> struct ftrace_branch_data {
> ^
> make[4]: *** [/home/hinawa/Documentos/programasC/modulos/mod1/hello.o]
> Error 1
> make[3]: *** [_module_/home/hinawa/Documentos/programasC/modulos/mod1]
> Error 2
> make[2]: *** [sub-make] Error 2
> make[1]: *** [all] Error 2
> make: *** [all] Error 2
>
>
>
> I do not get to find the error because the code appears to be correct ...
>
> thks
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160726/47fa739e/attachment.html 

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

* help please first module
  2016-07-26  1:40   ` Rajesh Bhaskaran
@ 2016-07-26 13:47     ` hinawa
  0 siblings, 0 replies; 4+ messages in thread
From: hinawa @ 2016-07-26 13:47 UTC (permalink / raw)
  To: kernelnewbies

Unfortunately, although i was looking at had not seen, i was centered
in the code ... excuse me and thank you (both) for your time


On Tue, Jul 26, 2016 at 07:10:10AM +0530, Rajesh Bhaskaran wrote:
> Yes the way comments are included within / ... / is wrong as there is an Asterisk after the / too . Compiler is not able to recognise the same.
> 
> 
> 
> 
> via CloudMagic Email [https://cloudmagic.com/k/d/mailapp?ct=pa&cv=8.5.49&pv=6.0.1&source=email_footer_2] On Mon, Jul 25, 2016 at 11:48 PM, Mike Krinkin < krinkin.m.u at gmail.com [krinkin.m.u@gmail.com] > wrote:
> On Mon, Jul 25, 2016 at 08:04:41PM +0200, hinawa wrote:
> > hello i am starting to write modules and this code does not compile
> >
> > hello.c:
> >
> > /********************
> >
> > Modulo experimental
> >
> > ********************/*
> 
> Probably, error is in the line above.
> 
> >
> > #include <linux/init.h>
> > #include <linux/module.h>
> > #include <linux/kernel.h>
> >
> > MODULE_LICENSE("GPL");
> > MODULE_AUTHOR("Alberto Cerezo <ac90869@gmail.com>");
> > MODULE_DESCRIPTION("\"Hola Mundo\" Modulo experimental");
> > MODULE_VERSION("printk");
> >
> > static int __init hola_init(void)
> > {
> > printk(KERN_INFO "Hola mundo\n");
> > return 0;
> > }
> >
> >
> > static void __exit hola_exit(void)
> > {
> > printk(KERN_INFO "Adios, me marcho\n");
> > }
> >
> > module_init(hola_init);
> > module_exit(hola_exit);
> >
> >
> > Makefile:
> >
> > obj-m += hello.o
> >
> > all:
> > make -C /lib/modules/$(shell uname -r)/build M=${PWD} modules
> > clean:
> > make -C /lib/modules/$(shell uname -r)/build M=${PWD} clean
> >
> >
> > error:
> >
> > In file included from
> > /usr/src/linux-headers-4.6.0-1-common/include/linux/init.h:4:0,
> > from
> > /home/hinawa/Documentos/programasC/modulos/mod1/hello.c:9:
> > /usr/src/linux-headers-4.6.0-1-common/include/linux/compiler.h:89:1:
> > error: expected identifier or ?(? before ?struct?
> > struct ftrace_branch_data {
> > ^
> > make[4]: *** [/home/hinawa/Documentos/programasC/modulos/mod1/hello.o]
> > Error 1
> > make[3]: *** [_module_/home/hinawa/Documentos/programasC/modulos/mod1]
> > Error 2
> > make[2]: *** [sub-make] Error 2
> > make[1]: *** [all] Error 2
> > make: *** [all] Error 2
> >
> >
> >
> > I do not get to find the error because the code appears to be correct ...
> >
> > thks
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-- 

Vaya mundo en el que vivimos, ?verdad?... pero podr?a ser peor, ?verdad?
As? es -dije-, o peor a?n, podr?a ser perfecto.
William Gibson

Usuario Linux Debian #594057
www.debian.org 

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

end of thread, other threads:[~2016-07-26 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-25 18:04 help please first module hinawa
2016-07-25 18:16 ` Mike Krinkin
2016-07-26  1:40   ` Rajesh Bhaskaran
2016-07-26 13:47     ` hinawa

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