开发者

Modifying an existing module in linux kernel

开发者 https://www.devze.com 2023-02-18 20:25 出处:网络
I am using g_file_storage as driver on my embedded linux to pose it as mass storage for any usb host.I have done that well!!

I am using g_file_storage as driver on my embedded linux to pose it as mass storage for any usb host.I have done that well!!

Now I need to do more .... is to capture eject event on usb device ..which is a functionality not given by g_file_storage till now.

I have got this function fsg_suspend() in g_file_storage driver ...Its is the routine that gets called when a Windows USB host does "Safely remove hardware".....

i am thinking of adding a simple printk to send simple message in /var/log/message in fsg_suspend function which i will watch from user space on BeagleBoard.....

but i m into a very basic kernel programming doubt ...if you can help me out ....

i have written simple kernel modules ..which is lets say module.c file an i use simple make command to compile it then modprobe/insmod to insert it and then i use it ...... this is about a module totally written by me.

and

i have also configured a module as option M in config file while recompiling kernel .. then i do make , make modules , make modules_install , make_install then we use modprobe to use that particular feature ..pl Correct me if i am wrong ....

But here this module is a kernel module , if i make a change to it , Then ........

can i just recompile it using its makefile ...and do modprobe ...? but 开发者_高级运维this Makefile doesnt seem to support this idea ..

will it interfere with already present copy of this module in running kernel ? Or will i have to recompile kernel?


I don't understand most of the first half of the query. The question is tagged Linux and kernel, so why is there so much about Windows?

If I understand correctly, you'll have to disable the existing device driver. The most straightforward means is to rebuild the kernel without it. Then use the insmod and rmmod commands to load and unload the new driver.

I can't tell from the details you've provided, but maybe there is a way for the new driver to coexist alongside the old one. If it does not need an IRQ, or it can use a separate one, then you can create new device nodes and use it independently of the existing driver.

0

精彩评论

暂无评论...
验证码 换一张
取 消