Re: how to know what files build in one module?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> But how does the kernle finally know what is the name of module and
> The module name comes IMO from the final object-name.ko.

More precisely the module name is specified in the Makefile.

For example for the ext2 kernel module, the "ext2-y" and "ext2.o"
entries in the Makefile tells the kernel build system that the
module's name is ext2.
>From fs/ext2/Makefile:
obj-$(CONFIG_EXT2_FS) += ext2.o
ext2-y := balloc.o dir.o file.o fsync.o ialloc.o inode.o \
          ioctl.o namei.o super.o symlink.o dedup.o hash.o
--
Based on this, if ext2 is configure with 'm' (to be a kernel module),
the kernel build system creates a ext2.mod.c file which looks like
this:

struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
 .name = KBUILD_MODNAME,
 .init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
 .exit = cleanup_module,
#endif
 .arch = MODULE_ARCH_INIT,
};
--
KBUILD_MODNAME holds the name of the kernel module which is defined by
the kernel build system.
This structure is embedded into the finally linked kernel module
object and is available to the kernel.

Hope this provides a bit more details to your question - how does the
kernel know the "name" of a module.

Thanks,
-Joel

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux