How to reload modified kernel modules

apoorv020 picture apoorv020 · Jan 10, 2011 · Viewed 22.2k times · Source

How can I instruct the system to reload all kernel modules that have changed? (I am developing a driver with several modules. I want a quick and error-free method to reload all the modules that change.)

Answer

Aaron Digulla picture Aaron Digulla · Jan 10, 2011

There is no simple, error-free way since a bug in the code that adds/removes the driver from the kernel can make it impossible to get rid of a module. In a similar way, a bug in the driver can cause a deadlock in some interrupt handler so the kernel can never unload the module.

Also, there is no automatic way to do it since the kernel doesn't check the modules files for changes.

All you can do is write a small script that calls rmmod in the correct order to remove the modules and then modprobe's the new versions into the kernel.