linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cristina Moraru <cristina.moraru09@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: mcgrof@kernel.org, teg@jklm.no, kay@vrfy.org,
	rusty@rustcorp.com.au, akpm@linux-foundation.org,
	Cristina Moraru <cristina.moraru09@gmail.com>
Subject: [RFC PATCH 2/3] Add generation of Module.ksymb file in streamline_config.pl
Date: Sun, 31 Jul 2016 17:33:51 +0200	[thread overview]
Message-ID: <1469979232-15531-3-git-send-email-cristina.moraru09@gmail.com> (raw)
In-Reply-To: <1469979232-15531-1-git-send-email-cristina.moraru09@gmail.com>

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.moraru09@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

  parent reply	other threads:[~2016-07-31 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-31 15:33 [RFC PATCH 0/3] Add kconfig symbol as module attribute Cristina Moraru
2016-07-31 15:33 ` [RFC PATCH 1/3] Add kconfig_symbol attribute to struct module Cristina Moraru
2016-07-31 15:33 ` Cristina Moraru [this message]
2016-08-08 19:15   ` [RFC PATCH 2/3] Add generation of Module.ksymb file in streamline_config.pl Luis R. Rodriguez
2016-08-08 20:32     ` Julia Lawall
2016-08-08 21:54       ` Luis R. Rodriguez
2016-08-09  6:54     ` Geert Uytterhoeven
2016-07-31 15:33 ` [RFC PATCH 3/3] Add dynamic pegging of Kconfig symbol Cristina Moraru
2016-08-08 20:05   ` Luis R. Rodriguez
2016-08-08 17:25 ` [RFC PATCH 0/3] Add kconfig symbol as module attribute Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469979232-15531-3-git-send-email-cristina.moraru09@gmail.com \
    --to=cristina.moraru09@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=teg@jklm.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).