That is, can a driver try to import a symbol for another driver, and if the symbol doesn’t exist can the driver continue to load without resolving the import? And even if possible is it even allowed for an upstream driver ? i.e a driver already out there in the lnux kernel?
A user can link a module into the running kernel by executing the insmod external program. This program performs the following operations: Reads from the command line the name of the module to be linked. Locates the file containing the module's object code in the system directory tree.
Static modules are those which are compiled as part of the base kernel and it is available at any time. Dynamic Modules are compiled as modules separately and loaded based on user demand. These are also called as Loadable Kernel Modules(LKM).
To debug the module, you first have to load the module, then tell GDB where the symbol file is, then set any breakpoints you need. So, first things first, load the module. Included in the source code is a simple shell script called loadModule that loads the module and creates the devices if they do not already exist.
They extend the functionality of the kernel without the need to reboot the system. Custom codes can be added to Linux kernels via two methods. The basic way is to add the code to the kernel source tree and recompile the kernel. A more efficient way is to do this is by adding code to the kernel while it is running.
symbols exported by EXPORT_SYMBOL or EXPORT_SYMBOL_GPL(if the importing module does have GPL-compatible license) in any kernel modules can be used by other modules.
if the symbol doesn’t exist can the driver continue to load without resolving the import?
I am not sure about it. But you can verify if a symbol is exported from the output of cat /proc/kallsyms
. exported symbols will have two entries. One with symbol name and another with _ksymtab prefixed.
For example, for printk.
ffffffff814fd1e2 T printk ffffffff81812550 r __ksymtab_printk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With