@@ -20,6 +20,7 @@ TELNET_PORT=9088
20
20
INCOMING_PORT=6666
21
21
PRE_BINDING=" false"
22
22
SERVTD_HASH=" "
23
+ LOG_TYPE=" file"
23
24
24
25
25
26
usage () {
@@ -36,12 +37,13 @@ Usage: $(basename "$0") [OPTION]...
36
37
-t <src|dst> Must set userTD type, src or dst
37
38
-g [true|false] Use pre-binding or not, default is "false"
38
39
-m [MigTD hash] Hash of MigTD SERVTD_INFO_HASH, shall be provided if "-g" is true
40
+ -l [stdio|file] Serial log type
39
41
-h Show this help
40
42
EOM
41
43
}
42
44
43
45
process_args () {
44
- while getopts " i:k:b:o:p:q:a:r:t:g:m:h" option; do
46
+ while getopts " i:k:b:o:p:q:a:r:t:g:m:l: h" option; do
45
47
case " ${option} " in
46
48
i) GUEST_IMG=$OPTARG ;;
47
49
k) KERNEL=$OPTARG ;;
@@ -54,6 +56,7 @@ process_args() {
54
56
t) TD_TYPE=$OPTARG ;;
55
57
g) PRE_BINDING=$OPTARG ;;
56
58
m) SERVTD_HASH=$OPTARG ;;
59
+ l) LOG_TYPE=$OPTARG ;;
57
60
h) usage
58
61
exit 0
59
62
;;
@@ -127,6 +130,18 @@ process_args() {
127
130
;;
128
131
esac
129
132
fi
133
+
134
+ case ${LOG_TYPE} in
135
+ " stdio" )
136
+ echo " LOG_TYPE is set to stdio. Proceeding with standard I/O logging."
137
+ ;;
138
+ " file" )
139
+ echo " LOG_TYPE is set to file. Proceeding with file logging."
140
+ ;;
141
+ * )
142
+ error " Invalid LOG_TYPE '${LOG_TYPE} ', must be [stdio|file]"
143
+ ;;
144
+ esac
130
145
}
131
146
132
147
error () {
@@ -150,7 +165,14 @@ QEMU_CMD="${QEMU_EXEC} \
150
165
-monitor unix:/tmp/qmp-sock-${TD_TYPE} ,server,nowait \
151
166
-monitor telnet:127.0.0.1:${TELNET_PORT} ,server,nowait \
152
167
-device virtio-serial,romfile= \
153
- -device virtconsole,chardev=mux -serial chardev:mux -monitor chardev:mux"
168
+ -device virtconsole,chardev=mux -monitor chardev:mux"
169
+
170
+ if [[ ${LOG_TYPE} == stdio ]]; then
171
+ QEMU_CMD+=" -serial chardev:mux "
172
+ else
173
+ QEMU_CMD+=" -serial usertd${MIGTD_TYPE} .log "
174
+ fi
175
+
154
176
OBJ_SUBCOMMAND=" -object tdx-guest,id=tdx0,sept-ve-disable=on,debug=off"
155
177
156
178
QEMU_VERSION=` ${QEMU_EXEC} --version | grep -oP ' version \K[^\s]+' `
0 commit comments