From 296471ad51780996d3b1f2dfb65bc4dbdea69a1e Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Sat, 2 Apr 2016 10:55:21 -0700 Subject: localmodconfig: Fix parsing of Kconfig "source" statements The parameter of Kconfig "source" statements does not need to be quoted. The current regex causes many kconfig files to be skipped and hence, dependencies to be missed. Also fix the whitespace repeat count. Link: http://lkml.kernel.org/r/1459619722-13695-1-git-send-email-bpoirier@suse.com Tested-by: Lee, Chun-Yi Signed-off-by: Benjamin Poirier Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index f3d3fb42b873..7036ae306db6 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -188,7 +188,7 @@ sub read_kconfig { $cont = 0; # collect any Kconfig sources - if (/^source\s*"(.*)"/) { + if (/^source\s+"?([^"]+)/) { my $kconfig = $1; # prevent reading twice. if (!defined($read_kconfigs{$kconfig})) { -- cgit v1.2.3-59-g8ed1b From 27b7156886d875f2f54fab8790144e1fa80b7160 Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Sun, 10 Apr 2016 17:06:30 -0700 Subject: localmodconfig: Recognize more keywords that end a menu entry Based on the list in Documentation/kbuild/kconfig-language.txt This removes junk from %depends because parsing of a menu entry spilled over to another menu entry. Link: http://lkml.kernel.org/r/1460333193-16361-1-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 7036ae306db6..64d750cc5ae4 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -256,8 +256,8 @@ sub read_kconfig { $iflevel-- if ($iflevel); - # stop on "help" - } elsif (/^\s*help\s*$/) { + # stop on "help" and keywords that end a menu entry + } elsif (/^\s*help\s*$/ || /^(comment|choice|menu)\b/) { $state = "NONE"; } } -- cgit v1.2.3-59-g8ed1b From a77ed525d0120e244937eaa74c6086da1dab283a Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Sun, 10 Apr 2016 17:06:31 -0700 Subject: localmodconfig: Fix parsing of "help" text Help text may start with "help" or "---help---". This patch fixes read_kconfig() to recognize the second variant. This removes useless junk from %depends and %selects. That junk is due to help text that contains the words "selects" and "depends". Link: http://lkml.kernel.org/r/1460333193-16361-2-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 64d750cc5ae4..b2f904a24c5c 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -257,7 +257,7 @@ sub read_kconfig { $iflevel-- if ($iflevel); # stop on "help" and keywords that end a menu entry - } elsif (/^\s*help\s*$/ || /^(comment|choice|menu)\b/) { + } elsif (/^\s*(---)?help(---)?\s*$/ || /^(comment|choice|menu)\b/) { $state = "NONE"; } } -- cgit v1.2.3-59-g8ed1b From 5169192bc1d51cac1ccd57757a849657fb3bdf93 Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Sun, 10 Apr 2016 17:06:32 -0700 Subject: localmodconfig: Add missing $ to reference a variable That is clearly what the original intention was. This does not change the output .config but it prevents some useless processing. ! eq "m" is changed to the simpler eq "y"; symbols with values other than m|y are not included in %orig_configs. Link: http://lkml.kernel.org/r/1460333193-16361-3-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index b2f904a24c5c..01b53eccfe2f 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -454,7 +454,7 @@ sub parse_config_depends $p =~ s/^[^$valid]*[$valid]+//; # We only need to process if the depend config is a module - if (!defined($orig_configs{$conf}) || !$orig_configs{conf} eq "m") { + if (!defined($orig_configs{$conf}) || $orig_configs{$conf} eq "y") { next; } -- cgit v1.2.3-59-g8ed1b From 96bab35d1c4ab706922abd7cef8262fdca07664a Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Tue, 26 Apr 2016 11:52:01 -0700 Subject: localmodconfig: Reset certificate paths When using `make localmodconfig` and friends, if the input config comes from a kernel that was built in a different environment (for example, the canonical case of using localmodconfig to trim a distribution kernel config) the key files for module signature checking will not be available and should be regenerated or omitted. Otherwise, the user will be faced with annoying errors when trying to build with the generated .config: make[1]: *** No rule to make target 'keyring.crt', needed by 'certs/x509_certificate_list'. Stop. Makefile:1576: recipe for target 'certs/' failed Link: http://lkml.kernel.org/r/1461696721-3001-1-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 01b53eccfe2f..95a6f2b888d4 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -610,6 +610,40 @@ foreach my $line (@config_file) { next; } + if (/CONFIG_MODULE_SIG_KEY="(.+)"/) { + my $orig_cert = $1; + my $default_cert = "certs/signing_key.pem"; + + # Check that the logic in this script still matches the one in Kconfig + if (!defined($depends{"MODULE_SIG_KEY"}) || + $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) { + print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ", + "update needed to ", __FILE__, " line ", __LINE__, "\n"; + print; + } elsif ($orig_cert ne $default_cert && ! -f $orig_cert) { + print STDERR "Module signature verification enabled but ", + "module signing key \"$orig_cert\" not found. Resetting ", + "signing key to default value.\n"; + print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n"; + } else { + print; + } + next; + } + + if (/CONFIG_SYSTEM_TRUSTED_KEYS="(.+)"/) { + my $orig_keys = $1; + + if (! -f $orig_keys) { + print STDERR "System keyring enabled but keys \"$orig_keys\" ", + "not found. Resetting keys to default value.\n"; + print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n"; + } else { + print; + } + next; + } + if (/^(CONFIG.*)=(m|y)/) { if (defined($configs{$1})) { if ($localyesconfig) { -- cgit v1.2.3-59-g8ed1b From 5bcba792bb304e8341217d759ec486969a3b4258 Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Tue, 26 Apr 2016 11:56:38 -0700 Subject: localmodconfig: Fix whitespace repeat count after "tristate" Also recognize standalone "prompt". Before this patch we incorrectly identified some symbols as not having a prompt and potentially needing to be selected by something else. Note that this patch could theoretically change the resulting .config, causing it to have fewer symbols turned on. However, given the current set of Kconfig files, this situation does not occur because the symbols newly added to %prompts are absent from %selects. Link: http://lkml.kernel.org/r/1461696998-3953-1-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 95a6f2b888d4..b8c7b29affc5 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -237,7 +237,7 @@ sub read_kconfig { } # configs without prompts must be selected - } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { + } elsif ($state ne "NONE" && /^\s*(tristate\s+\S|prompt\b)/) { # note if the config has a prompt $prompts{$config} = 1; -- cgit v1.2.3-59-g8ed1b