From: dhacker29 Date: Fri, 23 Aug 2013 22:29:35 +0000 (-0500) Subject: scripts: Add support for variant and selinux defconfig X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c44593a0b5a61e1ae6d2f73104c637c2d15b45b8;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git scripts: Add support for variant and selinux defconfig --- diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 90a091b6ae4d..abbca017f543 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -87,6 +87,22 @@ $(simple-targets): $(obj)/conf PHONY += oldnoconfig savedefconfig defconfig +ifneq ($(VARIANT_DEFCONFIG),) +export KCONFIG_VARIANT := arch/$(SRCARCH)/configs/$(VARIANT_DEFCONFIG) +endif + +ifneq ($(DEBUG_DEFCONFIG),) +export KCONFIG_DEBUG := arch/$(SRCARCH)/configs/$(DEBUG_DEFCONFIG) +endif + +ifneq ($(SELINUX_DEFCONFIG),) +export KCONFIG_SELINUX := arch/$(SRCARCH)/configs/$(SELINUX_DEFCONFIG) +endif + +ifneq ($(SELINUX_LOG_DEFCONFIG),) +export KCONFIG_LOG_SELINUX := arch/$(SRCARCH)/configs/$(SELINUX_LOG_DEFCONFIG) +endif + # oldnoconfig is an alias of olddefconfig, because people already are dependent # on its behavior (sets new symbols to their default value but not 'n') with the # counter-intuitive name. diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 866369f10ff8..418048b3353a 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -587,6 +587,51 @@ int main(int ac, char **av) "***\n"), defconfig_file); exit(1); } + name = getenv("KCONFIG_SELINUX"); + printf("KCONFIG_SELINUX(%s)\n", name); + if (name) { + if (conf_read_simple(name, S_DEF_USER, false)) { + printf(_("***\n" + "*** Can't find selinux configuration \"%s\"!\n" + "***\n"), name); + exit(1); + } + } + name = getenv("KCONFIG_LOG_SELINUX"); + printf("KCONFIG_LOG_SELINUX(%s)\n", name); + if (name) { + if (conf_read_simple(name, S_DEF_USER, false)) { + printf(_("***\n" + "*** Can't find selinux log configuration \"%s\"!\n" + "***\n"), name); + exit(1); + } + } + name = getenv("KCONFIG_VARIANT"); + printf("KCONFIG_VARIANT(%s)\n", name); + if (name) { + if (conf_read_simple(name, S_DEF_USER, false)) { + printf(_("***\n" + "*** Can't find variant configuration \"%s\"!\n" + "***\n"), name); + exit(1); + } + } else { + printf(_("***\n" + "*** You must specify VARIANT_DEFCONFIG !\n" + "***\n")); + exit(1); + } + name = getenv("KCONFIG_DEBUG"); + printf("KCONFIG_DEBUG(%s)\n", name); + if (name) { + if (conf_read_simple(name, S_DEF_USER, false)) { + printf(_("***\n" + "*** Can't find debug configuration \"%s\"!\n" + "***\n"), name); + exit(1); + } + } break; case savedefconfig: case silentoldconfig: @@ -605,7 +650,7 @@ int main(int ac, char **av) if (!name) break; if ((strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) { - if (conf_read_simple(name, S_DEF_USER)) { + if (conf_read_simple(name, S_DEF_USER, true)) { fprintf(stderr, _("*** Can't read seed configuration \"%s\"!\n"), name); @@ -621,8 +666,8 @@ int main(int ac, char **av) case randconfig: name = "allrandom.config"; break; default: break; } - if (conf_read_simple(name, S_DEF_USER) && - conf_read_simple("all.config", S_DEF_USER)) { + if (conf_read_simple(name, S_DEF_USER, true) && + conf_read_simple("all.config", S_DEF_USER, true)) { fprintf(stderr, _("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"), name); diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index fa423fcd1a92..7e03aee39473 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -248,7 +248,7 @@ e_out: return -1; } -int conf_read_simple(const char *name, int def) +int conf_read_simple(const char *name, int def, int sym_init) { FILE *in = NULL; char *line = NULL; @@ -293,6 +293,10 @@ load: conf_unsaved = 0; def_flags = SYMBOL_DEF << def; + + if (!sym_init) + goto readsym; + for_all_symbols(i, sym) { sym->flags |= SYMBOL_CHANGED; sym->flags &= ~(def_flags|SYMBOL_VALID); @@ -311,6 +315,7 @@ load: } } +readsym: while (compat_getline(&line, &line_asize, in) != -1) { conf_lineno++; sym = NULL; @@ -413,7 +418,7 @@ int conf_read(const char *name) sym_set_change_count(0); - if (conf_read_simple(name, S_DEF_USER)) { + if (conf_read_simple(name, S_DEF_USER, true)) { sym_calc_value(modules_sym); return 1; } @@ -848,7 +853,7 @@ static int conf_split_config(void) int res, i, fd; name = conf_get_autoconfig_name(); - conf_read_simple(name, S_DEF_AUTO); + conf_read_simple(name, S_DEF_AUTO, true); sym_calc_value(modules_sym); if (chdir("include/config")) diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index d5398718ec2a..376e4e12c30d 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -3,7 +3,7 @@ /* confdata.c */ void conf_parse(const char *name); int conf_read(const char *name); -int conf_read_simple(const char *name, int); +int conf_read_simple(const char *name, int, int); int conf_write_defconfig(const char *name); int conf_write(const char *name); int conf_write_autoconf(void);