qemu: remove bios argument

I did this for arm64 because we'd get a black screen without it but I
have now confirmed that console=ttyAMA0 solves that problem.

I don't remember why I did it for x86.
reviewable/pr1069/r1
Tamir Duberstein 6 months ago
parent 298e2a751c
commit 11b39ce13b
No known key found for this signature in database

@ -257,10 +257,9 @@ pub fn run(opts: Options) -> Result<()> {
.ok_or_else(|| anyhow!("failed to parse {cmd:?} stdout: {stdout}"))?; .ok_or_else(|| anyhow!("failed to parse {cmd:?} stdout: {stdout}"))?;
let guest_arch = guest_arch.trim(); let guest_arch = guest_arch.trim();
let (guest_arch, machine, cpu) = match guest_arch { let (guest_arch, machine, cpu, console) = match guest_arch {
"ARM64" => ("aarch64", Some("virt"), Some("cortex-a57")), "ARM64" => ("aarch64", Some("virt"), Some("max"), "ttyAMA0"),
"x86" => ("x86_64", Some("q35"), Some("qemu64")), guest_arch => (guest_arch, None, None, "ttyS0"),
guest_arch => (guest_arch, None, None),
}; };
let target = format!("{guest_arch}-unknown-linux-musl"); let target = format!("{guest_arch}-unknown-linux-musl");
@ -380,7 +379,7 @@ pub fn run(opts: Options) -> Result<()> {
} else if let Some(cpu) = cpu { } else if let Some(cpu) = cpu {
qemu.args(["-cpu", cpu]); qemu.args(["-cpu", cpu]);
} }
let console = OsString::from("ttyS0"); let console = OsString::from(console);
let mut kernel_args = std::iter::once(("console", &console)) let mut kernel_args = std::iter::once(("console", &console))
.chain(run_args.clone().map(|run_arg| ("init.arg", run_arg))) .chain(run_args.clone().map(|run_arg| ("init.arg", run_arg)))
.enumerate() .enumerate()
@ -406,45 +405,6 @@ pub fn run(opts: Options) -> Result<()> {
.arg(&kernel_image) .arg(&kernel_image)
.arg("-initrd") .arg("-initrd")
.arg(&initrd_image); .arg(&initrd_image);
if guest_arch == "aarch64" {
match OS {
"linux" => {
let mut cmd = Command::new("locate");
let output = cmd
.arg("QEMU_EFI.fd")
.output()
.with_context(|| format!("failed to run {cmd:?}"))?;
let Output { status, .. } = &output;
if status.code() != Some(0) {
bail!("{qemu:?} failed: {output:?}")
}
let Output { stdout, .. } = output;
let bios = String::from_utf8(stdout)
.with_context(|| format!("failed to parse output of {cmd:?}"))?;
qemu.args(["-bios", bios.trim()]);
}
"macos" => {
let mut cmd = Command::new("brew");
let output = cmd
.args(["list", "qemu", "-1", "-v"])
.output()
.with_context(|| format!("failed to run {cmd:?}"))?;
let Output { status, .. } = &output;
if status.code() != Some(0) {
bail!("{qemu:?} failed: {output:?}")
}
let Output { stdout, .. } = output;
let output = String::from_utf8(stdout)
.with_context(|| format!("failed to parse output of {cmd:?}"))?;
const NAME: &str = "edk2-aarch64-code.fd";
let bios = output.lines().find(|line| line.contains(NAME)).ok_or_else(
|| anyhow!("failed to find {NAME} in output of {cmd:?}: {output}"),
)?;
qemu.args(["-bios", bios.trim()]);
}
os => bail!("unsupported OS: {os}"),
};
}
let mut qemu_child = qemu let mut qemu_child = qemu
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())

Loading…
Cancel
Save