Commit 5857730c authored by Will Deacon's avatar Will Deacon
Browse files

builtin-run: Pass console= parameter based on active console



x86 already does this in the backend, but doing it in the generic code
means that it is possible to boot a defconfig arm64 kernel under kvmtool
without having to specify any additional parameters at all.
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 83042d1e
......@@ -454,6 +454,7 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
static char real_cmdline[2048], default_name[20];
unsigned int nr_online_cpus;
struct kvm *kvm = kvm__new();
bool video;
if (IS_ERR(kvm))
return kvm;
......@@ -536,6 +537,8 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
if (!kvm->cfg.console)
kvm->cfg.console = DEFAULT_CONSOLE;
video = kvm->cfg.vnc || kvm->cfg.sdl || kvm->cfg.gtk;
if (!strncmp(kvm->cfg.console, "virtio", 6))
kvm->cfg.active_console = CONSOLE_VIRTIO;
else if (!strncmp(kvm->cfg.console, "serial", 6))
......@@ -564,7 +567,22 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
kvm->cfg.network = DEFAULT_NETWORK;
memset(real_cmdline, 0, sizeof(real_cmdline));
kvm__arch_set_cmdline(real_cmdline, kvm->cfg.vnc || kvm->cfg.sdl || kvm->cfg.gtk);
kvm__arch_set_cmdline(real_cmdline, video);
if (video) {
strcat(real_cmdline, "console=tty0");
} else {
switch (kvm->cfg.active_console) {
case CONSOLE_HV:
/* Fallthrough */
case CONSOLE_VIRTIO:
strcat(real_cmdline, "console=hvc0");
break;
case CONSOLE_8250:
strcat(real_cmdline, "console=ttyS0");
break;
}
}
if (!kvm->cfg.guest_name) {
if (kvm->cfg.custom_rootfs) {
......
......@@ -124,9 +124,9 @@ void kvm__arch_set_cmdline(char *cmdline, bool video)
strcpy(cmdline, "noapic noacpi pci=conf1 reboot=k panic=1 i8042.direct=1 "
"i8042.dumbkbd=1 i8042.nopnp=1");
if (video)
strcat(cmdline, " video=vesafb console=tty0");
strcat(cmdline, " video=vesafb");
else
strcat(cmdline, " console=ttyS0 earlyprintk=serial i8042.noaux=1");
strcat(cmdline, " earlyprintk=serial i8042.noaux=1");
}
/* Architecture-specific KVM init */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment