kumquat-buildroot/package/config/patches/09-implement-kconfig-probability.patch
Thomas Petazzoni 52a142a631 Bump package/config to 2.6.36-rc1
The goal is to be able to use savedefconfig to generate minimal
defconfig files.

Four of our patches are removed since the modifications have been
merged upstream. The new nconf configuration utility has appeared.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-09-01 12:26:49 +02:00

45 lines
1.1 KiB
Diff

---
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;