Re: static compilation or as a module

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

 



On 2/21/06, Rajaram Suryanarayanan <rajaram_linux@xxxxxxxxx> wrote:

> Thanks for your reply.
>  But I am not able to understand your reply. Could you please be more clear

Let me take a different route in explaining this to you:

Many "kernel subcomponents" that you find when you do a 'make
xconfig', are not separate pieces of code. For example: In
kernel/sched.c we see CONFIG_SMP scattered all over the place, and in
the definition of the runqueue struct we see this:
#ifdef CONFIG_SMP
        unsigned long cpu_load[3];
#endif

So the symbol CONFIG_SMP is either defined or it isn't defined
(CONFIG_SMP=y or CONFIG_SMP=n in your .config; the file that make
xconfig generates). You cannot compile CONFIG_SMP as a module. It just
doesn't make any sense.

Nearly all drivers can be compiled as modules, because the core kernel
code at link time, does not depend on symbols defined in modules.
Moreover, modules can export symbols.

For e.g.: Under the "Generic Driver Options" in the .config, we see
CONFIG_FW_LOADER=m. The code that uses the symbol checks if the symbol
has been compiled as a module or not.

In sound/pci/rme9652/hdsp.c; we see;

/* use hotplug firmeare loader? */
#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)

Now, you may ask, how does 'make xconfig' know, if a feature can take
a YES or a NO or can take a YES/NO/MODULE. The answer to that lies in
the Kconfig file which can be found in the source sub directories off
root.

For e.g.: Look at fs/Kconfig, we see

config EXT2_FS
        tristate "Second extended fs support"

tristate says EXT2_FS can take Y/N/M, etc. etc.

Then we see this,
config EXT2_FS_XATTR
        bool "Ext2 extended attributes"
        depends on EXT2_FS

bool sys EXT2_FS_XATTR can take Y/N only and it can only be chosen if
EXT2_FS has been chosen.

Hope this clears most of your doubts,

./hareesh

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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