How linux device drivers are loaded? -
can explain me in simple terms following thing. how linux drivers loaded kernel space? functions exported, after drivers being loaded? how driver functions called?
normally use insmod
or modprobe
userspace application load module (and possibly dependencies in case of 2nd one). both of them same under hood load single module - read file memory , use init_module
system call, providing address of memory module loaded. call tells kernel module should loaded.
now kernel modules elf files , not different shared libraries used in userspace. kernel has equivalent of shared library linker, parse files, list of symbols provided it, updating list of functions known kernel. check if symbols module needs in kernel , proper relocations. 1 of last thing call initialization function in module.
note cannot compile kernel directly call function provided module. similarly, can call function provided module in module before loading first one. kernel refuse load module symbols not known. of modules will, however, register functions kind of callbacks can called indirectly.
Comments
Post a Comment