summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorClément Péron <peron.clem@gmail.com>2023-03-10 19:54:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-14 17:10:00 +0000
commit1f6b7ec6a45398ee1c58071effd3e46df6befe0e (patch)
tree991ccda29bd6e4090a9e53670aefb0d843e7a20f /scripts/runqemu
parent1c01cbaed575a6bfc97b32af1b55c3707fdaf473 (diff)
downloadpoky-1f6b7ec6a45398ee1c58071effd3e46df6befe0e.tar.gz
runqemu: add an option to enable guest-agent virtio device
Add support to the runqemu script for a new option, 'guestagent', that enables the virtio serial port for host-to-guest communication. (From OE-Core rev: 21a1e52079089c5bbeee8ffc9c504471f4a8732a) Signed-off-by: Brenda Streiff <brenda.streiff@ni.com> Signed-off-by: Clément Péron <peron.clem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 58b0c191e1..38aa35fdd4 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -82,6 +82,7 @@ of the following environment variables (in any order):
82 kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU required) 82 kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU required)
83 publicvnc - enable a VNC server open to all hosts 83 publicvnc - enable a VNC server open to all hosts
84 audio - enable audio 84 audio - enable audio
85 guestagent - enable guest agent communication
85 [*/]ovmf* - OVMF firmware file or base name for booting with UEFI 86 [*/]ovmf* - OVMF firmware file or base name for booting with UEFI
86 tcpserial=<port> - specify tcp serial port number 87 tcpserial=<port> - specify tcp serial port number
87 qemuparams=<xyz> - specify custom parameters to QEMU 88 qemuparams=<xyz> - specify custom parameters to QEMU
@@ -216,6 +217,8 @@ class BaseConfig(object):
216 self.cleaned = False 217 self.cleaned = False
217 # Files to cleanup after run 218 # Files to cleanup after run
218 self.cleanup_files = [] 219 self.cleanup_files = []
220 self.guest_agent = False
221 self.guest_agent_sockpath = '/tmp/qga.sock'
219 222
220 def acquire_taplock(self, error=True): 223 def acquire_taplock(self, error=True):
221 logger.debug("Acquiring lockfile %s..." % self.taplock) 224 logger.debug("Acquiring lockfile %s..." % self.taplock)
@@ -526,6 +529,10 @@ class BaseConfig(object):
526 elif arg == 'publicvnc': 529 elif arg == 'publicvnc':
527 self.publicvnc = True 530 self.publicvnc = True
528 self.qemu_opt_script += ' -vnc :0' 531 self.qemu_opt_script += ' -vnc :0'
532 elif arg == 'guestagent':
533 self.guest_agent = True
534 elif arg.startswith('guestagent-sockpath='):
535 self.guest_agent_sockpath = '%s' % arg[len('guestagent-sockpath='):]
529 elif arg.startswith('tcpserial='): 536 elif arg.startswith('tcpserial='):
530 self.tcpserial_portnum = '%s' % arg[len('tcpserial='):] 537 self.tcpserial_portnum = '%s' % arg[len('tcpserial='):]
531 elif arg.startswith('qemuparams='): 538 elif arg.startswith('qemuparams='):
@@ -1375,6 +1382,12 @@ class BaseConfig(object):
1375 except FileNotFoundError: 1382 except FileNotFoundError:
1376 raise RunQemuError("/dev/dri directory does not exist; no render nodes available on this machine. %s" %(render_hint)) 1383 raise RunQemuError("/dev/dri directory does not exist; no render nodes available on this machine. %s" %(render_hint))
1377 1384
1385 def setup_guest_agent(self):
1386 if self.guest_agent == True:
1387 self.qemu_opt += ' -chardev socket,path=' + self.guest_agent_sockpath + ',server,nowait,id=qga0 '
1388 self.qemu_opt += ' -device virtio-serial '
1389 self.qemu_opt += ' -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 '
1390
1378 def setup_vga(self): 1391 def setup_vga(self):
1379 if self.nographic == True: 1392 if self.nographic == True:
1380 if self.sdl == True: 1393 if self.sdl == True:
@@ -1506,6 +1519,7 @@ class BaseConfig(object):
1506 if self.snapshot: 1519 if self.snapshot:
1507 self.qemu_opt += " -snapshot" 1520 self.qemu_opt += " -snapshot"
1508 1521
1522 self.setup_guest_agent()
1509 self.setup_serial() 1523 self.setup_serial()
1510 self.setup_vga() 1524 self.setup_vga()
1511 1525