- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can also make a symlink to busybox so you can symply use rmmod:
# cd /bin# ln -sf busybox rmmod- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page