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

allow overriding qemu binary ($QEMU_SYSTEM_X86_64, $QEMU_SYSTEM_AARCH64) #80

Merged
merged 3 commits into from
Jun 25, 2021

Conversation

AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented Jun 24, 2021

Passing args is also possible (only for debugging purpose), e.g., "QEMU_SYSTEM_X86_64=/opt/qemu/bin/qemu-system-x86_64 -snapshot" .

Fix #27
Fix #14

@jandubois
Copy link
Member

I think it would be good if qemu.CmdLine would check for certain options if they are already provided by the override, and then don't add the built-in values for them (e.g. for -cpu, -machine, -smp, -boot, -display from a cursory scan). Since you are prefixing with the environment variable, there is no way to overwrite the builtin settings otherwise.

Maybe write a custom appendIfMissing(args, "-option", ...) that only appends the additional arguments when args doesn't yet have an entry equal to "-option"?

@jandubois
Copy link
Member

BTW, providing options to qemu for debugging without recompiling lima is the main point of this change for me.

For providing the location of an alternate qemu binary $PATH works just as well as $QEMU_SYSTEM_X86_64.

Passing args is also possible (only for debugging purpose), e.g., "QEMU_SYSTEM_X86_64=/opt/qemu/bin/qemu-system-x86_64 -snapshot" .

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda
Copy link
Member Author

e.g. for -cpu, -machine, -smp, -boot, -display from a cursory scan

I'm not sure we want to support overriding these flags, as most of them are configurable via the YAML, though I guess it wouldn't hurt to support overriding -cpu and -machine.

A workaround is to specify a custom script like this via the env.

#!/bin/sh
set -eu
exec qemu-system-x86_64 (echo $@ | sed -e 's/-cpu [^ ]* /-cpu SOMETHING /')

e.g. QEMU_SYSTEM_X86_64="qemu-system-x86_64 -cpu host"

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda
Copy link
Member Author

added commit qemu: allow overriding -cpu, -machine, .. as $QEMU_SYSTEM_X86_64

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Also tested with QEMU_SYSTEM_X86_64="qemu-system-x86_64 -display cocoa" limactl start --tty=false and worked as expected.

@AkihiroSuda AkihiroSuda merged commit eec5682 into master Jun 25, 2021
@AkihiroSuda AkihiroSuda deleted the dev-override-qemu branch June 28, 2021 04:34
@AkihiroSuda AkihiroSuda added this to the v0.5.0 milestone Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An option to specify custom QEMU installation (prefix) Customize qemu parameters
2 participants