kumquat-buildroot/support/kconfig/patches/09-implement-kconfig-probability.patch
Yann E. MORIN b58bf60b51 support/kconfig: use kconfig-provided way of setting the CONFIG_ prefix
It's now been a while since it has been possible to build the kconfig
parser to understand a prefix other than CONFIG_, and even no prefix
at all, by setting the CONFIG_ macro (#define) at biuld time.

Just use that, insted of patching, it will make it easier for us in the
future.

Our patches have been refreshed at the same time.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-04-21 23:33:11 +02:00

45 lines
1.1 KiB
Diff

---
confdata.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
Index: b/confdata.c
===================================================================
--- a/confdata.c
+++ b/confdata.c
@@ -1106,7 +1106,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))
@@ -1125,8 +1134,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;