Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

busybox rmmod doesn't work?

Altera_Forum
Honored Contributor II
2,342 Views

Hi! 

 

I have a module with following source code: 

#include <linux/kernel.h># include <linux/init.h># include <linux/module.h> int __init hello_init(void) {     printk("----------->Hello, world\n");     return 0; } static void __exit hello_exit(void) {     printk("------------>Goodbye, cruel world\n"); } module_init(hello_init); module_exit(hello_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("testing module"); MODULE_AUTHOR("LS"); 

 

When I use the insmod command it works fine 

hello.ko# busybox insmod hello.ko 

----------->hello, world#  

 

But when I use the rmmod command something going wrong: 

# busybox rmmod hello.ko 

rmmod: hello.ko: function not implemented#  

 

What could be the reason? 

 

 

Bye, Lothar.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,273 Views

a) Make sure, that you have the function rmmod. 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif Make sure you have enabled Module unloading in your kernel. This feature isn&#39;t enabled by default. you will have to enable this function in your kernel configuration, rebuild your kernel and upload it.
0 Kudos
Altera_Forum
Honored Contributor II
1,273 Views

Hi 

 

The function to use is # busybox rmmod hello 

 

Thus, without the extention .ko. And Yea, the function isn&#39;t enabled in the kernel by default. Good advice Helmchen 

 

Rual
0 Kudos
Altera_Forum
Honored Contributor II
1,273 Views

You can also make a symlink to busybox so you can symply use rmmod: 

# cd /bin# ln -sf busybox rmmod
0 Kudos
Altera_Forum
Honored Contributor II
1,273 Views

Hi! 

 

Ok, I enabled unloading moduls in kernel configuration. 

But the following happens: 

# busybox rmmod hello 

rmmod: hello: device or resource busy 

 

I can&#39;t imagine what could be the reason for this simple module beeing busy? 

 

 

 

Bye, Lothar.
0 Kudos
Altera_Forum
Honored Contributor II
1,273 Views

Lothar, 

I&#39;m asking more than directing. Your init function is not static. Does the kernel lose reference to this module since it is not declaired as static function? Your error says device or resource busy, perhaps the kernel is unsure if the device is in use because it has lost reference to this modue????? 

 

Again, I&#39;m asking more than I&#39;m suggesting. 

 

Doug
0 Kudos
Altera_Forum
Honored Contributor II
1,273 Views

Hi Doug! 

 

You are right. 

With a static declaration of the init function command rmmod works:-) 

# busybox rmmod hello 

------------>goodbye, cruel world#  

 

Thank you, Lothar.
0 Kudos
Reply