Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Regular Visitor
fk5747
Posts: 34
Registered: ‎07-03-2011
0
Accepted Solution

linux driver : problem with rmmod

hi everybody

 

I am getting started with linux driver development and I want to test how to insert a driver into linux kernel. I've built and run the linux kernel on MicroBlaze on my custom spartan3e board and every thing works fine.

my driver is so simple :

 

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

MODULE_LICENSE("BSD/GPL");
static int hello_init(void) {
  printk("KERN_INFO "Hello : init is working good!");
  return 0;
}

static void hello_exit(void) {
  printk("<KERN_INFO "Hello : exit is working good!");
}

module_init(hello_init);
module_exit(hello_exit);

 

after compiling the driver I insert it using insmod and it works fine. but then  I cannot remove it

 

# rmmod hello                                                                   
rmmod: chdir(/lib/modules): No such file or directory 

 

Am I using rmmod correctly?

I would appreciate any suggestions. thanks in advance.

 

Regular Visitor
madhuba
Posts: 40
Registered: ‎07-29-2011
0

Re: linux driver : problem with rmmod

Please do "lsmod" to check if the module was really inserted or not.

 

Regards

Madhubala

Regular Visitor
fk5747
Posts: 34
Registered: ‎07-03-2011
0

Re: linux driver : problem with rmmod

yes, it has inserted correctly! it allocates major and minor numbers too! 

now, what else?

Regular Visitor
madhuba
Posts: 40
Registered: ‎07-29-2011

Re: linux driver : problem with rmmod

Hi ,

 

The solution to this problem is please create the directory /lib/modules and then /lib/modules/2.6.39

rmmod is looking for this and since its not finding its throwing the error.

 

Regards

Madhubala

Regular Visitor
fk5747
Posts: 34
Registered: ‎07-03-2011
0

Re: linux driver : problem with rmmod

thank you

It works :)))