[PATCH 7/7] linux-kbuild: fix: process config options set to "y"

From: David Hunter
Date: Fri Sep 13 2024 - 13:14:01 EST


The goal of "make localmodconfig" is to turn off modules that are not
necessary. Some modules are necessary because they are depended on by
config options set with a "y."

Process configs set to "y" so that the modules that are depended on
will not be turned off later.

Signed-off-by: David Hunter <david.hunter.linux@xxxxxxxxx>
---
scripts/kconfig/streamline_config.pl | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 948437aac535..762bf80408c7 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -466,6 +466,11 @@ foreach my $line (@config_file) {

if (/(CONFIG_[$valid]*)=(m|y)/) {
$orig_configs{$1} = $2;
+ # all configs options set to 'y' need to be processed
+ if($2 eq "y") {
+ $configs{$1}= $2;
+ }
+
}
}

@@ -596,9 +601,11 @@ sub loop_depend {
forloop:
foreach my $config (keys %configs) {

- # If this config is not a module, we do not need to process it
- if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m") {
- next forloop;
+ # If this config is not set in the original config,
+ # we do not need to process it
+ if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m"
+ && $orig_configs{$config} ne "y") {
+ next forloop;
}

$config =~ s/^CONFIG_//;
--
2.43.0