Dahui
Dahui

Reputation: 146

Is there any module dependency definition for linux kernel module in source code level?

I know that we can check the Linux kernel module dependency at runtime with the lsmod or modprobe command. But what if we only have the kernel code, is there a way to check the kernel module's dependency, or is there any dependency definition in the kernel source code?

Thanks in advance.

Upvotes: 0

Views: 1324

Answers (1)

Parthiban
Parthiban

Reputation: 2330

You can check the Kconfig entry for the driver. Dependency to external modules, subsystem is specified as

You can find more details in Documentation/kbuild/kconfig-language.txt

For example, if CONFIG_MY_DRIVER depends on I2C, you can specify this as depends on in Kconfig. This means, if I2C is not selected in menuconfig, MY_DRIVER will not show up in menuconfig entry.

Opposite to which, when you use select, I2C is automatically selected when selecting MY_DRIVER.

Upvotes: 3

Related Questions