[lkml]   [2016]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[RFC PATCH 0/5] Add CONFIG symbol as module attribute
This patchset implements dynamic pegging of kconfig symbol
into driver modinfo section

* updates to generate the auxiliary file
scripts/mod/Module.ksymb containing associations of driver file
names and corresponding kconfig symbols CONFIG_*
* updates Makefiles to trigger call for
Module.ksymb generation and pass the determined CONFIG_* symbol
as compilation parameter -D in KBUILD_KSYMB variable
* adds kconfig_symb as module attribute
* updates modpost to set KBUILD_KSYMB macro as value for
kbuild_symb attribute

Note: the content of the file Module.ksymb is generated for
all modules that have only one associate CONFIG option. All
others are considered to be components linked at the final
modules but not final modules itselves.

The result of this patchset is the following. All modules from
/sys expose the correct CONFIG_* symbol in the module attribute
kconfig_symb with some exceptions. For a total number of 58
modules, 4 of them do not:


After a short research:

For mptscsih - ./drivers/message/fusion/Makefile
obj-$(CONFIG_FUSION_SPI) += mptbase.o mptscsih.o mptspi.o
obj-$(CONFIG_FUSION_FC) += mptbase.o mptscsih.o mptfc.o
obj-$(CONFIG_FUSION_SAS) += mptbase.o mptscsih.o mptsas.o
As appears in the Makefile mptscsi is part of more config
options so it's excluded because it's not considered a module
by itself but, somehow gets compiled as module. Same for the
mptbase. I still have to understand better the Kbuild logic so
I cannot state that this is loose practice.

For libahci there are multiple CONFIG_ symbols for different

Although past discussion recommended not to use streamline_config,
this patchset still relies on it, for the sake of the proof of
concept. Although the result is close to the target it still does
not provide complete correctness. However it can be replaced by
creating another script which tries to determine better the
module <-> CONFIG associations and output them in auxiliary file
Module.ksymb. Maybe this way we could also determine all CONFIGs
for a particular driver, not only the exact one that enables it.

The auxiliary file is necessary because the Makefile itself does
not have a mapping. The makefile includes the config file with
directive include which creates a series of internal variables
CONFIG_FOO=y/m/n. Afterwards, when recursively descending into
other Makefiles, lines like

obj-$(CONFIG_FOO) = foo.o

are resolved in place to obj-y, obj-m etc according to 'make'
logic and the association is lost.

Finally, what does this patchset provide is an infrastructure
to dinamically peg CONFIG_* options to associate drivers using
the mapping from Module.ksymb file. Generation of Module.ksymb
can be replaced but keeping the same format permit the usage of
the other patches.

This patchset is part of a research project within
Google Summer of Code of porting 'make localmodconfig'
for backported drivers. The goal is to enable each
module to expose in /sys its corresponding CONFIG_* option.
The value of this attribute will be dynamically pegged by
modpost without requiring extra work from the driver developers.
Further, this information will be used by a hardware interogation
tool to extract build information about the existing devices.

Cristina Moraru (5):
Add generation of Module.symb in streamline_config
Add CONFIG symbol to module as compilation parameter
Trigger Module.ksymb generation in Makefile
Set KCONFIG_KSYMB as value for kconfig_ksymb module attribute
Add kconf_symb as kernel module attribute

Makefile | 4 ++++
include/linux/module.h | 1 +
kernel/module.c | 2 ++
scripts/Makefile.lib | 9 ++++++++-
scripts/kconfig/ | 30 +++++++++++++++++++++++++++++-
scripts/mod/modpost.c | 7 +++++++
6 files changed, 51 insertions(+), 2 deletions(-)


 \ /
  Last update: 2016-09-17 09:57    [W:0.164 / U:2.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site