Skip to contentSkip to conversation

support/kconfig: Bump to kconfig from Linux 4.17-rc2

RFC PATCH New Petr Vorel 2 participants 5 messages Sep 19, 2018 – Sep 20, 2018 Kbuild

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

RFC PATCH v3 1/1 support/kconfig: Bump to kconfig from Linux 4.17-rc2

---
Changes v2->v3:
* Fix issues with building more that we need (menuconfig require unfortunately "make menuconfig" fails, because
it wants ? reported by Thomas in [1]).

Changes v1->v2:
* Fix building packages (v1 didn't address change in kernel 911a91c39cab kconfig: rename silentoldconfig to syncconfig)

TODO: I plan to update code to 4.19 rc* (or 4.19 once it's released).

NOTE: I still keep shipping generated zconf.lex.c and zconf.tab.c files (assuming that we don't want to have flex and bison as mandatory dependencies for Buildroot.

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/patch/911149/#1916635

---
 Makefile                                      |   10 +-
 support/kconfig/Makefile                      |  220 ++-
 support/kconfig/README.buildroot              |    6 +-
 support/kconfig/check.sh                      |    2 +-
 support/kconfig/conf.c                        |  127 +-
 support/kconfig/confdata.c                    |   40 +-
 support/kconfig/expr.c                        |  479 +++--
 support/kconfig/expr.h                        |  107 +-
 support/kconfig/gconf.c                       |   33 +-
 support/kconfig/kxgettext.c                   |    2 +-
 support/kconfig/list.h                        |    7 +-
 support/kconfig/lkc.h                         |   21 +-
 support/kconfig/lkc_proto.h                   |   86 +-
 support/kconfig/lxdialog/check-lxdialog.sh    |    4 +-
 support/kconfig/lxdialog/checklist.c          |    4 +-
 support/kconfig/lxdialog/dialog.h             |    2 +-
 support/kconfig/lxdialog/inputbox.c           |    2 +-
 support/kconfig/lxdialog/menubox.c            |    4 +-
 support/kconfig/lxdialog/util.c               |    2 +-
 support/kconfig/mconf.c                       |   40 +-
 support/kconfig/menu.c                        |  261 ++-
 support/kconfig/merge_config.sh               |   62 +-
 support/kconfig/nconf.c                       |   20 +-
 support/kconfig/nconf.gui.c                   |   22 +-
 support/kconfig/nconf.h                       |    4 +-
 .../01-kconfig-kernel-to-buildroot.patch      |   66 +-
 .../06-br-build-system-integration.patch      |   87 +-
 .../kconfig/patches/10-br-build-system.patch  |    8 +-
 .../patches/11-use-mktemp-for-lxdialog.patch  |    8 +-
 .../patches/12-fix-glade-file-path.patch      |    8 +-
 .../14-support-out-of-tree-config.patch       |   42 +-
 .../patches/15-fix-qconf-moc-rule.patch       |   24 -
 .../16-fix-space-to-de-select-options.patch   |    8 +-
 ...g-get-ncurses-CFLAGS-with-pkg-config.patch |   50 -
 ...-nconfig-fix-multi-byte-UTF-handling.patch |   45 -
 support/kconfig/patches/series                |    4 +-
 support/kconfig/qconf.cc                      |  708 ++++---
 support/kconfig/qconf.h                       |  150 +-
 support/kconfig/streamline_config.pl          |   58 +-
 support/kconfig/symbol.c                      |  167 +-
 support/kconfig/util.c                        |   34 +-
 support/kconfig/zconf.gperf                   |   47 -
 support/kconfig/zconf.hash.c_shipped          |  286 ---
 support/kconfig/zconf.l                       |  103 +-
 support/kconfig/zconf.lex.c_shipped           | 1136 ++++++-----
 support/kconfig/zconf.tab.c_shipped           | 1756 ++++++++---------
 support/kconfig/zconf.y                       |  149 +-
 47 files changed, 3407 insertions(+), 3104 deletions(-)
 delete mode 100644 support/kconfig/patches/15-fix-qconf-moc-rule.patch
 delete mode 100644 support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch
 delete mode 100644 support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch
 mode change 100644 => 100755 support/kconfig/streamline_config.pl
 delete mode 100644 support/kconfig/zconf.gperf
 delete mode 100644 support/kconfig/zconf.hash.c_shipped
Makefile +5 -5
index 57e776056c..18afa36b28 100644
@@ -128,7 +128,7 @@ export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlo
 
 # List of targets and target patterns for which .config doesn't need to be read in
 noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
-	defconfig %_defconfig allyesconfig allnoconfig alldefconfig silentoldconfig release \
+	defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \
 	randpackageconfig allyespackageconfig allnopackageconfig \
 	print-version olddefconfig distclean manual manual-% check-package
 
@@ -565,7 +565,7 @@ dirs: $(BUILD_DIR) $(STAGING_DIR) $(BASE_TARGET_DIR) \
 	$(HOST_DIR) $(HOST_DIR_SYMLINK) $(BINARIES_DIR)
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
-	$(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
+	$(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" syncconfig
 
 .PHONY: prepare
 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
@@ -933,7 +933,7 @@ randpackageconfig allyespackageconfig allnopackageconfig: $(BUILD_DIR)/buildroot
 	@rm -f $(CONFIG_DIR)/.config.nopkg
 	@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
 
-oldconfig silentoldconfig olddefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
+oldconfig syncconfig olddefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
 	@$(COMMON_CONFIG_ENV) $< --$@ $(CONFIG_CONFIG_IN)
 
 defconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
@@ -1029,8 +1029,8 @@ help:
 	@echo '  xconfig                - interactive Qt-based configurator'
 	@echo '  gconfig                - interactive GTK-based configurator'
 	@echo '  oldconfig              - resolve any unresolved symbols in .config'
-	@echo '  silentoldconfig        - Same as oldconfig, but quietly, additionally update deps'
-	@echo '  olddefconfig           - Same as silentoldconfig but sets new symbols to their default value'
+	@echo '  syncconfig             - Same as oldconfig, but quietly, additionally update deps'
+	@echo '  olddefconfig           - Same as syncconfig but sets new symbols to their default value'
 	@echo '  randconfig             - New config with random answer to all options'
 	@echo '  defconfig              - New config with default answer to all options;'
 	@echo '                             BR2_DEFCONFIG, if set on the command line, is used as input'
support/kconfig/Makefile +121 -99

374 lines not on this page · raw message

support/kconfig/README.buildroot +5 -1
index 3140713b39..76808f85b4 100644
@@ -1,9 +1,13 @@
-This is a copy of the kconfig code in the kernel (currently 3.13-rc5) tweaked
+This is a copy of the kconfig code in the kernel (currently 4.17-rc2) tweaked
 to suit Buildroot.
 
 To update:
 	cp -r /usr/src/linux/scripts/kconfig support/kconfig.new
 	cd support/kconfig.new
+	# zconf.lex.c and zconf.tab.c needs to be generated by 'make menuconfig'
+	mv zconf.lex.c zconf.lex.c_shipped
+	mv zconf.tab.c zconf.tab.c_shipped
+	rm -rf tests/
 	cp -a ../kconfig/patches ../kconfig/README.buildroot ../kconfig/.gitignore .
 	quilt push -a
 	# Fix any conflict
support/kconfig/check.sh +1 -1
index 854d9c7c67..97f0fee7d1 100755
@@ -1,4 +1,5 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
 # Needed for systems without gettext
 $* -x c -o /dev/null - > /dev/null 2>&1 << EOF
 #include <libintl.h>
@@ -11,4 +12,3 @@ EOF
 if [ ! "$?" -eq "0"  ]; then
 	echo -DKBUILD_NO_NLS;
 fi
-
support/kconfig/conf.c +63 -64

281 lines not on this page · raw message

support/kconfig/confdata.c +25 -15
index 2371fa8179..892da74fdc 100644
@@ -17,6 +17,11 @@
 
 #include "lkc.h"
 
+struct conf_printer {
+	void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
+	void (*print_comment)(FILE *, const char *, void *);
+};
+
 static void conf_warning(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
 
@@ -24,7 +29,7 @@ static void conf_message(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
 
 static const char *conf_filename;
-static int conf_lineno, conf_warnings, conf_unsaved;
+static int conf_lineno, conf_warnings;
 
 const char conf_defname[] = ".defconfig";
 
@@ -60,6 +65,7 @@ static void conf_message(const char *fmt, ...)
 	va_start(ap, fmt);
 	if (conf_message_callback)
 		conf_message_callback(fmt, ap);
+	va_end(ap);
 }
 
 const char *conf_get_configname(void)
@@ -171,7 +177,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 	case S_HEX:
 	done:
 		if (sym_string_valid(sym, p)) {
-			sym->def[def].val = strdup(p);
+			sym->def[def].val = xstrdup(p);
 			sym->flags |= def_flags;
 		} else {
 			if (def != S_DEF_AUTO)
@@ -194,7 +200,7 @@ static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
 	if (new_size > *n) {
 		new_size += LINE_GROWTH - 1;
 		new_size *= 2;
-		nline = realloc(*lineptr, new_size);
+		nline = xrealloc(*lineptr, new_size);
 		if (!nline)
 			return -1;
 
@@ -260,11 +266,8 @@ int conf_read_simple(const char *name, int def)
 		if (in)
 			goto load;
 		sym_add_change_count(1);
-		if (!sym_defconfig_list) {
-			if (modules_sym)
-				sym_calc_value(modules_sym);
+		if (!sym_defconfig_list)
 			return 1;
-		}
 
 		for_all_defaults(sym_defconfig_list, prop) {
 			if (expr_calc_value(prop->visible.expr) == no ||
@@ -286,7 +289,6 @@ load:
 	conf_filename = name;
 	conf_lineno = 0;
 	conf_warnings = 0;
-	conf_unsaved = 0;
 
 	def_flags = SYMBOL_DEF << def;
 	for_all_symbols(i, sym) {
@@ -371,7 +373,9 @@ load:
 				continue;
 		} else {
 			if (line[0] != '\r' && line[0] != '\n')
-				conf_warning("unexpected data");
+				conf_warning("unexpected data: %.*s",
+					     (int)strcspn(line, "\r\n"), line);
+
 			continue;
 		}
 setsym:
@@ -397,21 +401,23 @@ setsym:
 	}
 	free(line);
 	fclose(in);
-
-	if (modules_sym)
-		sym_calc_value(modules_sym);
 	return 0;
 }
 
 int conf_read(const char *name)
 {
 	struct symbol *sym;
+	int conf_unsaved = 0;
 	int i;
 
 	sym_set_change_count(0);
 
-	if (conf_read_simple(name, S_DEF_USER))
+	if (conf_read_simple(name, S_DEF_USER)) {
+		sym_calc_value(modules_sym);
 		return 1;
+	}
+
+	sym_calc_value(modules_sym);
 
 	for_all_symbols(i, sym) {
 		sym_calc_value(sym);
@@ -846,6 +852,7 @@ static int conf_split_config(void)
 
 	name = conf_get_autoconfig_name();
 	conf_read_simple(name, S_DEF_AUTO);
+	sym_calc_value(modules_sym);
 
 	opwd = malloc(256);
 	_name = strdup(name);
@@ -1149,7 +1156,7 @@ void set_all_choice_values(struct symbol *csym)
 bool conf_set_all_new_symbols(enum conf_def_mode mode)
 {
 	struct symbol *sym, *csym;
-	int i, cnt, pby, pty, ptm;	/* pby: probability of boolean  = y
+	int i, cnt, pby, pty, ptm;	/* pby: probability of bool     = y
 					 * pty: probability of tristate = y
 					 * ptm: probability of tristate = m
 					 */
@@ -1211,7 +1218,10 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
 				sym->def[S_DEF_USER].tri = mod;
 				break;
 			case def_no:
-				sym->def[S_DEF_USER].tri = no;
+				if (sym->flags & SYMBOL_ALLNOCONFIG_Y)
+					sym->def[S_DEF_USER].tri = yes;
+				else
+					sym->def[S_DEF_USER].tri = no;
 				break;
 			case def_random:
 				sym->def[S_DEF_USER].tri = no;
support/kconfig/expr.c +308 -171

668 lines not on this page · raw message

support/kconfig/expr.h +99 -8

185 lines not on this page · raw message

support/kconfig/gconf.c +6 -27
index 7cbe68eb01..0c2d1c18f9 100644
@@ -169,14 +169,6 @@ void init_main_window(const gchar * glade_file)
 	style = gtk_widget_get_style(main_wnd);
 	widget = glade_xml_get_widget(xml, "toolbar1");
 
-#if 0	/* Use stock Gtk icons instead */
-	replace_button_icon(xml, main_wnd->window, style,
-			    "button1", (gchar **) xpm_back);
-	replace_button_icon(xml, main_wnd->window, style,
-			    "button2", (gchar **) xpm_load);
-	replace_button_icon(xml, main_wnd->window, style,
-			    "button3", (gchar **) xpm_save);
-#endif
 	replace_button_icon(xml, main_wnd->window, style,
 			    "button4", (gchar **) xpm_single_view);
 	replace_button_icon(xml, main_wnd->window, style,
@@ -184,22 +176,6 @@ void init_main_window(const gchar * glade_file)
 	replace_button_icon(xml, main_wnd->window, style,
 			    "button6", (gchar **) xpm_tree_view);
 
-#if 0
-	switch (view_mode) {
-	case SINGLE_VIEW:
-		widget = glade_xml_get_widget(xml, "button4");
-		g_signal_emit_by_name(widget, "clicked");
-		break;
-	case SPLIT_VIEW:
-		widget = glade_xml_get_widget(xml, "button5");
-		g_signal_emit_by_name(widget, "clicked");
-		break;
-	case FULL_VIEW:
-		widget = glade_xml_get_widget(xml, "button6");
-		g_signal_emit_by_name(widget, "clicked");
-		break;
-	}
-#endif
 	txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
 	tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1",
 					  "foreground", "red",
@@ -938,7 +914,7 @@ on_treeview2_button_press_event(GtkWidget * widget,
 			current = menu;
 			display_tree_part();
 			gtk_widget_set_sensitive(back_btn, TRUE);
-		} else if ((col == COL_OPTION)) {
+		} else if (col == COL_OPTION) {
 			toggle_sym_value(menu);
 			gtk_tree_view_expand_row(view, path, TRUE);
 		}
@@ -1404,7 +1380,7 @@ static void display_tree(struct menu *menu)
 		    && (tree == tree2))
 			continue;
 /*
-                if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT))
+		if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT))
 		    || (view_mode == FULL_VIEW)
 		    || (view_mode == SPLIT_VIEW))*/
 
@@ -1498,9 +1474,12 @@ int main(int ac, char *av[])
 		case 'a':
 			//showAll = 1;
 			break;
+		case 's':
+			conf_set_message_callback(NULL);
+			break;
 		case 'h':
 		case '?':
-			printf("%s <config>\n", av[0]);
+			printf("%s [-s] <config>\n", av[0]);
 			exit(0);
 		}
 		name = av[2];
support/kconfig/kxgettext.c +1 -1
index 2858738b22..240880a891 100644
@@ -101,7 +101,7 @@ static struct message *message__new(const char *msg, char *option,
 	if (self->files == NULL)
 		goto out_fail;
 
-	self->msg = strdup(msg);
+	self->msg = xstrdup(msg);
 	if (self->msg == NULL)
 		goto out_fail_msg;
 
support/kconfig/list.h +4 -3
index 685d80e1bb..45cb237ab7 100644
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #ifndef LIST_H
 #define LIST_H
 
@@ -34,7 +35,7 @@ struct list_head {
  * list_entry - get the struct for this entry
  * @ptr:	the &struct list_head pointer.
  * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
+ * @member:	the name of the list_head within the struct.
  */
 #define list_entry(ptr, type, member) \
 	container_of(ptr, type, member)
@@ -43,7 +44,7 @@ struct list_head {
  * list_for_each_entry	-	iterate over list of given type
  * @pos:	the type * to use as a loop cursor.
  * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
+ * @member:	the name of the list_head within the struct.
  */
 #define list_for_each_entry(pos, head, member)				\
 	for (pos = list_entry((head)->next, typeof(*pos), member);	\
@@ -55,7 +56,7 @@ struct list_head {
  * @pos:	the type * to use as a loop cursor.
  * @n:		another type * to use as temporary storage
  * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
+ * @member:	the name of the list_head within the struct.
  */
 #define list_for_each_entry_safe(pos, n, head, member)			\
 	for (pos = list_entry((head)->next, typeof(*pos), member),	\
support/kconfig/lkc.h +5 -16
index 09f4edfdc9..f4394af6e4 100644
@@ -21,9 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c;
 extern "C" {
 #endif
 
-#define P(name,type,arg)	extern type name arg
 #include "lkc_proto.h"
-#undef P
 
 #define SRCTREE "srctree"
 
@@ -61,17 +59,16 @@ enum conf_def_mode {
 #define T_OPT_MODULES		1
 #define T_OPT_DEFCONFIG_LIST	2
 #define T_OPT_ENV		3
+#define T_OPT_ALLNOCONFIG_Y	4
 
 struct kconf_id {
-	int name;
+	const char *name;
 	int token;
 	unsigned int flags;
 	enum symbol_type stype;
 };
 
-extern int zconfdebug;
-
-int zconfparse(void);
+extern int yylineno;
 void zconfdump(FILE *out);
 void zconf_starthelp(void);
 FILE *zconf_fopen(const char *name);
@@ -89,11 +86,6 @@ void sym_add_change_count(int count);
 bool conf_set_all_new_symbols(enum conf_def_mode mode);
 void set_all_choice_values(struct symbol *csym);
 
-struct conf_printer {
-	void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
-	void (*print_comment)(FILE *, const char *, void *);
-};
-
 /* confdata.c and expr.c */
 static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
 {
@@ -109,10 +101,8 @@ void menu_warn(struct menu *menu, const char *fmt, ...);
 struct menu *menu_add_menu(void);
 void menu_end_menu(void);
 void menu_add_entry(struct symbol *sym);
-void menu_end_entry(void);
 void menu_add_dep(struct expr *dep);
 void menu_add_visibility(struct expr *dep);
-struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
 struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
 void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
 void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
@@ -125,6 +115,8 @@ struct file *file_lookup(const char *name);
 int file_write_dep(const char *name);
 void *xmalloc(size_t size);
 void *xcalloc(size_t nmemb, size_t size);
+void *xrealloc(void *p, size_t size);
+char *xstrdup(const char *s);
 
 struct gstr {
 	size_t len;
@@ -136,7 +128,6 @@ struct gstr {
 	int max_width;
 };
 struct gstr str_new(void);
-struct gstr str_assign(const char *s);
 void str_free(struct gstr *gs);
 void str_append(struct gstr *gs, const char *s);
 void str_printf(struct gstr *gs, const char *fmt, ...);
@@ -147,8 +138,6 @@ extern struct expr *sym_env_list;
 
 void sym_init(void);
 void sym_clear_all_valid(void);
-void sym_set_all_changed(void);
-void sym_set_changed(struct symbol *sym);
 struct symbol *sym_choice_default(struct symbol *sym);
 const char *sym_get_string_default(struct symbol *sym);
 struct symbol *sym_check_deps(struct symbol *sym);
support/kconfig/lkc_proto.h +41 -45

98 lines not on this page · raw message

support/kconfig/lxdialog/check-lxdialog.sh +3 -1
index 3ce0a23349..16cd9a3186 100755
@@ -1,4 +1,5 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
 # Check ncurses compatibility
 
 # What library to link
@@ -54,7 +55,8 @@ EOF
 	    echo " *** required header files."                            1>&2
 	    echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
 	    echo " *** "                                                  1>&2
-	    echo " *** Install ncurses (ncurses-devel) and try again."    1>&2
+	    echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2
+	    echo " *** depending on your distribution) and try again."    1>&2
 	    echo " *** "                                                  1>&2
 	    exit 1
 	fi
support/kconfig/lxdialog/checklist.c +2 -2
index 3b15c08ec1..8d016faa28 100644
@@ -168,13 +168,13 @@ do_resize:
 
 	/* create new window for the list */
 	list = subwin(dialog, list_height, list_width, y + box_y + 1,
-	              x + box_x + 1);
+		      x + box_x + 1);
 
 	keypad(list, TRUE);
 
 	/* draw a box around the list items */
 	draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2,
-	         dlg.menubox_border.atr, dlg.menubox.atr);
+		 dlg.menubox_border.atr, dlg.menubox.atr);
 
 	/* Find length of longest item in order to center checklist */
 	check_x = 0;
support/kconfig/lxdialog/dialog.h +1 -1
index b4343d3849..fcffd5b41f 100644
@@ -170,7 +170,7 @@ char item_tag(void);
 /* item list manipulation for lxdialog use */
 #define MAXITEMSTR 200
 struct dialog_item {
-	char str[MAXITEMSTR];	/* promtp displayed */
+	char str[MAXITEMSTR];	/* prompt displayed */
 	char tag;
 	void *data;	/* pointer to menu item - used by menubox+checklist */
 	int selected;	/* Set to 1 by dialog_*() function if selected. */
support/kconfig/lxdialog/inputbox.c +1 -1
index 447a582198..d58de1dc53 100644
@@ -42,7 +42,7 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
  * Display a dialog box for inputing a string
  */
 int dialog_inputbox(const char *title, const char *prompt, int height, int width,
-                    const char *init)
+		    const char *init)
 {
 	int i, x, y, box_y, box_x, box_width;
 	int input_x = 0, key = 0, button = -1;
support/kconfig/lxdialog/menubox.c +2 -2
index b0d0d698e1..185524901d 100644
@@ -64,7 +64,7 @@ static int menu_width, item_x;
  * Print menu item
  */
 static void do_print_item(WINDOW * win, const char *item, int line_y,
-                          int selected, int hotkey)
+			  int selected, int hotkey)
 {
 	int j;
 	char *menu_item = malloc(menu_width + 1);
@@ -182,7 +182,7 @@ static void do_scroll(WINDOW *win, int *scroll, int n)
  * Display a menu for choosing among a number of options
  */
 int dialog_menu(const char *title, const char *prompt,
-                const void *selected, int *s_scroll)
+		const void *selected, int *s_scroll)
 {
 	int i, j, x, y, box_x, box_y;
 	int height, width, menu_height;
support/kconfig/lxdialog/util.c +1 -1
index 58a8289dd6..f7abdeb92a 100644
@@ -623,7 +623,7 @@ void item_make(const char *fmt, ...)
 void item_add_str(const char *fmt, ...)
 {
 	va_list ap;
-        size_t avail;
+	size_t avail;
 
 	avail = sizeof(item_cur->node.str) - strlen(item_cur->node.str);
 
support/kconfig/mconf.c +25 -15
index 91c4df78f3..279f4552a1 100644
@@ -246,7 +246,7 @@ search_help[] = N_(
 	"  Selected by: BAR [=n]\n"
 	"-----------------------------------------------------------------\n"
 	"o The line 'Type:' shows the type of the configuration option for\n"
-	"  this symbol (boolean, tristate, string, ...)\n"
+	"  this symbol (bool, tristate, string, ...)\n"
 	"o The line 'Prompt:' shows the text used in the menu structure for\n"
 	"  this symbol\n"
 	"o The 'Defined at' line tells at what file / line number the symbol\n"
@@ -279,6 +279,7 @@ static int child_count;
 static int single_menu_mode;
 static int show_all_options;
 static int save_and_exit;
+static int silent;
 
 static void conf(struct menu *menu, struct menu *active_menu);
 static void conf_choice(struct menu *menu);
@@ -299,7 +300,7 @@ static void set_config_filename(const char *config_filename)
 	int size;
 
 	size = snprintf(menu_backtitle, sizeof(menu_backtitle),
-	                "%s - %s", config_filename, rootmenu.prompt->text);
+			"%s - %s", config_filename, rootmenu.prompt->text);
 	if (size >= sizeof(menu_backtitle))
 		menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
 	set_dialog_backtitle(menu_backtitle);
@@ -330,10 +331,10 @@ static void set_subtitle(void)
 	list_for_each_entry(sp, &trail, entries) {
 		if (sp->text) {
 			if (pos) {
-				pos->next = xcalloc(sizeof(*pos), 1);
+				pos->next = xcalloc(1, sizeof(*pos));
 				pos = pos->next;
 			} else {
-				subtitles = pos = xcalloc(sizeof(*pos), 1);
+				subtitles = pos = xcalloc(1, sizeof(*pos));
 			}
 			pos->text = sp->text;
 		}
@@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap)
 	char buf[PATH_MAX+1];
 
 	vsnprintf(buf, sizeof(buf), fmt, ap);
-	if (save_and_exit)
-		printf("%s", buf);
-	else
+	if (save_and_exit) {
+		if (!silent)
+			printf("%s", buf);
+	} else {
 		show_textbox(NULL, buf, 6, 60);
+	}
 }
 
 static void show_help(struct menu *menu)
@@ -977,16 +980,18 @@ static int handle_exit(void)
 		}
 		/* fall through */
 	case -1:
-		printf(_("\n\n"
-			 "*** End of the configuration.\n"
-			 "*** Execute 'make' to start the build or try 'make help'."
-			 "\n\n"));
+		if (!silent)
+			printf(_("\n\n"
+				 "*** End of the configuration.\n"
+				 "*** Execute 'make' to start the build or try 'make help'."
+				 "\n\n"));
 		res = 0;
 		break;
 	default:
-		fprintf(stderr, _("\n\n"
-				  "Your configuration changes were NOT saved."
-				  "\n\n"));
+		if (!silent)
+			fprintf(stderr, _("\n\n"
+					  "Your configuration changes were NOT saved."
+					  "\n\n"));
 		if (res != KEY_ESC)
 			res = 0;
 	}
@@ -1010,6 +1015,12 @@ int main(int ac, char **av)
 
 	signal(SIGINT, sig_handler);
 
+	if (ac > 1 && strcmp(av[1], "-s") == 0) {
+		silent = 1;
+		/* Silence conf_read() until the real callback is set up */
+		conf_set_message_callback(NULL);
+		av++;
+	}
 	conf_parse(av[1]);
 	conf_read(NULL);
 
@@ -1034,4 +1045,3 @@ int main(int ac, char **av)
 
 	return res;
 }
-
support/kconfig/menu.c +220 -41

452 lines not on this page · raw message

support/kconfig/merge_config.sh +38 -24

125 lines not on this page · raw message

support/kconfig/nconf.c +13 -7
index 4fbecd2473..0031147798 100644
@@ -5,7 +5,9 @@
  * Derived from menuconfig.
  *
  */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <string.h>
 #include <stdlib.h>
 
@@ -269,7 +271,7 @@ static struct mitem k_menu_items[MAX_MENU_ITEMS];
 static int items_num;
 static int global_exit;
 /* the currently selected button */
-const char *current_instructions = menu_instructions;
+static const char *current_instructions = menu_instructions;
 
 static char *dialog_input_result;
 static int dialog_input_result_len;
@@ -303,7 +305,7 @@ struct function_keys {
 };
 
 static const int function_keys_num = 9;
-struct function_keys function_keys[] = {
+static struct function_keys function_keys[] = {
 	{
 		.key_str = "F1",
 		.func = "Help",
@@ -506,7 +508,7 @@ static int get_mext_match(const char *match_str, match_f flag)
 	index = (index + items_num) % items_num;
 	while (true) {
 		char *str = k_menu_items[index].str;
-		if (strcasestr(str, match_str) != 0)
+		if (strcasestr(str, match_str) != NULL)
 			return index;
 		if (flag == FIND_NEXT_MATCH_UP ||
 		    flag == MATCH_TINKER_PATTERN_UP)
@@ -1065,7 +1067,7 @@ static int do_match(int key, struct match_state *state, int *ans)
 
 static void conf(struct menu *menu)
 {
-	struct menu *submenu = 0;
+	struct menu *submenu = NULL;
 	const char *prompt = menu_get_prompt(menu);
 	struct symbol *sym;
 	int res;
@@ -1232,7 +1234,7 @@ static void show_help(struct menu *menu)
 static void conf_choice(struct menu *menu)
 {
 	const char *prompt = _(menu_get_prompt(menu));
-	struct menu *child = 0;
+	struct menu *child = NULL;
 	struct symbol *active;
 	int selected_index = 0;
 	int last_top_row = 0;
@@ -1454,7 +1456,7 @@ static void conf_save(void)
 	}
 }
 
-void setup_windows(void)
+static void setup_windows(void)
 {
 	int lines, columns;
 
@@ -1482,6 +1484,11 @@ int main(int ac, char **av)
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
+	if (ac > 1 && strcmp(av[1], "-s") == 0) {
+		/* Silence conf_read() until the real callback is set up */
+		conf_set_message_callback(NULL);
+		av++;
+	}
 	conf_parse(av[1]);
 	conf_read(NULL);
 
@@ -1554,4 +1561,3 @@ int main(int ac, char **av)
 	endwin();
 	return 0;
 }
-
support/kconfig/nconf.gui.c +15 -7
index 8275f0e551..88874acfda 100644
@@ -6,6 +6,7 @@
  *
  */
 #include "nconf.h"
+#include "lkc.h"
 
 /* a list of all the different widgets we use */
 attributes_t attributes[ATTR_MAX+1] = {0};
@@ -129,7 +130,7 @@ static void no_colors_theme(void)
 	mkattrn(FUNCTION_TEXT, A_REVERSE);
 }
 
-void set_colors()
+void set_colors(void)
 {
 	start_color();
 	use_default_colors();
@@ -192,7 +193,7 @@ const char *get_line(const char *text, int line_no)
 	int lines = 0;
 
 	if (!text)
-		return 0;
+		return NULL;
 
 	for (i = 0; text[i] != '\0' && lines < line_no; i++)
 		if (text[i] == '\n')
@@ -364,15 +365,17 @@ int dialog_inputbox(WINDOW *main_window,
 	WINDOW *prompt_win;
 	WINDOW *form_win;
 	PANEL *panel;
-	int i, x, y;
+	int i, x, y, lines, columns, win_lines, win_cols;
 	int res = -1;
 	int cursor_position = strlen(init);
 	int cursor_form_win;
 	char *result = *resultp;
 
+	getmaxyx(stdscr, lines, columns);
+
 	if (strlen(init)+1 > *result_len) {
 		*result_len = strlen(init)+1;
-		*resultp = result = realloc(result, *result_len);
+		*resultp = result = xrealloc(result, *result_len);
 	}
 
 	/* find the widest line of msg: */
@@ -386,14 +389,19 @@ int dialog_inputbox(WINDOW *main_window,
 	if (title)
 		prompt_width = max(prompt_width, strlen(title));
 
+	win_lines = min(prompt_lines+6, lines-2);
+	win_cols = min(prompt_width+7, columns-2);
+	prompt_lines = max(win_lines-6, 0);
+	prompt_width = max(win_cols-7, 0);
+
 	/* place dialog in middle of screen */
-	y = (getmaxy(stdscr)-(prompt_lines+4))/2;
-	x = (getmaxx(stdscr)-(prompt_width+4))/2;
+	y = (lines-win_lines)/2;
+	x = (columns-win_cols)/2;
 
 	strncpy(result, init, *result_len);
 
 	/* create the windows */
-	win = newwin(prompt_lines+6, prompt_width+7, y, x);
+	win = newwin(win_lines, win_cols, y, x);
 	prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
 	form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
 	keypad(form_win, TRUE);
support/kconfig/nconf.h +1 -3
index 0d5261705e..9f6f21d3b0 100644
@@ -15,7 +15,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <locale.h>
-#include <curses.h>
+#include <ncurses.h>
 #include <menu.h>
 #include <panel.h>
 #include <form.h>
@@ -24,8 +24,6 @@
 #include <time.h>
 #include <sys/time.h>
 
-#include "ncurses.h"
-
 #define max(a, b) ({\
 		typeof(a) _a = a;\
 		typeof(b) _b = b;\
support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch +33 -33

110 lines not on this page · raw message

support/kconfig/patches/06-br-build-system-integration.patch +63 -24

40 lines not on this page · raw message

support/kconfig/patches/10-br-build-system.patch +4 -4
index be6fda07af..abf2463691 100644

Lines of this file are not shown. View the raw message.

support/kconfig/patches/11-use-mktemp-for-lxdialog.patch +4 -4
index b38af26211..387c633ae2 100644

Lines of this file are not shown. View the raw message.

support/kconfig/patches/12-fix-glade-file-path.patch +4 -4
index a5777da3e9..7d5941fc9e 100644

Lines of this file are not shown. View the raw message.

support/kconfig/patches/14-support-out-of-tree-config.patch +21 -21

42 lines not on this page · raw message

support/kconfig/patches/15-fix-qconf-moc-rule.patch deleted +0 -24
deleted file mode 100644
index c1848d764e..0000000000

Lines of this file are not shown. View the raw message.

support/kconfig/patches/16-fix-space-to-de-select-options.patch +4 -4
index 972d2de9ea..08f7ec5d95 100644

Lines of this file are not shown. View the raw message.

support/kconfig/patches/17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch deleted +0 -50

50 lines not on this page · raw message

support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch deleted +0 -45

45 lines not on this page · raw message

support/kconfig/patches/series +1 -3
index 1a53ba9958..36591e2189 100644

Lines of this file are not shown. View the raw message.

support/kconfig/qconf.cc +396 -312

708 lines not on this page · raw message

support/kconfig/qconf.h +71 -79

150 lines not on this page · raw message

support/kconfig/streamline_config.pl +50 -8

58 lines not on this page · raw message

support/kconfig/symbol.c +113 -54

167 lines not on this page · raw message

support/kconfig/util.c +21 -13
index 60eb566180..18a8e52391 100644

Lines of this file are not shown. View the raw message.

support/kconfig/zconf.gperf deleted +0 -47

47 lines not on this page · raw message

support/kconfig/zconf.hash.c_shipped deleted +0 -286

286 lines not on this page · raw message

support/kconfig/zconf.l +56 -47

103 lines not on this page · raw message

support/kconfig/zconf.lex.c_shipped +608 -528

1,136 lines not on this page · raw message

support/kconfig/zconf.tab.c_shipped +853 -903

1,756 lines not on this page · raw message

support/kconfig/zconf.y +99 -50

149 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.19.0.rc2

Part of the diff is not shown here. View the raw message.

#1 lore raw

RFC PATCH v3 1/1 support/kconfig: Bump to kconfig from Linux 4.17-rc2

Hello Petr,

Thanks for working on this!

Quoted 6 lines · Petr Vorel

---
Changes v2->v3:
* Fix issues with building more that we need (menuconfig require unfortunately "make menuconfig" fails, because
it wants ? reported by Thomas in [1]).

I don't understand this changelog. Could explain a bit more what you mean here?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#2 lore raw

RFC PATCH v3 1/1 support/kconfig: Bump to kconfig from Linux 4.17-rc2

Hi Thomas,

Quoted 10 lines

Thanks for working on this!

Quoted 6 lines · Petr Vorel

---
Changes v2->v3:
* Fix issues with building more that we need (menuconfig require unfortunately "make menuconfig" fails, because
it wants ? reported by Thomas in [1]).

Quoted 2 lines

I don't understand this changelog. Could explain a bit more what you mean here?

Sure :). v2 build all code no matter whether it was actually needed. E.g. 'make menuconfig' built gconf (gtk) or qconf (qt). That's a bug you pointed out in [1]. I fixed it in v3. It was caused by removing ifeq clauses. Here is the diff v2 vs. v3:

-hostprogs-y := conf nconf mconf kxgettext qconf gconf +hostprogs-y := conf
+
+ifeq ($(MAKECMDGOALS),nconf)
+ hostprogs-y += nconf
+endif
+
+ifeq ($(MAKECMDGOALS),mconf)
+ hostprogs-y += mconf
+endif
+
+ifeq ($(MAKECMDGOALS),update-po-config)
+ hostprogs-y += kxgettext
+endif
+
+ifeq ($(MAKECMDGOALS),qconf)
+ qconf-target := 1
+endif
+
+ifeq ($(MAKECMDGOALS),gconf)
+ gconf-target := 1
+endif
+
+ifeq ($(qconf-target),1)
+ hostprogs-y += qconf
+endif
+
+ifeq ($(gconf-target),1)
+ hostprogs-y += gconf
+endif

Another change I did is little changes in docs
(support/kconfig/README.buildroot):

-This is a copy of the kconfig code in the kernel (currently 3.13-rc5) tweaked +This is a copy of the kconfig code in the kernel (currently 4.17-rc2) tweaked
...
cd support/kconfig.new
+ # zconf.lex.c and zconf.tab.c needs to be generated by 'make menuconfig'

Kind regards,
Petr

#3 lore raw

RFC PATCH v3 1/1 support/kconfig: Bump to kconfig from Linux 4.17-rc2

Hello,

Quoted 4 lines · Petr Vorel

Sure :). v2 build all code no matter whether it was actually needed. E.g. 'make menuconfig' built gconf (gtk) or qconf (qt). That's a bug you pointed out in [1]. I fixed it in v3. It was caused by removing ifeq clauses. Here is the diff v2 vs. v3:

Aah, OK. Much clearer explanation, thanks!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

RFC PATCH v3 1/1 support/kconfig: Bump to kconfig from Linux 4.17-rc2

In reply to Petr Vorel

Hello,

Quoted 6 lines · Petr Vorel

---
Changes v2->v3:
* Fix issues with building more that we need (menuconfig require unfortunately "make menuconfig" fails, because
it wants ? reported by Thomas in [1]).

You forgot to "git add" the kconf_id.c file, so it was missing from the patch. I've re-added it from the 4.17-rc2 Linux kernel source code, and that fixed the problem, I was able to test menuconfig/nconfig/xconfig/savedefconfig.

Applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com