aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 10:58:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 10:58:05 -0400
commit685e56d2943bb8bf3b641d85b1b6c69d24f7965f (patch)
tree7f3ed2dbd080264ac228c913f528e08aa14a9c97 /scripts
parent57c29bd3cdf1f82a7ba79ea227638b14f607247c (diff)
parent21ca352b71ca252e1933b1538fe89da8a04395c3 (diff)
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig updates from Michal Marek: - use pkg-config to detect curses libraries - clean up the way curses headers are searched - Some randconfig fixes, of which one had to be reverted - KCONFIG_SEED for randconfig debugging - memuconfig memory leak plugged - menuconfig > breadcrumbs > navigation - xconfig compilation fix - Other minor fixes * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kconfig: fix lists definition for C++ Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG" kconfig: implement KCONFIG_PROBABILITY for randconfig kconfig: allow specifying the seed for randconfig kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG kconfig: do not override symbols already set kconfig: fix randconfig tristate detection kconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h menuconfig: Add "breadcrumbs" navigation aid menuconfig: Fix memory leak introduced by jump keys feature merge_config.sh: Avoid creating unnessary source softlinks kconfig: optionally use pkg-config to detect ncurses libs menuconfig: optionally use pkg-config to detect ncurses libs
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile4
-rw-r--r--scripts/kconfig/conf.c12
-rw-r--r--scripts/kconfig/confdata.c59
-rw-r--r--scripts/kconfig/list.h40
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh6
-rw-r--r--scripts/kconfig/lxdialog/dialog.h7
-rw-r--r--scripts/kconfig/lxdialog/util.c45
-rw-r--r--scripts/kconfig/mconf.c74
-rwxr-xr-xscripts/kconfig/merge_config.sh10
9 files changed, 245 insertions, 12 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 231b4759c714..844bc9da08da 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -219,7 +219,9 @@ HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
219 219
220HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 220HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
221 221
222HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses 222HOSTLOADLIBES_nconf = $(shell \
223 pkg-config --libs menu panel ncurses 2>/dev/null \
224 || echo "-lmenu -lpanel -lncurses" )
223$(obj)/qconf.o: $(obj)/.tmp_qtcheck 225$(obj)/qconf.o: $(obj)/.tmp_qtcheck
224 226
225ifeq ($(qconf-target),1) 227ifeq ($(qconf-target),1)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index e39fcd8143ea..bde5b95c8c19 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -13,6 +13,7 @@
13#include <getopt.h> 13#include <getopt.h>
14#include <sys/stat.h> 14#include <sys/stat.h>
15#include <sys/time.h> 15#include <sys/time.h>
16#include <errno.h>
16 17
17#include "lkc.h" 18#include "lkc.h"
18 19
@@ -514,14 +515,23 @@ int main(int ac, char **av)
514 { 515 {
515 struct timeval now; 516 struct timeval now;
516 unsigned int seed; 517 unsigned int seed;
518 char *seed_env;
517 519
518 /* 520 /*
519 * Use microseconds derived seed, 521 * Use microseconds derived seed,
520 * compensate for systems where it may be zero 522 * compensate for systems where it may be zero
521 */ 523 */
522 gettimeofday(&now, NULL); 524 gettimeofday(&now, NULL);
523
524 seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); 525 seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
526
527 seed_env = getenv("KCONFIG_SEED");
528 if( seed_env && *seed_env ) {
529 char *endp;
530 int tmp = (int)strtol(seed_env, &endp, 10);
531 if (*endp == '\0') {
532 seed = tmp;
533 }
534 }
525 srand(seed); 535 srand(seed);
526 break; 536 break;
527 } 537 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 13ddf1126c2a..43eda40c3838 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1106,10 +1106,54 @@ static void set_all_choice_values(struct symbol *csym)
1106void conf_set_all_new_symbols(enum conf_def_mode mode) 1106void conf_set_all_new_symbols(enum conf_def_mode mode)
1107{ 1107{
1108 struct symbol *sym, *csym; 1108 struct symbol *sym, *csym;
1109 int i, cnt; 1109 int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y
1110 * pty: probability of tristate = y
1111 * ptm: probability of tristate = m
1112 */
1113
1114 pby = 50; pty = ptm = 33; /* can't go as the default in switch-case
1115 * below, otherwise gcc whines about
1116 * -Wmaybe-uninitialized */
1117 if (mode == def_random) {
1118 int n, p[3];
1119 char *env = getenv("KCONFIG_PROBABILITY");
1120 n = 0;
1121 while( env && *env ) {
1122 char *endp;
1123 int tmp = strtol( env, &endp, 10 );
1124 if( tmp >= 0 && tmp <= 100 ) {
1125 p[n++] = tmp;
1126 } else {
1127 errno = ERANGE;
1128 perror( "KCONFIG_PROBABILITY" );
1129 exit( 1 );
1130 }
1131 env = (*endp == ':') ? endp+1 : endp;
1132 if( n >=3 ) {
1133 break;
1134 }
1135 }
1136 switch( n ) {
1137 case 1:
1138 pby = p[0]; ptm = pby/2; pty = pby-ptm;
1139 break;
1140 case 2:
1141 pty = p[0]; ptm = p[1]; pby = pty + ptm;
1142 break;
1143 case 3:
1144 pby = p[0]; pty = p[1]; ptm = p[2];
1145 break;
1146 }
1147
1148 if( pty+ptm > 100 ) {
1149 errno = ERANGE;
1150 perror( "KCONFIG_PROBABILITY" );
1151 exit( 1 );
1152 }
1153 }
1110 1154
1111 for_all_symbols(i, sym) { 1155 for_all_symbols(i, sym) {
1112 if (sym_has_value(sym)) 1156 if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
1113 continue; 1157 continue;
1114 switch (sym_get_type(sym)) { 1158 switch (sym_get_type(sym)) {
1115 case S_BOOLEAN: 1159 case S_BOOLEAN:
@@ -1125,8 +1169,15 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
1125 sym->def[S_DEF_USER].tri = no; 1169 sym->def[S_DEF_USER].tri = no;
1126 break; 1170 break;
1127 case def_random: 1171 case def_random:
1128 cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2; 1172 sym->def[S_DEF_USER].tri = no;
1129 sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt); 1173 cnt = rand() % 100;
1174 if (sym->type == S_TRISTATE) {
1175 if (cnt < pty)
1176 sym->def[S_DEF_USER].tri = yes;
1177 else if (cnt < (pty+ptm))
1178 sym->def[S_DEF_USER].tri = mod;
1179 } else if (cnt < pby)
1180 sym->def[S_DEF_USER].tri = yes;
1130 break; 1181 break;
1131 default: 1182 default:
1132 continue; 1183 continue;
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
index 0ae730be5f49..685d80e1bb0e 100644
--- a/scripts/kconfig/list.h
+++ b/scripts/kconfig/list.h
@@ -51,6 +51,19 @@ struct list_head {
51 pos = list_entry(pos->member.next, typeof(*pos), member)) 51 pos = list_entry(pos->member.next, typeof(*pos), member))
52 52
53/** 53/**
54 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
55 * @pos: the type * to use as a loop cursor.
56 * @n: another type * to use as temporary storage
57 * @head: the head for your list.
58 * @member: the name of the list_struct within the struct.
59 */
60#define list_for_each_entry_safe(pos, n, head, member) \
61 for (pos = list_entry((head)->next, typeof(*pos), member), \
62 n = list_entry(pos->member.next, typeof(*pos), member); \
63 &pos->member != (head); \
64 pos = n, n = list_entry(n->member.next, typeof(*n), member))
65
66/**
54 * list_empty - tests whether a list is empty 67 * list_empty - tests whether a list is empty
55 * @head: the list to test. 68 * @head: the list to test.
56 */ 69 */
@@ -88,4 +101,31 @@ static inline void list_add_tail(struct list_head *_new, struct list_head *head)
88 __list_add(_new, head->prev, head); 101 __list_add(_new, head->prev, head);
89} 102}
90 103
104/*
105 * Delete a list entry by making the prev/next entries