Skip to content

Commit

Permalink
Don't depend on a patched bootloader anymore (still doesn't resolve r…
Browse files Browse the repository at this point in the history
  • Loading branch information
kennystrawnmusic committed Oct 22, 2023
1 parent d29a6b3 commit 2d3e88c
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 21 deletions.
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,29 @@
"isDefault": true
},
},
{
"label": "Clean and rebuild",
"type": "shell",
"command": [
"cargo",
"cache",
"-r",
"all",
"&&",
"cargo",
"clean",
"&&",
"cargo",
"run",
"--package",
"runner",
"--",
"--boot",
],
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
13 changes: 9 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ incremental = true
codegen-units = 256

[patch.crates-io]
bootloader = { git = "https://github.com/kennystrawnmusic/bootloader" }
bootloader-boot-config = { git = "https://github.com/kennystrawnmusic/bootloader" }
bootloader-x86_64-common = { git = "https://github.com/kennystrawnmusic/bootloader" }
bootloader_api = { git = "https://github.com/kennystrawnmusic/bootloader" }
redox_syscall = { git = "https://gitlab.redox-os.org/redox-os/syscall" }

[features]
Expand Down
3 changes: 2 additions & 1 deletion runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ edition = "2021"
cryptos = { path = "..", artifact = "bin", target = "x86_64-unknown-none" }
bootloader = "^0.11"
bootloader-boot-config = "^0.11"
ovmf-prebuilt = { git = "https://github.com/rust-osdev/ovmf-prebuilt", artifact = "bin", version = "0.1.0" }
ovmf-prebuilt = { git = "https://github.com/rust-osdev/ovmf-prebuilt", artifact = "bin", version = "0.1.0" }
raw-cpuid = "11.0.1"
28 changes: 17 additions & 11 deletions runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{
path::Path,
process::{exit, Command, Stdio},
};
use raw_cpuid::{CpuId, Hypervisor};

fn main() {
if cfg!(target_os = "linux") {
Expand All @@ -20,15 +21,24 @@ fn main() {
let kdir = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap();
let out_path = kdir.join("cryptos.img");

let mut fb_phys = FrameBuffer::default();
fb_phys.minimum_framebuffer_width = Some(1920);
fb_phys.minimum_framebuffer_height = Some(1080);

let fb_virt = FrameBuffer::default();
let framebuf = if let Some(hypervisor) = CpuId::new().get_hypervisor_info() {
if let Hypervisor::QEMU = hypervisor.identify() {
FrameBuffer::default()
} else {
let mut fb = FrameBuffer::default();
fb.minimum_framebuffer_height = Some(1920);
fb.minimum_framebuffer_width = Some(1080);
fb
}
} else {
let mut fb = FrameBuffer::default();
fb.minimum_framebuffer_height = Some(1920);
fb.minimum_framebuffer_width = Some(1080);
fb
};

let mut c = BootConfig::default();
c.frame_buffer_physical = fb_phys;
c.frame_buffer_virtual = fb_virt;
c.frame_buffer = framebuf;

// Suppress excessive output in release mode
if cfg!(opt_level = "0") {
Expand Down Expand Up @@ -405,10 +415,6 @@ fn run_qemu(kdir: &Path, out_path: &Path) {

let mut uefi_cmd = Command::new("qemu-system-x86_64");

if cfg!(target_os = "linux") {
uefi_cmd.arg("-accel").arg("kvm");
}

uefi_cmd
.arg("-drive")
.arg(format!(
Expand Down
3 changes: 2 additions & 1 deletion src/drivers/xhci/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ impl XhciImpl {
while port.portsc.port_reset() {
core::hint::spin_loop();
}
// TODO: timeout

log::info!("Ports successfully reset");
}
}
});
Expand Down

0 comments on commit 2d3e88c

Please sign in to comment.