summaryrefslogtreecommitdiffstats
path: root/package/config/patches/09-implement-kconfig-probability.patch
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2010-09-02 17:08:11 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2010-09-02 17:08:11 +0200
commite62ed84b19d114870daf1f16aae177f60f9d6ad3 (patch)
tree9b3471d639525410bd65e36c5e5aa94b77c29a28 /package/config/patches/09-implement-kconfig-probability.patch
parent9bc12b85e83266c83f1fee0b9dd2d38e43d9252c (diff)
parent40177240fab04c710fd756a24816b451b37dc1b8 (diff)
downloadbuildroot-novena-e62ed84b19d114870daf1f16aae177f60f9d6ad3.tar.gz
buildroot-novena-e62ed84b19d114870daf1f16aae177f60f9d6ad3.zip
Merge branch 'for-2010.11/kconfig-upgrade' of git://git.busybox.net/~tpetazzoni/git/buildroot
Diffstat (limited to 'package/config/patches/09-implement-kconfig-probability.patch')
-rw-r--r--package/config/patches/09-implement-kconfig-probability.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/package/config/patches/09-implement-kconfig-probability.patch b/package/config/patches/09-implement-kconfig-probability.patch
new file mode 100644
index 000000000..7561fbc3c
--- /dev/null
+++ b/package/config/patches/09-implement-kconfig-probability.patch
@@ -0,0 +1,44 @@
+---
+ confdata.c | 22 +++++++++++++++++++---
+ 1 file changed, 19 insertions(+), 3 deletions(-)
+
+Index: config/confdata.c
+===================================================================
+--- config.orig/confdata.c
++++ config/confdata.c
+@@ -977,7 +977,16 @@
+ void conf_set_all_new_symbols(enum conf_def_mode mode)
+ {
+ struct symbol *sym, *csym;
+- int i, cnt;
++ int i, cnt, prob = 50;
++
++ if (mode == def_random) {
++ char *endp, *env = getenv("KCONFIG_PROBABILITY");
++ if (env && *env) {
++ int tmp = (int)strtol(env, &endp, 10);
++ if (*endp == '\0' && tmp >= 0 && tmp <= 100)
++ prob = tmp;
++ }
++ }
+
+ for_all_symbols(i, sym) {
+ if (sym_has_value(sym))
+@@ -996,8 +1005,15 @@
+ sym->def[S_DEF_USER].tri = no;
+ break;
+ case def_random:
+- cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
+- sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
++ cnt = (rand() % 100) - (100 - prob);
++ if (cnt < 0)
++ sym->def[S_DEF_USER].tri = no;
++ else
++ if ((sym_get_type(sym) == S_TRISTATE)
++ && (cnt > prob/2))
++ sym->def[S_DEF_USER].tri = mod;
++ else
++ sym->def[S_DEF_USER].tri = yes;
+ break;
+ default:
+ continue;