Skip to content

Commit

Permalink
driver/qemudriver: Allow the BIOS filename to be changed
Browse files Browse the repository at this point in the history
The U-Boot strategy will need to provide the filename of the BIOS
directly when booting U-Boot on QEMU. Add a method to support this.

Signed-off-by: Simon Glass <[email protected]>
  • Loading branch information
sjg20 committed Aug 22, 2024
1 parent 99269b5 commit 6aa7da2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions labgrid/driver/qemudriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def __attrs_post_init__(self):
self._tempdir = None
self._socket = None
self._clientsocket = None
self._bios_fname = None
self._sockpath = None
self._forwarded_ports = {}
atexit.register(self._atexit)
Expand All @@ -130,6 +131,17 @@ def get_qemu_version(self, qemu_bin):

return (int(m.group('major')), int(m.group('minor')), int(m.group('micro')))

def set_bios(self, bios):
"""Set the filename of the bios
This can be used by strategies to set the bios filename, overriding the
value provided in the environment.
Args:
bios (str): New bios filename
"""
self._bios_fname = bios

def get_qemu_base_args(self):
"""Returns the base command line used for Qemu without the options
related to QMP. These options can be used to start an interactive
Expand Down Expand Up @@ -192,6 +204,9 @@ def get_qemu_base_args(self):
cmd.append("-bios")
cmd.append(
self.target.env.config.get_image_path(self.bios))
elif self._bios_fname:
cmd.append("-bios")
cmd.append(self._bios_fname)
if self.extra_args:
if "-append" in shlex.split(self.extra_args):
raise ExecutionError("-append in extra_args not allowed, use boot_args instead")
Expand Down

0 comments on commit 6aa7da2

Please sign in to comment.