[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1471462023-119645-1-git-send-email-cristina.moraru09@gmail.com>
Date: Wed, 17 Aug 2016 21:26:58 +0200
From: Cristina Moraru <cristina.moraru09@...il.com>
To: linux-kernel@...r.kernel.org
Cc: mcgrof@...nel.org, teg@...m.no, kay@...y.org,
rusty@...tcorp.com.au, akpm@...ux-foundation.org,
Cristina Moraru <cristina.moraru09@...il.com>
Subject: [RFC PATCH 0/5] Add CONFIG symbol as module attribute
This patchset implements dynamic pegging of kconfig symbol
into driver modinfo section
* updates streamline_config.pl to generate the auxiliary file
scripts/mod/Module.ksymb containing associations of driver file
names and corresponding kconfig symbols CONFIG_*
* updates Makefiles to trigger streamline_config.pl 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:
snd_seq_midi_event
mptscsih
libahci
mptbase
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
architectures.
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/streamline_config.pl | 30 +++++++++++++++++++++++++++++-
scripts/mod/modpost.c | 7 +++++++
6 files changed, 51 insertions(+), 2 deletions(-)
--
2.7.4
Powered by blists - more mailing lists