util/kconfig: Uprev to Linux 6.6's kconfig

Upstream reimplemented KCONFIG_STRICT, just calling it KCONFIG_WERROR.
Therefore, adapt our build system and documentation. Upstream is less
strict at this time, but there's a proposed patch that got imported.

TEST=`util/abuild/abuild -C` output (config.h and
config.build) remains the same. Also, the failure type fixed in
https://review.coreboot.org/c/coreboot/+/11272 can be detected,
which I tested by manually breaking our Kconfig in a similar way.

Change-Id: I322fb08a2f7308b93cff71a5dd4136f1a998773b
Signed-off-by: Patrick Georgi <patrick@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79259
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Patrick Georgi
2023-11-20 19:49:29 +01:00
parent 47282a90de
commit 0eab62b9cf
25 changed files with 406 additions and 449 deletions

View File

@@ -22,10 +22,6 @@
#include "lkc.h"
#include "lxdialog/dialog.h"
#define JUMP_NB 9
int kconfig_warnings = 0;
static const char mconf_readme[] =
"Overview\n"
"--------\n"
@@ -290,6 +286,7 @@ static int single_menu_mode;
static int show_all_options;
static int save_and_exit;
static int silent;
static int jump_key_char;
static void conf(struct menu *menu, struct menu *active_menu);
@@ -350,19 +347,19 @@ static void reset_subtitle(void)
set_dialog_subtitles(subtitles);
}
static int show_textbox_ext(const char *title, char *text, int r, int c, int
*keys, int *vscroll, int *hscroll, update_text_fn
update_text, void *data)
static int show_textbox_ext(const char *title, const char *text, int r, int c,
int *vscroll, int *hscroll,
int (*extra_key_cb)(int, size_t, size_t, void *),
void *data)
{
dialog_clear();
return dialog_textbox(title, text, r, c, keys, vscroll, hscroll,
update_text, data);
return dialog_textbox(title, text, r, c, vscroll, hscroll,
extra_key_cb, data);
}
static void show_textbox(const char *title, const char *text, int r, int c)
{
show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL,
NULL, NULL);
show_textbox_ext(title, text, r, c, NULL, NULL, NULL, NULL);
}
static void show_helptext(const char *title, const char *text)
@@ -383,35 +380,54 @@ static void show_help(struct menu *menu)
struct search_data {
struct list_head *head;
struct menu **targets;
int *keys;
struct menu *target;
};
static void update_text(char *buf, size_t start, size_t end, void *_data)
static int next_jump_key(int key)
{
if (key < '1' || key > '9')
return '1';
key++;
if (key > '9')
key = '1';
return key;
}
static int handle_search_keys(int key, size_t start, size_t end, void *_data)
{
struct search_data *data = _data;
struct jump_key *pos;
int k = 0;
int index = 0;
if (key < '1' || key > '9')
return 0;
list_for_each_entry(pos, data->head, entries) {
if (pos->offset >= start && pos->offset < end) {
char header[4];
index = next_jump_key(index);
if (k < JUMP_NB) {
int key = '0' + (pos->index % JUMP_NB) + 1;
if (pos->offset < start)
continue;
sprintf(header, "(%c)", key);
data->keys[k] = key;
data->targets[k] = pos->target;
k++;
} else {
sprintf(header, " ");
}
if (pos->offset >= end)
break;
memcpy(buf + pos->offset, header, sizeof(header) - 1);
if (key == index) {
data->target = pos->target;
return 1;
}
}
data->keys[k] = 0;
return 0;
}
int get_jump_key_char(void)
{
jump_key_char = next_jump_key(jump_key_char);
return jump_key_char;
}
static void search_conf(void)
@@ -458,26 +474,23 @@ again:
sym_arr = sym_re_search(dialog_input);
do {
LIST_HEAD(head);
struct menu *targets[JUMP_NB];
int keys[JUMP_NB + 1], i;
struct search_data data = {
.head = &head,
.targets = targets,
.keys = keys,
};
struct jump_key *pos, *tmp;
jump_key_char = 0;
res = get_relations_str(sym_arr, &head);
set_subtitle();
dres = show_textbox_ext("Search Results", str_get(&res), 0, 0,
keys, &vscroll, &hscroll, &update_text,
&data);
&vscroll, &hscroll,
handle_search_keys, &data);
again = false;
for (i = 0; i < JUMP_NB && keys[i]; i++)
if (dres == keys[i]) {
conf(targets[i]->parent, targets[i]);
again = true;
}
if (dres >= '1' && dres <= '9') {
assert(data.target != NULL);
conf(data.target->parent, data.target);
again = true;
}
str_free(&res);
list_for_each_entry_safe(pos, tmp, &head, entries)
free(pos);
@@ -945,7 +958,6 @@ static void conf_message_callback(const char *s)
static int handle_exit(void)
{
int res;
char *env;
save_and_exit = 1;
reset_subtitle();
@@ -960,13 +972,6 @@ static int handle_exit(void)
end_dialog(saved_x, saved_y);
env = getenv("KCONFIG_STRICT");
if (env && *env && kconfig_warnings) {
fprintf(stderr, "\n*** ERROR: %d warnings encountered, and "
"warnings are errors.\n\n", kconfig_warnings);
res = 2;
}
switch (res) {
case 0:
if (conf_write(filename)) {