diff options
author | Alexandru Elisei <alexandru.elisei@arm.com> | 2021-09-23 15:44:56 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-10-12 09:40:46 +0100 |
commit | 6810e75ce9e0af8fb95869710693f3e015ba5894 (patch) | |
tree | 2295cc4b26b375b4118e7ac5b6b2f8b8cf759bae | |
parent | 2e7380db438defbc5aa24652fe10b7bf99822355 (diff) | |
download | kvmtool-6810e75ce9e0af8fb95869710693f3e015ba5894.tar.gz |
builtin-run: Treat specifying both --kernel and --firmware as an error
If the user specifies both the --kernel and the --firmware arguments,
--firmware takes precedence and --kernel is silently ignored. Since kvmtool
has no way of knowing what the user really intended, and guessing that
--firmware is the right argument might prove to be quite unexpected for the
user, be vocal about the incompatibility and refuse to create the VM.
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210923144505.60776-2-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | builtin-run.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-run.c b/builtin-run.c index 7f93b9d9..8bb80516 100644 --- a/builtin-run.c +++ b/builtin-run.c @@ -513,6 +513,9 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv) kvm->nr_disks = kvm->cfg.image_count; + if (kvm->cfg.kernel_filename && kvm->cfg.firmware_filename) + die("Only one of --kernel or --firmware can be specified"); + if (!kvm->cfg.kernel_filename && !kvm->cfg.firmware_filename) { kvm->cfg.kernel_filename = find_kernel(); |