Skip to content

Commit 1f5ad7a

Browse files
committed
serial device debug
1 parent 043680c commit 1f5ad7a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/vmm/src/builder.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ pub fn build_microvm(
588588

589589
// On x86_64 always create a serial device,
590590
// while on aarch64 only create it if 'console=' is specified in the boot args.
591-
let serial_device = if cfg!(feature = "efi") {
591+
let _serial_device = if cfg!(feature = "efi") {
592592
Some(setup_serial_device(
593593
event_manager,
594594
None,
@@ -600,6 +600,12 @@ pub fn build_microvm(
600600
None
601601
};
602602

603+
let serial_device = Some(setup_serial_device(
604+
event_manager,
605+
None,
606+
Some(Box::new(io::stdout())),
607+
)?);
608+
603609
let exit_evt = EventFd::new(utils::eventfd::EFD_NONBLOCK)
604610
.map_err(Error::EventFd)
605611
.map_err(StartMicrovmError::Internal)?;
@@ -1663,7 +1669,7 @@ fn attach_console_devices(
16631669
// The device mutex mustn't be locked here otherwise it will deadlock.
16641670
attach_mmio_device(
16651671
vmm,
1666-
"hvc0".to_string(),
1672+
"ttyS0".to_string(),
16671673
MmioTransport::new(vmm.guest_memory().clone(), console),
16681674
)
16691675
.map_err(RegisterFsDevice)?;

src/vmm/src/vmm_config/boot_source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::fmt::{Display, Formatter, Result};
77
pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=hvc0 \
88
rootfstype=virtiofs rw quiet no-kvmapf";
99
#[cfg(feature = "amd-sev")]
10-
pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=hvc0 \
10+
pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=ttyS0 \
1111
root=/dev/vda rw quiet no-kvmapf";
1212
#[cfg(target_os = "macos")]
1313
pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=hvc0 \

0 commit comments

Comments
 (0)