Linux: re-loading kernel modules -
i'm doing development on gpu kernel module. gets compiled on 'make modules' , not on 'make', can dynamically loaded module loads on linux boot. rapidly recompile , reinstall module without installing whole new kernel. ok 'make modules' , replace existing .ko file in /lib/modules/... , reboot? if not (perhaps in use) can boot different kernel, replacement, , reboot in? possible insmod it?
it gets compiled on 'make modules' , not on 'make', can dynamically loaded module loads on linux boot.
you should check module placed. can stored in /lib/modules/...kernel-version../, or in /lib/modules , inside initramfs (initrd). in second case need regenerate initramfs image after updating ko in /lib/modules.
i rapidly recompile , reinstall module without installing whole new kernel. ok 'make modules' , replace existing .ko file in /lib/modules/... , reboot?
yes, allowed change .ko file, when module loaded. (loading of module init_module
done in-memory copy of .ko elf file, used version of module still use old data).
on reboot have modules , files unused too.
is possible insmod it?
it not allowed insmod
of module loaded (compared name - check eexist error in man finit_module
). may try load different name, older module has ownership of hardware , newer module have no access pci/pcie device.
so, should unload older module rmmod modulename
before inserting newer version. unloading possible unused modules (man delete_module
, check usage counter in lsmod
output) - there should no other modules depending on your, no processes should use it. after unloading can insmod modulename.ko
or modprobe modulename.ko
.
reboot unload older module , load newer module.
in case of gpu driver should stop x.org server , stop system console uses graphics (so, can't switch text console , reload gpu module interactively; can done remotely ssh or shell script unbind/unload/load), check question https://askubuntu.com/questions/418296/fastest-way-to-reload-graphics-driver-module
sudo /etc/init.d/lightdm stop echo 0 > /sys/class/vtconsole/vtcon1/bind
Comments
Post a Comment