All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helder Daniel <hdaniel@ualg.pt>
To: Ruika You <crazylinuxcnc@gmail.com>
Cc: "Xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Error: could not insert module kernel-task.ko: Unknown symbol in module
Date: Mon, 20 Apr 2015 13:20:19 +0100	[thread overview]
Message-ID: <CAKk99t0ZbCUYJp-V1HEczY5T+ddeLXrfm3-_5SjofKf2gcM-5g@mail.gmail.com> (raw)
In-Reply-To: <CABqyFP-2R-r_OWHs7zgLLKEUjBfL1amuOteAEKNKBVye-E6Xmg@mail.gmail.com>

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

  reply	other threads:[~2015-04-20 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-04-18  2:52 Ruika You
2015-04-18  9:35 ` Helder Daniel

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=CAKk99t0ZbCUYJp-V1HEczY5T+ddeLXrfm3-_5SjofKf2gcM-5g@mail.gmail.com \
    --to=hdaniel@ualg.pt \
    --cc=crazylinuxcnc@gmail.com \
    --cc=xenomai@xenomai.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.