init function invocation of drivers compiled into kernel

In Linux if device drivers are built as loadable kernel modules, then upon inserting the device driver kernel module, the kernel calls the init function of the device driver as pointed out by module_init() macro.

How does this work for device drivers that are statically compiled into the kernel ? How is their init function called ?

How do I generate loadable modules during Linux kernel build?

I seem to successfully build a kernel image, but I can not generate all the modules I expect. I expect more modules since I see them enabled in the gconfig window. Here is a copy of my make session. Seems like make goes into the devices directories. I can not figure out why it is not create the .ko files. I expect to see .ko files. I have checked the Makefile in /drivers directory, and I can see that it is configured with a number of lines like

obj-$(CONFIG_PCI)               += pci/

Which directs make to build the pci module for instance. I think this implies that I should see a number .ko files. But I do not. I have seen just one .ko file for scsi module. I like to be able to build all of modules selected.

I also verified that a number of mudules are enabled when I issued:

make VARIANT_DEFCONFIG=msm8974_sec_hlte_spr_defconfig msm8974_sec_defconfig SELINUX_DEFCONFIG=selinux_defconfig gconfig

But as I said, I do not see any of them. What am I missing please?

@Subin – Thanks. I just tried make modules_install. I have to mention that I am cross compiling this for an arm target. I believe modules_install is for the purpose of installing the driver for the machine you are on? I got a message about needing to be in root, and I did not proceed. I have been wondering when I need to run it. What does it do exactly please?

Re: the make modules; I have run it before. I’ll run it again and post the result. Since I got one .ko file I figured the issue is something different between that one module, and every other one enabled in my config. Here is what I got when I ran make modules:

sansari@ubuntu:~/WORKING_DIRECTORY$ make modules
CHK     include/linux/version.h
CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL    scripts/
Building modules, stage 2.
MODPOST 1 modules

Re: your comment on the location of .ko files, I am doing a find to see if perhaps I am not looking at the right place, it only finds the one which was built. Not the other ones. Here is the output:

sansari@ubuntu:~/WORKING_DIRECTORY$ find . -type f -name "*.ko"

Should I perhaps run make v=1, in verbose mode that is? Would that provide more information on why the other modules are not built?

@Gil Hamilton – Thanks. You are right. Here is an excerpt of the .config file:

# SCSI support type (disk, tape, CD-ROM)
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set

This entry is the only one set to ‘m’.