'sudo rmmod ov9281.ko' gives 'rmmod: ERROR: Module ov9281 is builtin.'

Hi,
I had compiled the kernel with CONFIG_VIDEO_OV9281=m to build ov9281 driver as loadable kernel module. I had been able to insert the driver with ‘sudo insmod ov9281.ko’. Later on, I want to unload but it gives me this error

rmmod: ERROR: Module ov9281 is builtin.

Anybody here knows why? Every help would be much appreciated
Thanks
th

hello thanhhc91,

please check [Sensor Software Driver Programming Guide] for reference,
here’s Loadable Kernel Module (LKM) session to describe the process to configure a sensor driver as a loadable module.
thanks

Hi JerryChang,

Yes, I did follow exactly the guide and was able to load the .ko driver after compilation. I then changed the module code and recompiled *.ko file again. before insert this new .ko, I have to remove the running one with ‘rmmod’ command but got the error.

Thanh

If the kernel Image file has the driver already, then loading and unloading a module will always fail. You would have to recompile the kernel Image itself to not integrate the option before module commands would work. Keep in mind that not all features can be built as a module (don’t know about your case).

If you want to see what your kernel Image was compiled with, then see:
zcat /proc/config.gz | grep 'CONFIG_VIDEO_OV9281'

If this shows as “=y”, then your version of the driver will never load and never be unloaded.