-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpu-model-config-3.patch
118 lines (104 loc) · 3.42 KB
/
cpu-model-config-3.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
From 6cd8e593884719b04ee7b467346f285cf70ab59d Mon Sep 17 00:00:00 2001
From: john cooper <[email protected]>
Date: Thu, 1 Apr 2010 20:19:14 -0300
Subject: [PATCH 3/4] Add qemu cpu model configuration support v2 [BZ #569661]
RH-Author: john cooper <[email protected]>
Message-id: <[email protected]>
Patchwork-id: 8331
O-Subject: [RHEL6 PATCH 3/4] Add qemu cpu model configuration support v2 [BZ
#569661]
Bugzilla: 569661
RH-Acked-by: Markus Armbruster <[email protected]>
RH-Acked-by: Juan Quintela <[email protected]>
RH-Acked-by: Jes Sorensen <[email protected]>
Apply upstream:
commit 292444cb87f3b883146ee30628a5922b1cde4073
Author: Anthony Liguori <[email protected]>
Date: Thu Jan 21 10:57:58 2010 -0600
Load global config files by default
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.
To ensure that the default configuration is overridden by a user specified
config, we introduce a two stage option parsing mechanism.
Signed-off-by: Anthony Liguori <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
---
qemu-options.hx | 9 +++++++++
vl.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 5efb57b..2d8ef64 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1929,6 +1929,15 @@ STEXI
Immediately before starting guest execution, drop root privileges, switching
to the specified user.
ETEXI
+DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig,
+ "-nodefconfig\n"
+ " do not load default config files at startup\n")
+STEXI
+@item -nodefconfig
+Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and
+@var{sysconfdir}/target-@var{ARCH}.conf on startup. The @code{-nodefconfig}
+option will prevent QEMU from loading these configuration files at startup.
+ETEXI
STEXI
@end table
diff --git a/vl.c b/vl.c
index 29b6769..33fcdc3 100644
--- a/vl.c
+++ b/vl.c
@@ -5047,6 +5047,7 @@ int main(int argc, char **argv, char **envp)
#endif
CPUState *env;
int show_vnc_port = 0;
+ int defconfig = 1;
init_clocks();
@@ -5108,6 +5109,44 @@ int main(int argc, char **argv, char **envp)
tb_size = 0;
autostart= 1;
+ /* first pass of option parsing */
+ optind = 1;
+ while (optind < argc) {
+ if (argv[optind][0] != '-') {
+ /* disk image */
+ continue;
+ } else {
+ const QEMUOption *popt;
+
+ popt = lookup_opt(argc, argv, &optarg, &optind);
+ switch (popt->index) {
+ case QEMU_OPTION_nodefconfig:
+ defconfig=0;
+ break;
+ }
+ }
+ }
+
+ 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);
+ }
+ }
+
+ /* second pass of option parsing */
optind = 1;
for(;;) {
if (optind >= argc)
--
1.7.0.3