Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit face4374 authored by Roman Zippel's avatar Roman Zippel Committed by Sam Ravnborg
Browse files

kconfig: add defconfig_list/module option



This makes it possible to change two options which were hardcoded sofar.
1. Any symbol can now take the role of CONFIG_MODULES
2. The more useful option is to change the list of default file names,
   which kconfig uses to load the base configuration if .config isn't
   available.

Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent f6a88aa8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
config DEFCONFIG_LIST
	string
	option defconfig_list
	default "/lib/modules/$UNAME_RELEASE/.config"
	default "/etc/kernel-config"
	default "/boot/config-$UNAME_RELEASE"
	default "arch/$ARCH/defconfig"

menu "Code maturity level options"

config EXPERIMENTAL
+11 −15
Original line number Diff line number Diff line
@@ -25,15 +25,6 @@ const char conf_def_filename[] = ".config";

const char conf_defname[] = "arch/$ARCH/defconfig";

const char *conf_confnames[] = {
	".config",
	"/lib/modules/$UNAME_RELEASE/.config",
	"/etc/kernel-config",
	"/boot/config-$UNAME_RELEASE",
	conf_defname,
	NULL,
};

static void conf_warning(const char *fmt, ...)
{
	va_list ap;
@@ -98,16 +89,21 @@ int conf_read_simple(const char *name, int def)
	if (name) {
		in = zconf_fopen(name);
	} else {
		const char **names = conf_confnames;
		name = *names++;
		if (!name)
			return 1;
		struct property *prop;

		name = conf_def_filename;
		in = zconf_fopen(name);
		if (in)
			goto load;
		sym_change_count++;
		while ((name = *names++)) {
			name = conf_expand_value(name);
		if (!sym_defconfig_list)
			return 1;

		for_all_defaults(sym_defconfig_list, prop) {
			if (expr_calc_value(prop->visible.expr) == no ||
			    prop->expr->type != E_SYMBOL)
				continue;
			name = conf_expand_value(prop->expr->left.sym->name);
			in = zconf_fopen(name);
			if (in) {
				printf(_("#\n"
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ struct file *lookup_file(const char *name);

extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern struct symbol *sym_defconfig_list;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ const char *str_get(struct gstr *gs);
/* symbol.c */
void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_all_changed(void);
void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
+14 −0
Original line number Diff line number Diff line
@@ -154,6 +154,20 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)

void menu_add_option(int token, char *arg)
{
	struct property *prop;

	switch (token) {
	case T_OPT_MODULES:
		prop = prop_alloc(P_DEFAULT, modules_sym);
		prop->expr = expr_alloc_symbol(current_entry->sym);
		break;
	case T_OPT_DEFCONFIG_LIST:
		if (!sym_defconfig_list)
			sym_defconfig_list = current_entry->sym;
		else if (sym_defconfig_list != current_entry->sym)
			zconf_error("trying to redefine defconfig symbol");
		break;
	}
}

static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
Loading