Add generation of ./scripts/mod/Module.ksymb file containing associations of driver file names and corresponding CONFIG_* symbol.
This file will be used by modpost to peg kconfig CONFIG_* symbol to its corresponding module. This information will be further exposed in userspace for extracting build options for the required modules. This approach faces the following limitations: * in some cases there are more than one CONFIG_* option for certain objects. This happens for the objects that are part of more CONFIGs. Thus, all configs are returned for this object names. For example, the mapping for clk_div6 is CONFIG_ARCH_R8A73A4, CONFIG_ARCH_R8A7793 and many others. * in some cases the driver file name does not match the registered name for the module. For example: Driver filename Module name ----------------------------------- lineage-pem[.o] lineage_pem phy-ab8500-usb[.o] abx5x0-usb ehci-mxc[.o] mxc-ehci etc. There is no naming rule / standard between the driver name and the registered module name. This patch is part of a research project within Google Summer of Code of porting 'make localmodconfig' for backported drivers. Signed-off-by: Cristina Moraru <cristina.morar...@gmail.com> --- scripts/kconfig/streamline_config.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index b8c7b29..4833ede 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -147,6 +147,7 @@ my %objects; my $var; my $iflevel = 0; my @ifdeps; +my @drv_objs; # prevent recursion my %read_kconfigs; @@ -341,6 +342,10 @@ foreach my $makefile (@makefiles) { # The objects have a hash mapping to a reference # of an array of configs. $objects{$1} = \@arr; + # Save objects corresponding to driver Makefiles + if (index($makefile, "./drivers/") == 0) { + push(@drv_objs, substr($obj, 0, -2)); + } } } } @@ -348,6 +353,21 @@ foreach my $makefile (@makefiles) { close($infile); } +sub gen_module_kconfigs { + + my $module_ksymb = $ENV{'objtree'}."/scripts/mod/Module.ksymb"; + my $key; + + open(my $ksymbfile, '>', $module_ksymb) || die "Can not open $module_ksymb for writing"; + + foreach (@drv_objs) { + print $ksymbfile "$_ " . "@{$objects{$_}}\n"; + } + close $ksymbfile; +} + +gen_module_kconfigs(); + my %modules; my $linfile; -- 2.7.4