* Re: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
@ 2015-04-18 10:32 crazylinuxcnc
2015-04-20 8:28 ` Helder Daniel
0 siblings, 1 reply; 6+ messages in thread
From: crazylinuxcnc @ 2015-04-18 10:32 UTC (permalink / raw)
To: Helder Daniel; +Cc: Xenomai@xenomai.org
----- Reply message -----
From: "Helder Daniel" <hdaniel@ualg.pt>
To: "Ruika You" <crazylinuxcnc@gmail.com>
Cc: "Xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
Date: Sat, Apr 18, 2015 5:35 PM
Hi,
Are you using Xenomai version 3.x or 2.6.x?
My xenomai version is 2.6.4
In version 3.x the native API is no longer exported to kernel, only the RTDM API.
//NOT EXPORTED in 3.x: #include <native/task.h>
Helder
On 18 April 2015 at 03:52, Ruika You <crazylinuxcnc@gmail.com> wrote:
Dear all,
I just start to explore xenomai with compile a kernel module as simple as
"hello world". After compile successful, sudo insmod kernel-task.ko,
failed, error message as follow:
Error: could not insert module kernel-task.ko: Unknown symbol in module
Dmesg result as belllow:
[52170.262642] kernel_task: Unknown symbol rt_task_create (err 0)
[52170.262688] kernel_task: Unknown symbol rt_task_start (err 0)
[52170.262722] kernel_task: Unknown symbol rt_task_delete (err 0)
Source code:
#include <native/task.h>
#define TASK_PRIO 99 /* Highest RT priority */
#define TASK_MODE T_FPU|T_CPU(0) /* Uses FPU, bound to CPU #0 */
#define TASK_STKSZ 4096 /* Stack size (in bytes) */
RT_TASK task_desc;
void task_body (void *cookie)
{
for (;;) {
/* ... "cookie" should be NULL ... */
}
}
int init_module (void)
{
int err;
/* ... */
err =
rt_task_create(&task_desc,"MyTaskName",TASK_STKSZ,TASK_PRIO,TASK_MODE);
if (!err)
rt_task_start(&task_desc,&task_body,NULL);
return 1;
/* ... */
}
void cleanup_module (void)
{
rt_task_delete(&task_desc);
}
As I analyzed the reason might be :
1. kernel build configure problem ?
2. xenomai userland configure problem?
3. any xenomai module not loaded? native?
4. have to export all these unknow symbol to kernel?
Please advise!
Thank you very much!
-chengxi
_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai
--
Helder Daniel
UALG - FCT
DEEI
http://w3.ualg.pt/~hdaniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
2015-04-18 10:32 [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module crazylinuxcnc
@ 2015-04-20 8:28 ` Helder Daniel
2015-04-20 11:23 ` Ruika You
0 siblings, 1 reply; 6+ messages in thread
From: Helder Daniel @ 2015-04-20 8:28 UTC (permalink / raw)
To: crazylinuxcnc; +Cc: Xenomai@xenomai.org
Maybe in the makefile you do not included the right path for headers.
A generic makefile for simple kernel modules (2.6.x and 3.x), which gets
correct path from Xenoma, using xeno-config, is:
obj-m := kernel-task.o
$(eval EXTRA_CFLAGS := $(shell xeno-config --kcflags))
#or
#$(eval ccflags-y = $(shell xeno-config --kcflags))
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
rm *~
Note: Is is assumed that Xenomai binary path, which is where xeno-config is
stored, is in the search PATH.
The default path should be:
/usr/xenomai/bin
On 18 April 2015 at 11:32, crazylinuxcnc@gmail.com <crazylinuxcnc@gmail.com>
wrote:
>
>
> ----- Reply message -----
> From: "Helder Daniel" <hdaniel@ualg.pt>
> To: "Ruika You" <crazylinuxcnc@gmail.com>
> Cc: "Xenomai@xenomai.org" <xenomai@xenomai.org>
> Subject: [Xenomai] Error: could not insert module kernel-task.ko: Unknown
> symbol in module
> Date: Sat, Apr 18, 2015 5:35 PM
>
> Hi,
>
> Are you using Xenomai version 3.x or 2.6.x?
>
> My xenomai version is 2.6.4
>
> In version 3.x the native API is no longer exported to kernel, only the
> RTDM API.
>
> //NOT EXPORTED in 3.x: #include <native/task.h>
>
> Helder
>
>
>
> On 18 April 2015 at 03:52, Ruika You <crazylinuxcnc@gmail.com> wrote:
>
>> Dear all,
>>
>> I just start to explore xenomai with compile a kernel module as simple as
>> "hello world". After compile successful, sudo insmod kernel-task.ko,
>> failed, error message as follow:
>> Error: could not insert module kernel-task.ko: Unknown symbol in module
>>
>> Dmesg result as belllow:
>> [52170.262642] kernel_task: Unknown symbol rt_task_create (err 0)
>> [52170.262688] kernel_task: Unknown symbol rt_task_start (err 0)
>> [52170.262722] kernel_task: Unknown symbol rt_task_delete (err 0)
>>
>> Source code:
>> #include <native/task.h>
>> #define TASK_PRIO 99 /* Highest RT priority */
>> #define TASK_MODE T_FPU|T_CPU(0) /* Uses FPU, bound to CPU #0 */
>> #define TASK_STKSZ 4096 /* Stack size (in bytes) */
>> RT_TASK task_desc;
>> void task_body (void *cookie)
>> {
>> for (;;) {
>> /* ... "cookie" should be NULL ... */
>> }
>> }
>> int init_module (void)
>> {
>> int err;
>> /* ... */
>> err =
>> rt_task_create(&task_desc,"MyTaskName",TASK_STKSZ,TASK_PRIO,TASK_MODE);
>> if (!err)
>> rt_task_start(&task_desc,&task_body,NULL);
>> return 1;
>> /* ... */
>> }
>> void cleanup_module (void)
>> {
>> rt_task_delete(&task_desc);
>> }
>>
>> As I analyzed the reason might be :
>>
>> 1. kernel build configure problem ?
>> 2. xenomai userland configure problem?
>> 3. any xenomai module not loaded? native?
>> 4. have to export all these unknow symbol to kernel?
>>
>> Please advise!
>> Thank you very much!
>> -chengxi
>> _______________________________________________
>> Xenomai mailing list
>> Xenomai@xenomai.org
>> http://www.xenomai.org/mailman/listinfo/xenomai
>>
>
>
>
> --
> Helder Daniel
> UALG - FCT
> DEEI
>
> http://w3.ualg.pt/~hdaniel
>
--
Helder Daniel
UALG - FCT
DEEI
http://w3.ualg.pt/~hdaniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
2015-04-20 8:28 ` Helder Daniel
@ 2015-04-20 11:23 ` Ruika You
2015-04-20 12:20 ` Helder Daniel
0 siblings, 1 reply; 6+ messages in thread
From: Ruika You @ 2015-04-20 11:23 UTC (permalink / raw)
To: Helder Daniel; +Cc: Xenomai@xenomai.org
Dear Helder Daniel,
Thanks for your guide, I solve this issue.
MODULES =hello
PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
KSRC ?= /lib/modules/$(shell uname -r)/build
obj-m += ${patsubst %, %.o, $(MODULES)}
#comment this line change to your proposal
#EXTRA_CFLAGS = -I$(KSRC)/include/xenomai -D_GNU_SOURCE -D_REENTRANT
-D__XENO__
EXTRA_CFLAGS:=$(shell /usr/xenomai/bin/xeno-config --skin native --cflags)
all:
make -C $(KSRC) M=$(PWD) modules
clean::
$(RM) $(CLEANMOD) *.o *.ko *.mod.c Module*.symvers Module.markers
modules.order
$(RM) -R .tmp*
make -C /lib/modules/3.14.0/build M=/home/edm/test/hello modules
make[1]: Entering directory `/home/edm/linuxcnc/linux-kernel'
CC [M] /home/edm/test/hello/hello.o
In file included from /home/edm/test/hello/hello.c:4:0:
/usr/xenomai/include/native/task.h: In function ‘rt_task_spawn’:
/usr/xenomai/include/native/task.h:319:5: warning: ‘rt_task_create’ is
deprecated (declared at /usr/xenomai/include/native/task.h:252)
[-Wdeprecated-declarations]
/home/edm/test/hello/hello.c: In function ‘init_module’:
/home/edm/test/hello/hello.c:24:1: warning: ‘rt_task_create’ is deprecated
(declared at /usr/xenomai/include/native/task.h:252)
[-Wdeprecated-declarations]
Building modules, stage 2.
MODPOST 1 modules
CC /home/edm/test/hello/hello.mod.o
LD [M] /home/edm/test/hello/hello.ko
make[1]: Leaving directory `/home/edm/linuxcnc/linux-kernel'
By the way, I am wondering are there warning OK?
-chengxi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
2015-04-20 11:23 ` Ruika You
@ 2015-04-20 12:20 ` Helder Daniel
0 siblings, 0 replies; 6+ messages in thread
From: Helder Daniel @ 2015-04-20 12:20 UTC (permalink / raw)
To: Ruika You; +Cc: Xenomai@xenomai.org
Hi,
The warnings about ‘rt_task_spawn’, ‘rt_task_create’, etc., ... is
deprecated
are giving you an hint that the native API will not be supported in version
3.x.
You can change this function rt_xxxxxx to similar functions from the RTDM
API (rtdm_xxxx) which is supported in version 2.6.x and 3.x.
Below is an example of a simple RTDM module for Xenomai 2.5.x and 2.6.x.
For Xenomai 3.x is a liittle different the location of the headers for
RTDM, and also we must take care to terminate a thread that is killed with
rtdm_task_destroy(). I also included the Xenomai 3.x example if you are
willing to take a look.
regards,
Helder
===============
Xeno 2.6.x version
===============
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <rtdm_driver.h> //RTDM support includes also: <rtdm.h>
#define TASK_PRIO 10 // 99 is Highest RT priority
#define TASK_MODE 0 // No flags
#define TASK_STKSZ 0 // default Stack size
#define TASK_PERIOD 500000000ll // in nano seconds = 500 ms
static rtdm_task_t td; //RTDM Real time task pointer
void periodic (void *arg) {
for (;;) {
rtdm_task_wait_period(); //deschedule until next period
printk(KERN_ALERT "Hi there!");
}
}
int init_module(void) {
return rtdm_task_init (&td, "periodic", &periodic, NULL, TASK_PRIO,
TASK_PERIOD);
}
void cleanup_module(void) {
rtdm_task_destroy(&td);
}
MODULE_LICENSE("GPL"); //To access Xenoma symbols
===============
Xeno 3.x version
===============
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <rtdm/driver.h> //defines: rtdm_task_t, rtdm_sem_t, ... (also
includes rtdm.h)
#define TASK_PRIO 10 // 99 is Highest RT priority
#define TASK_MODE 0 // No flags
#define TASK_STKSZ 0 // default Stack size
#define TASK_PERIOD 500000000ll // in nano seconds = 500 ms
static rtdm_task_t td; //RTDM Real time task pointer
void periodic (void *arg) {
for (;;) {
if (rtdm_task_should_stop()) //to avoid kernel crash when rmmod and
break; //rtdm_task_destroy is called, this
//function should exit
rtdm_task_wait_period(); //deschedule until next period
printk(KERN_ALERT "Hi there!");
}
}
int init_module(void) {
return rtdm_task_init (&td, "periodic", &periodic, NULL, TASK_PRIO,
TASK_PERIOD);
}
void cleanup_module(void) {
rtdm_task_destroy(&td);
}
MODULE_LICENSE("GPL"); //To access Xenoma symbols
On 20 April 2015 at 12:23, Ruika You <crazylinuxcnc@gmail.com> wrote:
> Dear Helder Daniel,
>
> Thanks for your guide, I solve this issue.
>
> MODULES =hello
> PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd;
> fi)
> KSRC ?= /lib/modules/$(shell uname -r)/build
> obj-m += ${patsubst %, %.o, $(MODULES)}
>
> #comment this line change to your proposal
> #EXTRA_CFLAGS = -I$(KSRC)/include/xenomai -D_GNU_SOURCE -D_REENTRANT
> -D__XENO__
>
> EXTRA_CFLAGS:=$(shell /usr/xenomai/bin/xeno-config --skin native --cflags)
> all:
> make -C $(KSRC) M=$(PWD) modules
> clean::
> $(RM) $(CLEANMOD) *.o *.ko *.mod.c Module*.symvers Module.markers
> modules.order
> $(RM) -R .tmp*
>
> make -C /lib/modules/3.14.0/build M=/home/edm/test/hello modules
> make[1]: Entering directory `/home/edm/linuxcnc/linux-kernel'
> CC [M] /home/edm/test/hello/hello.o
> In file included from /home/edm/test/hello/hello.c:4:0:
> /usr/xenomai/include/native/task.h: In function ‘rt_task_spawn’:
> /usr/xenomai/include/native/task.h:319:5: warning: ‘rt_task_create’ is
> deprecated (declared at /usr/xenomai/include/native/task.h:252)
> [-Wdeprecated-declarations]
> /home/edm/test/hello/hello.c: In function ‘init_module’:
> /home/edm/test/hello/hello.c:24:1: warning: ‘rt_task_create’ is deprecated
> (declared at /usr/xenomai/include/native/task.h:252)
> [-Wdeprecated-declarations]
> Building modules, stage 2.
> MODPOST 1 modules
> CC /home/edm/test/hello/hello.mod.o
> LD [M] /home/edm/test/hello/hello.ko
> make[1]: Leaving directory `/home/edm/linuxcnc/linux-kernel'
>
> By the way, I am wondering are there warning OK?
>
> -chengxi
>
>
--
Helder Daniel
UALG - FCT
DEEI
http://w3.ualg.pt/~hdaniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
@ 2015-04-18 2:52 Ruika You
2015-04-18 9:35 ` Helder Daniel
0 siblings, 1 reply; 6+ messages in thread
From: Ruika You @ 2015-04-18 2:52 UTC (permalink / raw)
To: xenomai
Dear all,
I just start to explore xenomai with compile a kernel module as simple as
"hello world". After compile successful, sudo insmod kernel-task.ko,
failed, error message as follow:
Error: could not insert module kernel-task.ko: Unknown symbol in module
Dmesg result as belllow:
[52170.262642] kernel_task: Unknown symbol rt_task_create (err 0)
[52170.262688] kernel_task: Unknown symbol rt_task_start (err 0)
[52170.262722] kernel_task: Unknown symbol rt_task_delete (err 0)
Source code:
#include <native/task.h>
#define TASK_PRIO 99 /* Highest RT priority */
#define TASK_MODE T_FPU|T_CPU(0) /* Uses FPU, bound to CPU #0 */
#define TASK_STKSZ 4096 /* Stack size (in bytes) */
RT_TASK task_desc;
void task_body (void *cookie)
{
for (;;) {
/* ... "cookie" should be NULL ... */
}
}
int init_module (void)
{
int err;
/* ... */
err =
rt_task_create(&task_desc,"MyTaskName",TASK_STKSZ,TASK_PRIO,TASK_MODE);
if (!err)
rt_task_start(&task_desc,&task_body,NULL);
return 1;
/* ... */
}
void cleanup_module (void)
{
rt_task_delete(&task_desc);
}
As I analyzed the reason might be :
1. kernel build configure problem ?
2. xenomai userland configure problem?
3. any xenomai module not loaded? native?
4. have to export all these unknow symbol to kernel?
Please advise!
Thank you very much!
-chengxi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
2015-04-18 2:52 Ruika You
@ 2015-04-18 9:35 ` Helder Daniel
0 siblings, 0 replies; 6+ messages in thread
From: Helder Daniel @ 2015-04-18 9:35 UTC (permalink / raw)
To: Ruika You; +Cc: Xenomai@xenomai.org
Hi,
Are you using Xenomai version 3.x or 2.6.x?
In version 3.x the native API is no longer exported to kernel, only the
RTDM API.
//NOT EXPORTED in 3.x: #include <native/task.h>
Helder
On 18 April 2015 at 03:52, Ruika You <crazylinuxcnc@gmail.com> wrote:
> Dear all,
>
> I just start to explore xenomai with compile a kernel module as simple as
> "hello world". After compile successful, sudo insmod kernel-task.ko,
> failed, error message as follow:
> Error: could not insert module kernel-task.ko: Unknown symbol in module
>
> Dmesg result as belllow:
> [52170.262642] kernel_task: Unknown symbol rt_task_create (err 0)
> [52170.262688] kernel_task: Unknown symbol rt_task_start (err 0)
> [52170.262722] kernel_task: Unknown symbol rt_task_delete (err 0)
>
> Source code:
> #include <native/task.h>
> #define TASK_PRIO 99 /* Highest RT priority */
> #define TASK_MODE T_FPU|T_CPU(0) /* Uses FPU, bound to CPU #0 */
> #define TASK_STKSZ 4096 /* Stack size (in bytes) */
> RT_TASK task_desc;
> void task_body (void *cookie)
> {
> for (;;) {
> /* ... "cookie" should be NULL ... */
> }
> }
> int init_module (void)
> {
> int err;
> /* ... */
> err =
> rt_task_create(&task_desc,"MyTaskName",TASK_STKSZ,TASK_PRIO,TASK_MODE);
> if (!err)
> rt_task_start(&task_desc,&task_body,NULL);
> return 1;
> /* ... */
> }
> void cleanup_module (void)
> {
> rt_task_delete(&task_desc);
> }
>
> As I analyzed the reason might be :
>
> 1. kernel build configure problem ?
> 2. xenomai userland configure problem?
> 3. any xenomai module not loaded? native?
> 4. have to export all these unknow symbol to kernel?
>
> Please advise!
> Thank you very much!
> -chengxi
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> http://www.xenomai.org/mailman/listinfo/xenomai
>
--
Helder Daniel
UALG - FCT
DEEI
http://w3.ualg.pt/~hdaniel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-20 12:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-18 10:32 [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module crazylinuxcnc
2015-04-20 8:28 ` Helder Daniel
2015-04-20 11:23 ` Ruika You
2015-04-20 12:20 ` Helder Daniel
-- strict thread matches above, loose matches on Subject: below --
2015-04-18 2:52 Ruika You
2015-04-18 9:35 ` Helder Daniel
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.