1

i'm trying to modify one of the built-in kernel module 'virtio'. I tried to find the module installed at the kernel binaries, but failed. I found virtio is a built-in kernel module, by modprobe virtio

And, i also found non-builtin kernel module can be replaced by modified one after compiling it individually.

but how about built-ins?

when i type cat /lib/modules/$(uname -r)/modules.builtin | grep virtio , it shows like

...

kernel/drivers/virtio/virtio.ko

...

but could not find the actual .ko file in my current OS filesystem.

Back to my question, is there any way to compile only a this built-in module and apply to the revision at the current kernel?

  1. modify virtio.c, compile the whole kernel (make -j8 && make modules && make modules_install && make install )

  2. modify virtio.c, compile only this one (make drivers/virtio/virtio.ko && make modules ... )

  • 1
    "Built-in" means that module becomes part of the kernel. For change the kernel you need to fully rebuild it (from sources). As for paths in `modules.builtin` file, they are fake and exist only for make `modprobe` to auto-succeed when requested to load one of the builtin modules. This is written in the documentation: https://www.kernel.org/doc/Documentation/kbuild/kbuild.txt. – Tsyvarev Dec 08 '20 at 07:53
  • Thanks for comment @Tsyvarev . also i saw [this](https://stackoverflow.com/questions/51369669/replace-kernel-builtin-module-with-a-loadable-one) , and it would be no serious problem for modifying modules.bulitin ? – Seongjoon Park Dec 08 '20 at 08:06
  • Yes, you may modify `modules.builtin`. But what do you want to achive by doing that? This file affects only on `modprobe` utility. If a kernel module is a part of the kernel, you cannot dynamically load replacement for this module in any case. – Tsyvarev Dec 08 '20 at 09:29
  • You need to modify .config to make virtio a loadable module, then rebuild the entire kernel. Once that wworks, you can modify the virtio module easily. – stark Dec 08 '20 at 14:42

0 Answers0