Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vng: fail if --arch is used without --root #234

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions virtme_ng/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def make_parser():
"--arch",
action="store",
help="Generate and test a kernel for a specific architecture "
"(default is host architecture)",
"(default is host architecture ; if set, to be used with --root)",
)

parser.add_argument(
Expand Down Expand Up @@ -596,6 +596,7 @@ def arg_fail(message, show_usage=True):
"kernel_target": "Image",
"kernel_image": "Image",
},
# adding a new arch? Please also update get_host_arch().
}

MAKE_COMMAND = "make LOCALVERSION=-virtme"
Expand Down Expand Up @@ -911,7 +912,13 @@ def _get_virtme_user(self, args):
def _get_virtme_arch(self, args):
if args.arch is not None:
if args.arch not in ARCH_MAPPING:
arg_fail(f"unsupported architecture: {args.arch}")
arg_fail(
f"unsupported architecture ({args.arch}), "
f"available: {' '.join(ARCH_MAPPING)}",
show_usage=False
)
if args.root is None and get_host_arch() != args.arch:
arg_fail("--arch used without --root")
if "max-cpus" in ARCH_MAPPING[args.arch]:
self.cpus = ARCH_MAPPING[args.arch]["max-cpus"]
self.virtme_param["arch"] = "--arch " + ARCH_MAPPING[args.arch]["qemu_name"]
Expand Down