@@ -1965,6 +1965,13 @@ STEXI
@item -writeconfig @var{file}
Write device configuration to @var{file}.
ETEXI
+DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig,
+ "-nodefconfig\n"
+ " do not load default config file\n")
+STEXI
+@item -nodefconfig
+Do not load default config files.
+ETEXI
HXCOMM This is the last statement. Insert new options before this line!
STEXI
@@ -4690,6 +4690,7 @@ int main(int argc, char **argv, char **envp)
#endif
CPUState *env;
int show_vnc_port = 0;
+ int defconfig = 1;
init_clocks();
@@ -5457,6 +5458,9 @@ int main(int argc, char **argv, char **envp)
fclose(fp);
break;
}
+ case QEMU_OPTION_nodefconfig:
+ defconfig=0;
+ break;
}
}
}
@@ -5471,6 +5475,25 @@ int main(int argc, char **argv, char **envp)
data_dir = CONFIG_QEMU_SHAREDIR;
}
+ if (defconfig) {
+ FILE *fp;
+ fp = fopen(CONFIG_QEMU_CONFDIR "/qemu.conf", "r");
+ if (fp) {
+ if (qemu_config_parse(fp) != 0) {
+ exit(1);
+ }
+ fclose(fp);
+ }
+
+ fp = fopen(CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", "r");
+ if (fp) {
+ if (qemu_config_parse(fp) != 0) {
+ exit(1);
+ }
+ fclose(fp);
+ }
+ }
+
/*
* Default to max_cpus = smp_cpus, in case the user doesn't
* specify a max_cpus value.
A new option, -nodefconfig is introduced to prevent loading from the default config location. Otherwise, two configuration files will be searched for, qemu.conf and target-<TARGET_NAME>.conf. The ordering is a little troubling. Command line options are parsed before loading the default configs which means that the command line configs will be loaded before the default config. The effect is that the default config will override -readconfig directives. It's unclear the best way to handle this. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- qemu-options.hx | 7 +++++++ vl.c | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-)