aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-16 17:35:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-16 17:35:34 -0500
commit287b901dcadd7eb3c5aa93b679bbad4058814921 (patch)
treef7fd50888b456b559ef58892b33f2f263a49a0a6 /scripts/kconfig
parentc63dbbd5268c397f051e0e0f665799ef64a1f3a4 (diff)
parent30c4eaafac80cc110efa66d2dfc551386eefdf53 (diff)
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: menuconfig: fix a regression when canceling the prompt dialog at exit kbuild: Fix compiler warning with assertion when calling 'fwrite' Improve update-po-config output menuconfig: let make not report error when not save configuration merge_config.sh: fix bug in final check merge_config.sh: whitespace cleanup merge_config.sh: use signal names compatible with dash and bash kconfig: add merge_config.sh script kconfig: use xfwrite wrapper function to silence warnings kconfig: fix set but not used warnings kconfig: fix warnings by specifing format arguments
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/Makefile6
-rw-r--r--scripts/kconfig/confdata.c4
-rw-r--r--scripts/kconfig/expr.h1
-rw-r--r--scripts/kconfig/gconf.c11
-rw-r--r--scripts/kconfig/lkc.h6
-rw-r--r--scripts/kconfig/mconf.c2
-rw-r--r--scripts/kconfig/merge_config.sh117
7 files changed, 133 insertions, 14 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 914833d99b06..79662658fb91 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -50,9 +50,8 @@ localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
50 50
51# Create new linux.pot file 51# Create new linux.pot file
52# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 52# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
53# The symlink is used to repair a deficiency in arch/um
54update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h 53update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
55 $(Q)echo " GEN config" 54 $(Q)echo " GEN config.pot"
56 $(Q)xgettext --default-domain=linux \ 55 $(Q)xgettext --default-domain=linux \
57 --add-comments --keyword=_ --keyword=N_ \ 56 --add-comments --keyword=_ --keyword=N_ \
58 --from-code=UTF-8 \ 57 --from-code=UTF-8 \
@@ -63,10 +62,11 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
63 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ 62 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
64 $(srctree)/arch/*/um/Kconfig`; \ 63 $(srctree)/arch/*/um/Kconfig`; \
65 do \ 64 do \
66 echo " GEN $$i"; \ 65 echo " GEN $$i"; \
67 $(obj)/kxgettext $$i \ 66 $(obj)/kxgettext $$i \
68 >> $(obj)/config.pot; \ 67 >> $(obj)/config.pot; \
69 done ) 68 done )
69 $(Q)echo " GEN linux.pot"
70 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 70 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
71 --output $(obj)/linux.pot 71 --output $(obj)/linux.pot
72 $(Q)rm -f $(obj)/config.pot 72 $(Q)rm -f $(obj)/config.pot
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 5a58965d8800..7c7a5a6cc3f5 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -464,7 +464,7 @@ kconfig_print_comment(FILE *fp, const char *value, void *arg)
464 fprintf(fp, "#"); 464 fprintf(fp, "#");
465 if (l) { 465 if (l) {
466 fprintf(fp, " "); 466 fprintf(fp, " ");
467 fwrite(p, l, 1, fp); 467 xfwrite(p, l, 1, fp);
468 p += l; 468 p += l;
469 } 469 }
470 fprintf(fp, "\n"); 470 fprintf(fp, "\n");
@@ -537,7 +537,7 @@ header_print_comment(FILE *fp, const char *value, void *arg)
537 fprintf(fp, " *"); 537 fprintf(fp, " *");
538 if (l) { 538 if (l) {
539 fprintf(fp, " "); 539 fprintf(fp, " ");
540 fwrite(p, l, 1, fp); 540 xfwrite(p, l, 1, fp);
541 p += l; 541 p += l;
542 } 542 }
543 fprintf(fp, "\n"); 543 fprintf(fp, "\n");
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 80fce57080cc..d4ecce8bc3a6 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -10,6 +10,7 @@
10extern "C" { 10extern "C" {
11#endif 11#endif
12 12
13#include <assert.h>
13#include <stdio.h> 14#include <stdio.h>
14#ifndef __cplusplus 15#ifndef __cplusplus
15#include <stdbool.h> 16#include <stdbool.h>
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 9f4438027df4..adc230638c5b 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -683,7 +683,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
683 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 683 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
684 GTK_DIALOG_DESTROY_WITH_PARENT, 684 GTK_DIALOG_DESTROY_WITH_PARENT,
685 GTK_MESSAGE_INFO, 685 GTK_MESSAGE_INFO,
686 GTK_BUTTONS_CLOSE, intro_text); 686 GTK_BUTTONS_CLOSE, "%s", intro_text);
687 g_signal_connect_swapped(GTK_OBJECT(dialog), "response", 687 g_signal_connect_swapped(GTK_OBJECT(dialog), "response",
688 G_CALLBACK(gtk_widget_destroy), 688 G_CALLBACK(gtk_widget_destroy),
689 GTK_OBJECT(dialog)); 689 GTK_OBJECT(dialog));
@@ -701,7 +701,7 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
701 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 701 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
702 GTK_DIALOG_DESTROY_WITH_PARENT, 702 GTK_DIALOG_DESTROY_WITH_PARENT,
703 GTK_MESSAGE_INFO, 703 GTK_MESSAGE_INFO,
704 GTK_BUTTONS_CLOSE, about_text); 704 GTK_BUTTONS_CLOSE, "%s", about_text);
705 g_signal_connect_swapped(GTK_OBJECT(dialog), "response", 705 g_signal_connect_swapped(GTK_OBJECT(dialog), "response",
706 G_CALLBACK(gtk_widget_destroy), 706 G_CALLBACK(gtk_widget_destroy),
707 GTK_OBJECT(dialog)); 707 GTK_OBJECT(dialog));
@@ -720,7 +720,7 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
720 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 720 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
721 GTK_DIALOG_DESTROY_WITH_PARENT, 721 GTK_DIALOG_DESTROY_WITH_PARENT,
722 GTK_MESSAGE_INFO, 722 GTK_MESSAGE_INFO,
723 GTK_BUTTONS_CLOSE, license_text); 723 GTK_BUTTONS_CLOSE, "%s", license_text);
724 g_signal_connect_swapped(GTK_OBJECT(dialog), "response", 724 g_signal_connect_swapped(GTK_OBJECT(dialog), "response",
725 G_CALLBACK(gtk_widget_destroy), 725 G_CALLBACK(gtk_widget_destroy),
726 GTK_OBJECT(dialog)); 726 GTK_OBJECT(dialog));
@@ -830,7 +830,7 @@ static void renderer_edited(GtkCellRendererText * cell,
830static void change_sym_value(struct menu *menu, gint col) 830static void change_sym_value(struct menu *menu, gint col)
831{ 831{
832 struct symbol *sym = menu->sym; 832 struct symbol *sym = menu->sym;
833 tristate oldval, newval; 833 tristate newval;
834 834
835 if (!sym) 835 if (!sym)
836 return; 836 return;
@@ -847,7 +847,6 @@ static void change_sym_value(struct menu *menu, gint col)
847 switch (sym_get_type(sym)) { 847 switch (sym_get_type(sym)) {
848 case S_BOOLEAN: 848 case S_BOOLEAN:
849 case S_TRISTATE: 849 case S_TRISTATE:
850 oldval = sym_get_tristate_value(sym);
851 if (!sym_tristate_within_range(sym, newval)) 850 if (!sym_tristate_within_range(sym, newval))
852 newval = yes; 851 newval = yes;
853 sym_set_tristate_value(sym, newval); 852 sym_set_tristate_value(sym, newval);
@@ -1278,7 +1277,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
1278 gboolean valid; 1277 gboolean valid;
1279 GtkTreeIter *sibling; 1278 GtkTreeIter *sibling;
1280 struct symbol *sym; 1279 struct symbol *sym;
1281 struct property *prop;
1282 struct menu *menu1, *menu2; 1280 struct menu *menu1, *menu2;
1283 1281
1284 if (src == &rootmenu) 1282 if (src == &rootmenu)
@@ -1287,7 +1285,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
1287 valid = gtk_tree_model_iter_children(model2, child2, dst); 1285 valid = gtk_tree_model_iter_children(model2, child2, dst);
1288 for (child1 = src->list; child1; child1 = child1->next) { 1286 for (child1 = src->list; child1; child1 = child1->next) {
1289 1287
1290 prop = child1->prompt;
1291 sym = child1->sym; 1288 sym = child1->sym;
1292 1289
1293 reparse: 1290 reparse:
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index b633bdb9f3d4..c18f2bd9c095 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -90,8 +90,10 @@ struct conf_printer {
90/* confdata.c and expr.c */ 90/* confdata.c and expr.c */
91static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) 91static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
92{ 92{
93 if (fwrite(str, len, count, out) < count) 93 assert(len != 0);
94 fprintf(stderr, "\nError in writing or end of file.\n"); 94
95 if (fwrite(str, len, count, out) != count)
96 fprintf(stderr, "Error in writing or end of file.\n");
95} 97}
96 98
97/* menu.c */ 99/* menu.c */
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 19e200d91120..2c6286c0bc1a 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -830,6 +830,8 @@ static int handle_exit(void)
830 fprintf(stderr, _("\n\n" 830 fprintf(stderr, _("\n\n"
831 "Your configuration changes were NOT saved." 831 "Your configuration changes were NOT saved."
832 "\n\n")); 832 "\n\n"));
833 if (res != KEY_ESC)
834 res = 0;
833 } 835 }
834 836
835 return res; 837 return res;
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
new file mode 100644
index 000000000000..ceadf0e150cf
--- /dev/null
+++ b/scripts/kconfig/merge_config.sh
@@ -0,0 +1,117 @@
1#!/bin/sh
2# merge_config.sh - Takes a list of config fragment values, and merges
3# them one by one. Provides warnings on overridden values, and specified
4# values that did not make it to the resulting .config file (due to missed
5# dependencies or config symbol removal).
6#
7# Portions reused from kconf_check and generate_cfg:
8# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check
9# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg
10#
11# Copyright (c) 2009-2010 Wind River Systems, Inc.
12# Copyright 2011 Linaro
13#
14# This program is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License version 2 as
16# published by the Free Software Foundation.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21# See the GNU General Public License for more details.
22
23clean_up() {
24 rm -f $TMP_FILE
25 exit
26}
27trap clean_up HUP INT TERM
28
29usage() {
30 echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
31 echo " -h display this help text"
32 echo " -m only merge the fragments, do not execute the make command"
33 echo " -n use allnoconfig instead of alldefconfig"
34}
35
36MAKE=true
37ALLTARGET=alldefconfig
38
39while true; do
40 case $1 in
41 "-n")
42 ALLTARGET=allnoconfig
43 shift
44 continue
45 ;;
46 "-m")
47 MAKE=false
48 shift
49 continue
50 ;;
51 "-h")
52 usage
53 exit
54 ;;
55 *)
56 break
57 ;;
58 esac
59done
60
61
62
63MERGE_LIST=$*
64SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
65TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
66
67# Merge files, printing warnings on overrided values
68for MERGE_FILE in $MERGE_LIST ; do
69 echo "Merging $MERGE_FILE"
70 CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
71
72 for CFG in $CFG_LIST ; do
73 grep -q -w $CFG $TMP_FILE
74 if [ $? -eq 0 ] ; then
75 PREV_VAL=$(grep -w $CFG $TMP_FILE)
76 NEW_VAL=$(grep -w $CFG $MERGE_FILE)
77 if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
78 echo Value of $CFG is redefined by fragment $MERGE_FILE:
79 echo Previous value: $PREV_VAL
80 echo New value: $NEW_VAL
81 echo
82 fi
83 sed -i "/$CFG[ =]/d" $TMP_FILE
84 fi
85 done
86 cat $MERGE_FILE >> $TMP_FILE
87done
88
89if [ "$MAKE" = "false" ]; then
90 cp $TMP_FILE .config
91 echo "#"
92 echo "# merged configuration written to .config (needs make)"
93 echo "#"
94 clean_up
95 exit
96fi
97
98# Use the merged file as the starting point for:
99# alldefconfig: Fills in any missing symbols with Kconfig default
100# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
101make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET
102
103
104# Check all specified config values took (might have missed-dependency issues)
105for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
106
107 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
108 ACTUAL_VAL=$(grep -w -e "$CFG" .config)
109 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
110 echo "Value requested for $CFG not in final .config"
111 echo "Requested value: $REQUESTED_VAL"
112 echo "Actual value: $ACTUAL_VAL"
113 echo ""
114 fi
115done
116
117clean_up