From 56da3859c770b83631ebae810dfb3024c1a9cbd2 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 31 Aug 2011 23:35:05 +0200 Subject: support: move kconfig stuff from package/config to support/kconfig Signed-off-by: Thomas Petazzoni Signed-off-by: Peter Korsgaard --- .../patches/01-kconfig-kernel-to-buildroot.patch | 62 +++++++ .../patches/02-cpp-comments-to-c-comments.patch | 178 ++++++++++++++++++ .../patches/03-change-config-option-prefix.patch | 198 ++++++++++++++++++++ .../patches/05-really-clean-everything.patch | 29 +++ .../patches/06-br-build-system-integration.patch | 40 +++++ support/kconfig/patches/08-make-write-deps.patch | 139 ++++++++++++++ .../patches/09-implement-kconfig-probability.patch | 44 +++++ support/kconfig/patches/10-br-build-system.patch | 80 +++++++++ .../patches/11-use-mktemp-for-lxdialog.patch | 17 ++ .../kconfig/patches/12-fix-glade-file-path.patch | 17 ++ .../patches/14-support-out-of-tree-config.patch | 199 +++++++++++++++++++++ support/kconfig/patches/series | 11 ++ 12 files changed, 1014 insertions(+) create mode 100644 support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch create mode 100644 support/kconfig/patches/02-cpp-comments-to-c-comments.patch create mode 100644 support/kconfig/patches/03-change-config-option-prefix.patch create mode 100644 support/kconfig/patches/05-really-clean-everything.patch create mode 100644 support/kconfig/patches/06-br-build-system-integration.patch create mode 100644 support/kconfig/patches/08-make-write-deps.patch create mode 100644 support/kconfig/patches/09-implement-kconfig-probability.patch create mode 100644 support/kconfig/patches/10-br-build-system.patch create mode 100644 support/kconfig/patches/11-use-mktemp-for-lxdialog.patch create mode 100644 support/kconfig/patches/12-fix-glade-file-path.patch create mode 100644 support/kconfig/patches/14-support-out-of-tree-config.patch create mode 100644 support/kconfig/patches/series (limited to 'support/kconfig/patches') diff --git a/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch b/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch new file mode 100644 index 000000000..ef3a05e43 --- /dev/null +++ b/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch @@ -0,0 +1,62 @@ +--- + gconf.glade | 2 +- + mconf.c | 4 ++-- + zconf.tab.c_shipped | 2 +- + zconf.y | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) + +Index: config/gconf.glade +=================================================================== +--- config.orig/gconf.glade ++++ config/gconf.glade +@@ -4,7 +4,7 @@ + + + True +- Gtk Kernel Configurator ++ Gtk Buildroot Configurator + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False +Index: config/mconf.c +=================================================================== +--- config.orig/mconf.c ++++ config/mconf.c +@@ -178,9 +178,9 @@ + "Arrow keys navigate the menu. " + " selects submenus --->. " + "Highlighted letters are hotkeys. " +- "Pressing includes, excludes, modularizes features. " ++ "Pressing selectes a feature, while will exclude a feature. " + "Press to exit, for Help, for Search. " +- "Legend: [*] built-in [ ] excluded module < > module capable"), ++ "Legend: [*] feature is selected [ ] feature is excluded"), + radiolist_instructions[] = N_( + "Use the arrow keys to navigate this window or " + "press the hotkey of the item you wish to select " +Index: config/zconf.tab.c_shipped +=================================================================== +--- config.orig/zconf.tab.c_shipped ++++ config/zconf.tab.c_shipped +@@ -2256,7 +2256,7 @@ + modules_sym = sym_lookup(NULL, 0); + modules_sym->type = S_BOOLEAN; + modules_sym->flags |= SYMBOL_AUTO; +- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); ++ rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL); + + #if YYDEBUG + if (getenv("ZCONF_DEBUG")) +Index: config/zconf.y +=================================================================== +--- config.orig/zconf.y ++++ config/zconf.y +@@ -501,7 +501,7 @@ + modules_sym = sym_lookup(NULL, 0); + modules_sym->type = S_BOOLEAN; + modules_sym->flags |= SYMBOL_AUTO; +- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); ++ rootmenu.prompt = menu_add_prompt(P_MENU, "Buildroot Configuration", NULL); + + #if YYDEBUG + if (getenv("ZCONF_DEBUG")) diff --git a/support/kconfig/patches/02-cpp-comments-to-c-comments.patch b/support/kconfig/patches/02-cpp-comments-to-c-comments.patch new file mode 100644 index 000000000..cb27056ad --- /dev/null +++ b/support/kconfig/patches/02-cpp-comments-to-c-comments.patch @@ -0,0 +1,178 @@ +--- + expr.c | 42 +++++++++++++++++++++--------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +Index: config/expr.c +=================================================================== +--- config.orig/expr.c ++++ config/expr.c +@@ -331,7 +331,7 @@ + e->right.expr = expr_trans_bool(e->right.expr); + break; + case E_UNEQUAL: +- // FOO!=n -> FOO ++ /* FOO!=n -> FOO */ + if (e->left.sym->type == S_TRISTATE) { + if (e->right.sym == &symbol_no) { + e->type = E_SYMBOL; +@@ -380,19 +380,19 @@ + if (e1->type == E_EQUAL && e2->type == E_EQUAL && + ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || + (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { +- // (a='y') || (a='m') -> (a!='n') ++ /* (a='y') || (a='m') -> (a!='n') */ + return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no); + } + if (e1->type == E_EQUAL && e2->type == E_EQUAL && + ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || + (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { +- // (a='y') || (a='n') -> (a!='m') ++ /* (a='y') || (a='n') -> (a!='m') */ + return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod); + } + if (e1->type == E_EQUAL && e2->type == E_EQUAL && + ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || + (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { +- // (a='m') || (a='n') -> (a!='y') ++ /* (a='m') || (a='n') -> (a!='y') */ + return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes); + } + } +@@ -443,29 +443,29 @@ + + if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || + (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) +- // (a) && (a='y') -> (a='y') ++ /* (a) && (a='y') -> (a='y') */ + return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); + + if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || + (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) +- // (a) && (a!='n') -> (a) ++ /* (a) && (a!='n') -> (a) */ + return expr_alloc_symbol(sym1); + + if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || + (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) +- // (a) && (a!='m') -> (a='y') ++ /* (a) && (a!='m') -> (a='y') */ + return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); + + if (sym1->type == S_TRISTATE) { + if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { +- // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' ++ /* (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' */ + sym2 = e1->right.sym; + if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) + return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) + : expr_alloc_symbol(&symbol_no); + } + if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { +- // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' ++ /* (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' */ + sym2 = e2->right.sym; + if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) + return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) +@@ -474,19 +474,19 @@ + if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && + ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || + (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) +- // (a!='y') && (a!='n') -> (a='m') ++ /* (a!='y') && (a!='n') -> (a='m') */ + return expr_alloc_comp(E_EQUAL, sym1, &symbol_mod); + + if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && + ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || + (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) +- // (a!='y') && (a!='m') -> (a='n') ++ /* (a!='y') && (a!='m') -> (a='n') */ + return expr_alloc_comp(E_EQUAL, sym1, &symbol_no); + + if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && + ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || + (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) +- // (a!='m') && (a!='n') -> (a='m') ++ /* (a!='m') && (a!='n') -> (a='m') */ + return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); + + if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || +@@ -579,7 +579,7 @@ + switch (e1->type) { + case E_OR: + expr_eliminate_dups2(e1->type, &e1, &e1); +- // (FOO || BAR) && (!FOO && !BAR) -> n ++ /* (FOO || BAR) && (!FOO && !BAR) -> n */ + tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); + tmp2 = expr_copy(e2); + tmp = expr_extract_eq_and(&tmp1, &tmp2); +@@ -594,7 +594,7 @@ + break; + case E_AND: + expr_eliminate_dups2(e1->type, &e1, &e1); +- // (FOO && BAR) || (!FOO || !BAR) -> y ++ /* (FOO && BAR) || (!FOO || !BAR) -> y */ + tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); + tmp2 = expr_copy(e2); + tmp = expr_extract_eq_or(&tmp1, &tmp2); +@@ -703,7 +703,7 @@ + case E_NOT: + switch (e->left.expr->type) { + case E_NOT: +- // !!a -> a ++ /* !!a -> a */ + tmp = e->left.expr->left.expr; + free(e->left.expr); + free(e); +@@ -712,14 +712,14 @@ + break; + case E_EQUAL: + case E_UNEQUAL: +- // !a='x' -> a!='x' ++ /* !a='x' -> a!='x' */ + tmp = e->left.expr; + free(e); + e = tmp; + e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; + break; + case E_OR: +- // !(a || b) -> !a && !b ++ /* !(a || b) -> !a && !b */ + tmp = e->left.expr; + e->type = E_AND; + e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); +@@ -728,7 +728,7 @@ + e = expr_transform(e); + break; + case E_AND: +- // !(a && b) -> !a || !b ++ /* !(a && b) -> !a || !b */ + tmp = e->left.expr; + e->type = E_OR; + e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); +@@ -738,7 +738,7 @@ + break; + case E_SYMBOL: + if (e->left.expr->left.sym == &symbol_yes) { +- // !'y' -> 'n' ++ /* !'y' -> 'n' */ + tmp = e->left.expr; + free(e); + e = tmp; +@@ -747,7 +747,7 @@ + break; + } + if (e->left.expr->left.sym == &symbol_mod) { +- // !'m' -> 'm' ++ /* !'m' -> 'm' */ + tmp = e->left.expr; + free(e); + e = tmp; +@@ -756,7 +756,7 @@ + break; + } + if (e->left.expr->left.sym == &symbol_no) { +- // !'n' -> 'y' ++ /* !'n' -> 'y' */ + tmp = e->left.expr; + free(e); + e = tmp; diff --git a/support/kconfig/patches/03-change-config-option-prefix.patch b/support/kconfig/patches/03-change-config-option-prefix.patch new file mode 100644 index 000000000..d387236e7 --- /dev/null +++ b/support/kconfig/patches/03-change-config-option-prefix.patch @@ -0,0 +1,198 @@ +--- + confdata.c | 57 +++++++++++++++++++++++++++++---------------------------- + lkc.h | 2 +- + menu.c | 2 +- + 3 files changed, 31 insertions(+), 30 deletions(-) + +Index: config/confdata.c +=================================================================== +--- config.orig/confdata.c ++++ config/confdata.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #define LKC_DIRECT_LINK + #include "lkc.h" +@@ -25,7 +26,7 @@ + static const char *conf_filename; + static int conf_lineno, conf_warnings, conf_unsaved; + +-const char conf_defname[] = "arch/$ARCH/defconfig"; ++const char conf_defname[] = ".defconfig"; + + static void conf_warning(const char *fmt, ...) + { +@@ -63,7 +64,7 @@ + + const char *conf_get_configname(void) + { +- char *name = getenv("KCONFIG_CONFIG"); ++ char *name = getenv("BUILDROOT_CONFIG"); + + return name ? name : ".config"; + } +@@ -249,20 +250,20 @@ + if (line[0] == '#') { + if (memcmp(line + 2, CONFIG_, strlen(CONFIG_))) + continue; +- p = strchr(line + 2 + strlen(CONFIG_), ' '); ++ p = strchr(line + 2, ' '); + if (!p) + continue; + *p++ = 0; + if (strncmp(p, "is not set", 10)) + continue; + if (def == S_DEF_USER) { +- sym = sym_find(line + 2 + strlen(CONFIG_)); ++ sym = sym_find(line + 2); + if (!sym) { + sym_add_change_count(1); + goto setsym; + } + } else { +- sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); ++ sym = sym_lookup(line + 2, 0); + if (sym->type == S_UNKNOWN) + sym->type = S_BOOLEAN; + } +@@ -278,8 +279,8 @@ + default: + ; + } +- } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) { +- p = strchr(line + strlen(CONFIG_), '='); ++ } else if (isupper(line[0])) { ++ p = strchr(line, '='); + if (!p) + continue; + *p++ = 0; +@@ -290,13 +291,13 @@ + *p2 = 0; + } + if (def == S_DEF_USER) { +- sym = sym_find(line + strlen(CONFIG_)); ++ sym = sym_find(line); + if (!sym) { + sym_add_change_count(1); + goto setsym; + } + } else { +- sym = sym_lookup(line + strlen(CONFIG_), 0); ++ sym = sym_lookup(line, 0); + if (sym->type == S_UNKNOWN) + sym->type = S_OTHER; + } +@@ -423,9 +424,9 @@ + { + int l; + if (headerfile) +- fprintf(out, "#define %s%s \"", CONFIG_, name); ++ fprintf(out, "#define %s \"", name); + else +- fprintf(out, "%s%s=\"", CONFIG_, name); ++ fprintf(out, "%s=\"", name); + + while (1) { + l = strcspn(str, "\"\\"); +@@ -450,14 +451,14 @@ + switch (sym_get_tristate_value(sym)) { + case no: + if (write_no) +- fprintf(out, "# %s%s is not set\n", +- CONFIG_, sym->name); ++ fprintf(out, "# %s is not set\n", ++ sym->name); + break; + case mod: +- fprintf(out, "%s%s=m\n", CONFIG_, sym->name); ++ fprintf(out, "%s=m\n", sym->name); + break; + case yes: +- fprintf(out, "%s%s=y\n", CONFIG_, sym->name); ++ fprintf(out, "%s=y\n", sym->name); + break; + } + break; +@@ -467,7 +468,7 @@ + case S_HEX: + case S_INT: + str = sym_get_string_value(sym); +- fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str); ++ fprintf(out, "%s=%s\n", sym->name, str); + break; + case S_OTHER: + case S_UNKNOWN: +@@ -844,17 +845,17 @@ + case no: + break; + case mod: +- fprintf(tristate, "%s%s=M\n", +- CONFIG_, sym->name); +- fprintf(out_h, "#define %s%s_MODULE 1\n", +- CONFIG_, sym->name); ++ fprintf(tristate, "%s=M\n", ++ sym->name); ++ fprintf(out_h, "#define %s_MODULE 1\n", ++ sym->name); + break; + case yes: + if (sym->type == S_TRISTATE) +- fprintf(tristate,"%s%s=Y\n", +- CONFIG_, sym->name); +- fprintf(out_h, "#define %s%s 1\n", +- CONFIG_, sym->name); ++ fprintf(tristate,"%s=Y\n", ++ sym->name); ++ fprintf(out_h, "#define %s 1\n", ++ sym->name); + break; + } + break; +@@ -864,14 +865,14 @@ + case S_HEX: + str = sym_get_string_value(sym); + if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { +- fprintf(out_h, "#define %s%s 0x%s\n", +- CONFIG_, sym->name, str); ++ fprintf(out_h, "#define %s 0x%s\n", ++ sym->name, str); + break; + } + case S_INT: + str = sym_get_string_value(sym); +- fprintf(out_h, "#define %s%s %s\n", +- CONFIG_, sym->name, str); ++ fprintf(out_h, "#define %s %s\n", ++ sym->name, str); + break; + default: + break; +Index: config/lkc.h +=================================================================== +--- config.orig/lkc.h ++++ config/lkc.h +@@ -42,7 +42,7 @@ + #define N_(text) (text) + + #ifndef CONFIG_ +-#define CONFIG_ "CONFIG_" ++#define CONFIG_ "BR2_" + #endif + + #define TF_COMMAND 0x0001 +Index: config/menu.c +=================================================================== +--- config.orig/menu.c ++++ config/menu.c +@@ -597,7 +597,7 @@ + + if (menu_has_help(menu)) { + if (sym->name) { +- str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); ++ str_printf(help, "%s:\n\n", sym->name); + str_append(help, _(menu_get_help(menu))); + str_append(help, "\n"); + } diff --git a/support/kconfig/patches/05-really-clean-everything.patch b/support/kconfig/patches/05-really-clean-everything.patch new file mode 100644 index 000000000..a1517542e --- /dev/null +++ b/support/kconfig/patches/05-really-clean-everything.patch @@ -0,0 +1,29 @@ +--- + Makefile | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +Index: config/Makefile +=================================================================== +--- config.orig/Makefile ++++ config/Makefile +@@ -196,10 +196,16 @@ + gconf-objs := gconf.o kconfig_load.o zconf.tab.o + endif + +-clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ +- .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h +-clean-files += mconf qconf gconf nconf +-clean-files += config.pot linux.pot ++clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ ++ .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h ++clean-files += config.pot linux.pot ++clean-files += conf $(conf-objs) ++clean-files += mconf $(mconf-objs) ++clean-files += nconf $(nconf-objs) ++clean-files += qconf qconf.o ++clean-files += gconf gconf.o ++clean-files += kconfig_load.o zconf.tab.o ++clean-files += $(kxgettext-objs) + + # Check that we have the required ncurses stuff installed for lxdialog (menuconfig) + PHONY += $(obj)/dochecklxdialog diff --git a/support/kconfig/patches/06-br-build-system-integration.patch b/support/kconfig/patches/06-br-build-system-integration.patch new file mode 100644 index 000000000..8a27e251e --- /dev/null +++ b/support/kconfig/patches/06-br-build-system-integration.patch @@ -0,0 +1,40 @@ +--- + Makefile | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +Index: config/Makefile +=================================================================== +--- config.orig/Makefile ++++ config/Makefile +@@ -174,18 +174,30 @@ + ifeq ($(MAKECMDGOALS),nconfig) + hostprogs-y += nconf + endif ++ifeq ($(findstring nconf,$(MAKECMDGOALS)),nconf) ++ hostprogs-y += nconf ++endif + + ifeq ($(MAKECMDGOALS),menuconfig) + hostprogs-y += mconf + endif ++ifeq ($(findstring mconf,$(MAKECMDGOALS)),mconf) ++ hostprogs-y += mconf ++endif + + ifeq ($(MAKECMDGOALS),xconfig) + qconf-target := 1 + endif ++ifeq ($(findstring qconf,$(MAKECMDGOALS)),qconf) ++ qconf-target := 1 ++endif ++ + ifeq ($(MAKECMDGOALS),gconfig) + gconf-target := 1 + endif +- ++ifeq ($(findstring gconf,$(MAKECMDGOALS)),gconf) ++ gconf-target := 1 ++endif + + ifeq ($(qconf-target),1) + qconf-cxxobjs := qconf.o diff --git a/support/kconfig/patches/08-make-write-deps.patch b/support/kconfig/patches/08-make-write-deps.patch new file mode 100644 index 000000000..e5a21c386 --- /dev/null +++ b/support/kconfig/patches/08-make-write-deps.patch @@ -0,0 +1,139 @@ +--- + util.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 116 insertions(+), 1 deletion(-) + +Index: kconfig/util.c +=================================================================== +--- kconfig.orig/util.c ++++ kconfig/util.c +@@ -29,6 +29,121 @@ + return file; + } + ++static char* br2_symbol_printer(const char * const in) ++{ ++ ssize_t i, j, len = strlen(in); ++ char *ret; ++ if (len < 1) ++ return NULL; ++ ret = malloc(len+1); ++ if (!ret) { ++ printf("Out of memory!"); ++ exit(1); ++ } ++ memset(ret, 0, len+1); ++ i = j = 0; ++ if (strncmp("BR2_", in, 4) == 0) ++ i += 4; ++ if (strncmp("PACKAGE_", in + i, 8) == 0) ++ i += 8; ++ else if (strncmp("TARGET_", in + i, 7) == 0) ++ i += 7; ++ while (i <= len) ++ ret[j++] = tolower(in[i++]); ++ return ret; ++} ++ ++/* write dependencies of the individual config-symbols */ ++static int write_make_deps(const char *name) ++{ ++ char *str; ++ char dir[PATH_MAX+1], buf[PATH_MAX+1], buf2[PATH_MAX+1]; ++ struct menu *menu; ++ struct symbol *sym; ++ struct property *prop, *p; ++ unsigned done; ++ const char * const name_tmp = "..make.deps.tmp"; ++ FILE *out; ++ if (!name) ++ name = ".auto.deps"; ++ ++ strcpy(dir, conf_get_configname()); ++ str = strrchr(dir, '/'); ++ if (str) ++ str[1] = 0; ++ else ++ dir[0] = 0; ++ ++ sprintf(buf, "%s%s", dir, name_tmp); ++ out = fopen(buf, "w"); ++ if (!out) ++ return 1; ++ fprintf(out, "# ATTENTION! This does not handle 'depends', just 'select'! \n" ++ "# See support/kconfig/util.c write_make_deps()\n#\n"); ++ menu = &rootmenu;//rootmenu.list; ++ while (menu) { ++ sym = menu->sym; ++ if (!sym) { ++ if (!menu_is_visible(menu)) ++ goto next; ++ } else if (!(sym->flags & SYMBOL_CHOICE)) { ++ sym_calc_value(sym); ++ if (sym->type == S_BOOLEAN ++ && sym_get_tristate_value(sym) != no) { ++ done = 0; ++ for_all_prompts(sym, prop) { ++ struct expr *e; ++//printf("\nname=%s\n", sym->name); ++ for_all_properties(sym, p, P_SELECT) { ++ e = p->expr; ++ if (e && e->left.sym->name) { ++ if (!done) { ++ fprintf(out, "%s: $(BASE_TARGETS)", br2_symbol_printer(sym->name)); ++ done = 1; ++ } ++//printf("SELECTS %s\n",e->left.sym->name); ++ fprintf(out, " %s",br2_symbol_printer(e->left.sym->name)); ++ } ++ } ++ if (done) ++ fprintf(out, "\n"); ++#if 0 ++ e = sym->rev_dep.expr; ++ if (e && e->type == E_SYMBOL ++ && e->left.sym->name) { ++ fprintf(out, "%s: %s", br2_symbol_printer(e->left.sym->name), ++ br2_symbol_printer(sym->name)); ++printf("%s is Selected BY: %s", sym->name, e->left.sym->name); ++ } ++#endif ++ } ++ } ++ } ++next: ++ if (menu->list) { ++ menu = menu->list; ++ continue; ++ } ++ if (menu->next) ++ menu = menu->next; ++ else while ((menu = menu->parent)) { ++ if (menu->next) { ++ menu = menu->next; ++ break; ++ } ++ } ++ } ++ fclose(out); ++ sprintf(buf2, "%s%s", dir, name); ++ rename(buf, buf2); ++ printf(_("#\n" ++ "# make dependencies written to %s\n" ++ "# ATTENTION buildroot devels!\n" ++ "# See top of this file before playing with this auto-preprequisites!\n" ++ "#\n"), name); ++ return 0; ++} ++ + /* write a dependency file as used by kbuild to track dependencies */ + int file_write_dep(const char *name) + { +@@ -71,7 +186,7 @@ + fprintf(out, "\n$(deps_config): ;\n"); + fclose(out); + rename("..config.tmp", name); +- return 0; ++ return write_make_deps(NULL); + } + + diff --git a/support/kconfig/patches/09-implement-kconfig-probability.patch b/support/kconfig/patches/09-implement-kconfig-probability.patch new file mode 100644 index 000000000..3f09673b8 --- /dev/null +++ b/support/kconfig/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 +@@ -996,7 +996,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)) +@@ -1015,8 +1024,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; diff --git a/support/kconfig/patches/10-br-build-system.patch b/support/kconfig/patches/10-br-build-system.patch new file mode 100644 index 000000000..85125e519 --- /dev/null +++ b/support/kconfig/patches/10-br-build-system.patch @@ -0,0 +1,80 @@ +--- + Makefile.br | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + foo.h | 12 ++++++++++++ + 2 files changed, 65 insertions(+) + +Index: config/Makefile.br +=================================================================== +--- /dev/null ++++ config/Makefile.br +@@ -0,0 +1,53 @@ ++src := . ++top_srcdir=../../ ++top_builddir=../../ ++srctree := . ++obj ?= . ++ ++include Makefile ++#HOSTCFLAGS+=-Dinline="" -include foo.h ++-include $(obj)/.depend ++$(obj)/.depend: $(wildcard *.h *.c) ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > $@ 2>/dev/null || : ++ ++__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) ++host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) ++host-cmulti := $(foreach m,$(__hostprogs),\ ++ $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) ++host-cxxmulti := $(foreach m,$(__hostprogs),\ ++ $(if $($(m)-cxxobjs),$(m),$(if $($(m)-objs),))) ++host-cobjs := $(addprefix $(obj)/,$(sort $(foreach m,$(__hostprogs),$($(m)-objs)))) ++host-cxxobjs := $(addprefix $(obj)/,$(sort $(foreach m,$(__hostprogs),$($(m)-cxxobjs)))) ++ ++HOST_EXTRACFLAGS += -I$(obj) ++ ++$(host-csingle): %: %.c ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $(obj)/$@ ++ ++$(host-cmulti): %: $(host-cobjs) $(host-cshlib) ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ++ ++$(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib) ++ $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ++ ++$(obj)/%.o: %.c ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) -c $< -o $@ ++ ++$(obj)/%.o: $(obj)/%.c ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) -c $< -o $@ ++ ++$(obj)/%.o: %.cc ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$(@F)) -c $< -o $@ ++ ++$(obj)/%:: $(src)/%_shipped ++ $(Q)cat $< > $@ ++ ++clean: ++ $(Q)rm -f $(addprefix $(obj)/,$(clean-files)) ++distclean: clean ++ $(Q)rm -f $(addprefix $(obj)/,$(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \ ++ $(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \ ++ mconf .depend) ++ ++FORCE: ++.PHONY: FORCE clean distclean +Index: config/foo.h +=================================================================== +--- /dev/null ++++ config/foo.h +@@ -0,0 +1,12 @@ ++#ifndef __KCONFIG_FOO_H ++#define __KCONFIG_FOO_H ++ ++#ifndef __APPLE__ ++#include ++#endif ++#include ++ ++#ifndef PATH_MAX ++#define PATH_MAX 1024 ++#endif ++#endif /* __KCONFIG_FOO_H */ diff --git a/support/kconfig/patches/11-use-mktemp-for-lxdialog.patch b/support/kconfig/patches/11-use-mktemp-for-lxdialog.patch new file mode 100644 index 000000000..21ca22883 --- /dev/null +++ b/support/kconfig/patches/11-use-mktemp-for-lxdialog.patch @@ -0,0 +1,17 @@ +--- + lxdialog/check-lxdialog.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: config/lxdialog/check-lxdialog.sh +=================================================================== +--- config.orig/lxdialog/check-lxdialog.sh ++++ config/lxdialog/check-lxdialog.sh +@@ -33,7 +33,7 @@ + } + + # Temp file, try to clean up after us +-tmp=.lxdialog.tmp ++tmp=$(mktemp) + trap "rm -f $tmp" 0 1 2 3 15 + + # Check if we can link to ncurses diff --git a/support/kconfig/patches/12-fix-glade-file-path.patch b/support/kconfig/patches/12-fix-glade-file-path.patch new file mode 100644 index 000000000..681dce160 --- /dev/null +++ b/support/kconfig/patches/12-fix-glade-file-path.patch @@ -0,0 +1,17 @@ +--- + gconf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: kconfig/gconf.c +=================================================================== +--- kconfig.orig/gconf.c ++++ kconfig/gconf.c +@@ -1521,7 +1521,7 @@ + /* Determine GUI path */ + env = getenv(SRCTREE); + if (env) +- glade_file = g_strconcat(env, "/scripts/kconfig/gconf.glade", NULL); ++ glade_file = g_strconcat(env, "/support/kconfig/gconf.glade", NULL); + else if (av[0][0] == '/') + glade_file = g_strconcat(av[0], ".glade", NULL); + else diff --git a/support/kconfig/patches/14-support-out-of-tree-config.patch b/support/kconfig/patches/14-support-out-of-tree-config.patch new file mode 100644 index 000000000..9fa6384d3 --- /dev/null +++ b/support/kconfig/patches/14-support-out-of-tree-config.patch @@ -0,0 +1,199 @@ +--- + conf.c | 1 + confdata.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++--------------- + util.c | 16 +++++++++++++-- + 3 files changed, 61 insertions(+), 18 deletions(-) + +Index: config/conf.c +=================================================================== +--- config.orig/conf.c ++++ config/conf.c +@@ -503,7 +503,6 @@ + } + name = av[optind]; + conf_parse(name); +- //zconfdump(stdout); + if (sync_kconfig) { + name = conf_get_configname(); + if (stat(name, &tmpstat)) { +Index: config/confdata.c +=================================================================== +--- config.orig/confdata.c ++++ config/confdata.c +@@ -71,9 +71,7 @@ + + const char *conf_get_autoconfig_name(void) + { +- char *name = getenv("KCONFIG_AUTOCONFIG"); +- +- return name ? name : "include/config/auto.conf"; ++ return getenv("KCONFIG_AUTOCONFIG"); + } + + static char *conf_expand_value(const char *in) +@@ -565,6 +563,9 @@ + int use_timestamp = 1; + char *env; + ++ if (!name) ++ name = conf_get_configname(); ++ + dirname[0] = 0; + if (name && name[0]) { + struct stat st; +@@ -671,6 +672,7 @@ + { + const char *name; + char path[PATH_MAX+1]; ++ char *opwd, *dir, *_name; + char *s, *d, c; + struct symbol *sym; + struct stat sb; +@@ -679,8 +681,20 @@ + name = conf_get_autoconfig_name(); + conf_read_simple(name, S_DEF_AUTO); + +- if (chdir("include/config")) +- return 1; ++ opwd = malloc(256); ++ _name = strdup(name); ++ if (opwd == NULL || _name == NULL) ++ return 1; ++ opwd = getcwd(opwd, 256); ++ dir = dirname(_name); ++ if (dir == NULL) { ++ res = 1; ++ goto err; ++ } ++ if (chdir(dir)) { ++ res = 1; ++ goto err; ++ } + + res = 0; + for_all_symbols(i, sym) { +@@ -773,9 +787,11 @@ + close(fd); + } + out: +- if (chdir("../..")) +- return 1; +- ++ if (chdir(opwd)) ++ res = 1; ++err: ++ free(opwd); ++ free(_name); + return res; + } + +@@ -787,25 +803,38 @@ + FILE *out, *tristate, *out_h; + time_t now; + int i; ++ char dir[PATH_MAX+1], buf[PATH_MAX+1]; ++ char *s; ++ ++ strcpy(dir, conf_get_configname()); ++ s = strrchr(dir, '/'); ++ if (s) ++ s[1] = 0; ++ else ++ dir[0] = 0; + + sym_clear_all_valid(); + +- file_write_dep("include/config/auto.conf.cmd"); ++ sprintf(buf, "%s.config.cmd", dir); ++ file_write_dep(buf); + + if (conf_split_config()) + return 1; + +- out = fopen(".tmpconfig", "w"); ++ sprintf(buf, "%s.tmpconfig", dir); ++ out = fopen(buf, "w"); + if (!out) + return 1; + +- tristate = fopen(".tmpconfig_tristate", "w"); ++ sprintf(buf, "%s.tmpconfig_tristate", dir); ++ tristate = fopen(buf, "w"); + if (!tristate) { + fclose(out); + return 1; + } + +- out_h = fopen(".tmpconfig.h", "w"); ++ sprintf(buf, "%s.tmpconfig.h", dir); ++ out_h = fopen(buf, "w"); + if (!out_h) { + fclose(out); + fclose(tristate); +@@ -885,19 +914,22 @@ + name = getenv("KCONFIG_AUTOHEADER"); + if (!name) + name = "include/generated/autoconf.h"; +- if (rename(".tmpconfig.h", name)) ++ sprintf(buf, "%s.tmpconfig.h", dir); ++ if (rename(buf, name)) + return 1; + name = getenv("KCONFIG_TRISTATE"); + if (!name) + name = "include/config/tristate.conf"; +- if (rename(".tmpconfig_tristate", name)) ++ sprintf(buf, "%s.tmpconfig_tristate", dir); ++ if (rename(buf, name)) + return 1; + name = conf_get_autoconfig_name(); + /* + * This must be the last step, kbuild has a dependency on auto.conf + * and this marks the successful completion of the previous steps. + */ +- if (rename(".tmpconfig", name)) ++ sprintf(buf, "%s.tmpconfig", dir); ++ if (rename(buf, name)) + return 1; + + return 0; +Index: config/util.c +=================================================================== +--- config.orig/util.c ++++ config/util.c +@@ -147,6 +147,8 @@ + /* write a dependency file as used by kbuild to track dependencies */ + int file_write_dep(const char *name) + { ++ char *str; ++ char buf[PATH_MAX+1], buf2[PATH_MAX+1], dir[PATH_MAX+1]; + struct symbol *sym, *env_sym; + struct expr *e; + struct file *file; +@@ -154,7 +156,16 @@ + + if (!name) + name = ".kconfig.d"; +- out = fopen("..config.tmp", "w"); ++ ++ strcpy(dir, conf_get_configname()); ++ str = strrchr(dir, '/'); ++ if (str) ++ str[1] = 0; ++ else ++ dir[0] = 0; ++ ++ sprintf(buf, "%s..config.tmp", dir); ++ out = fopen(buf, "w"); + if (!out) + return 1; + fprintf(out, "deps_config := \\\n"); +@@ -185,7 +196,8 @@ + + fprintf(out, "\n$(deps_config): ;\n"); + fclose(out); +- rename("..config.tmp", name); ++ sprintf(buf2, "%s%s", dir, name); ++ rename(buf, buf2); + return write_make_deps(NULL); + } + diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series new file mode 100644 index 000000000..defdf5899 --- /dev/null +++ b/support/kconfig/patches/series @@ -0,0 +1,11 @@ +01-kconfig-kernel-to-buildroot.patch +02-cpp-comments-to-c-comments.patch +03-change-config-option-prefix.patch +05-really-clean-everything.patch +06-br-build-system-integration.patch +08-make-write-deps.patch +09-implement-kconfig-probability.patch +10-br-build-system.patch +11-use-mktemp-for-lxdialog.patch +12-fix-glade-file-path.patch +14-support-out-of-tree-config.patch -- cgit v1.2.3