From af6e3020e4fb2ab9537ec2278b6eb28690ba06c2 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Mon, 23 Jan 2023 16:52:48 -0500 Subject: [PATCH] QemuRunner.py: Allow OS image paths with spaces Wraps the `-hda` path given to QEMU with quotes so it can contain spaces. Signed-off-by: Michael Kubacki --- Platforms/QemuQ35Pkg/Plugins/QemuRunner/QemuRunner.py | 2 +- Platforms/QemuSbsaPkg/Plugins/QemuRunner/QemuRunner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Platforms/QemuQ35Pkg/Plugins/QemuRunner/QemuRunner.py b/Platforms/QemuQ35Pkg/Plugins/QemuRunner/QemuRunner.py index d445d695f1..d8f3e5ecc3 100644 --- a/Platforms/QemuQ35Pkg/Plugins/QemuRunner/QemuRunner.py +++ b/Platforms/QemuQ35Pkg/Plugins/QemuRunner/QemuRunner.py @@ -82,7 +82,7 @@ def Runner(env): if env.GetValue("PATH_TO_OS") is not None: # Potentially dealing with big daddy, give it more juice... args += " -m 8192" - args += " -hda " + env.GetValue("PATH_TO_OS") + args += " -hda \"" + env.GetValue("PATH_TO_OS") + "\"" else: args += " -m 2048" args += " -cpu qemu64,+rdrand,umip,+smep" # most compatible x64 CPU model + RDRAND + UMIP + SMEP support (not included by default) diff --git a/Platforms/QemuSbsaPkg/Plugins/QemuRunner/QemuRunner.py b/Platforms/QemuSbsaPkg/Plugins/QemuRunner/QemuRunner.py index 561578c9f9..432946d40f 100644 --- a/Platforms/QemuSbsaPkg/Plugins/QemuRunner/QemuRunner.py +++ b/Platforms/QemuSbsaPkg/Plugins/QemuRunner/QemuRunner.py @@ -43,7 +43,7 @@ def Runner(env): args = "-net none" # Mount disk with either startup.nsh or OS image if env.GetValue("PATH_TO_OS") is not None: - args += " -hda " + env.GetValue("PATH_TO_OS") + args += " -hda \"" + env.GetValue("PATH_TO_OS") + "\"" elif os.path.isfile(VirtualDrive): args += f" -hdd {VirtualDrive}" elif os.path.isdir(VirtualDrive):