Forum Discussion
Altera_Forum
Honored Contributor
20 years agobusybox rmmod doesn't work?
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.
6 Replies
- Altera_Forum
Honored Contributor
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't enabled by default. you will have to enable this function in your kernel configuration, rebuild your kernel and upload it. - Altera_Forum
Honored Contributor
Hi
The function to use is # busybox rmmod hello Thus, without the extention .ko. And Yea, the function isn't enabled in the kernel by default. Good advice Helmchen Rual - Altera_Forum
Honored Contributor
You can also make a symlink to busybox so you can symply use rmmod:
# cd /bin# ln -sf busybox rmmod - Altera_Forum
Honored Contributor
Hi!
Ok, I enabled unloading moduls in kernel configuration. But the following happens: # busybox rmmod hellormmod: hello: device or resource busy I can't imagine what could be the reason for this simple module beeing busy? Bye, Lothar.
- Altera_Forum
Honored Contributor
Lothar,
I'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'm asking more than I'm suggesting. Doug - Altera_Forum
Honored Contributor
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.