Skip to contentSkip to conversation

kconfig: tell the kconfig symbol of the restart reason

PATCH In review Randy Dunlap 2 participants 2 messages Jul 4, 2023 – Jul 12, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: tell the kconfig symbol of the restart reason

When running 'make oldconfig' or 'make olddefconfig' without waiting for prompts, it can be useful to know the restart reason so that it can be fixed manually.

This is usually when the prompt value is a number or a string, i.e., something other than y/m/n.

---
Can the test for sym->name be omitted?

 scripts/kconfig/conf.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/kconfig/conf.c +6 -2
diff -- a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
@@ -652,8 +652,12 @@ static void check_conf(struct menu *menu
 			printf("-----\n");
 			break;
 		default:
-			if (!conf_cnt++)
-				printf("*\n* Restart config...\n*\n");
+			if (!conf_cnt++) {
+				printf("*\n* Restart config...\n");
+				if (sym->name)
+					printf("* due to symbol: %s\n", sym->name);
+				printf("*\n");
+			}
 			rootEntry = menu_get_parent_menu(menu);
 			conf(rootEntry);
 			break;
#1 lore raw
Quoted 2 lines · Randy Dunlap

When running 'make oldconfig' or 'make olddefconfig' without waiting

olddefconfig is not interactive in the first place.

'make config', 'make oldconfig', 'make syncconfig' are affected.

Quoted 5 lines

for prompts, it can be useful to know the restart reason so that it can be fixed manually.

This is usually when the prompt value is a number or a string, i.e., something other than y/m/n.

I do not understand what you mean.

Please give me some examples to see why this is useful.

BTW, "due to symbol ..." is not the reason for the restart. It shows the first CONFIG option shown after the restart.

Quoted 6 lines

---
Can the test for sym->name be omitted?

Not all symbols have a name.
For example, 'choice' may not have a name.

[test code]

choice
prompt "A or B"
depends on FOO

config A
bool "A"

config B
bool "B"

endchoice

config FOO
bool "foo"

If you omit, sym->name test,
"due to symbol: (null)" will be displayed.
Not a crash, but users will be misguided.

foo (FOO) [N/y/?] (NEW) y
*
* Restart config...
* due to symbol: (null)
*
*
* Linux/x86 6.5.0-rc1 Kernel Configuration
*
A or B

Quoted 1 line

1. A (A) (NEW)

2. B (B) (NEW)

Quoted 21 lines
 scripts/kconfig/conf.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff -- a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c

scripts/kconfig/conf.c +6 -2
@@ -652,8 +652,12 @@ static void check_conf(struct menu *menu
                        printf("-----\n");
                        break;
                default:
-                       if (!conf_cnt++)
-                               printf("*\n* Restart config...\n*\n");
+                       if (!conf_cnt++) {
+                               printf("*\n* Restart config...\n");
+                               if (sym->name)
+                                       printf("* due to symbol: %s\n", sym->name);
+                               printf("*\n");
+                       }
                        rootEntry = menu_get_parent_menu(menu);
                        conf(rootEntry);
                        break;
Signature · 2 lines
Best Regards
Masahiro Yamada