tangled
alpha
login
or
join now
cass.cityboundforest.com
/
dasos
0
fork
atom
A repository for a long-term OS project titled DasOS (named after the Greek for "forest")
0
fork
atom
overview
issues
pulls
pipelines
Adding QEMU run scripts
cass.cityboundforest.com
4 months ago
de875306
7edf576c
+30
3 changed files
expand all
collapse all
unified
split
Cargo.toml
src
bin
qemu-bios.rs
qemu-uefi.rs
+2
Cargo.toml
···
2
2
name = "dasos"
3
3
version = "0.1.0"
4
4
edition = "2024"
5
5
+
default-run = "dasos"
5
6
6
7
[workspace]
7
8
members = ["kernel"]
8
9
9
10
[dependencies]
11
11
+
ovmf-prebuilt = "0.2.4"
10
12
11
13
[build-dependencies]
12
14
kernel = { path = "kernel", artifact = "bin", target = "x86_64-unknown-none" }
+9
src/bin/qemu-bios.rs
···
1
1
+
use std::{env, process::{self, Command}};
2
2
+
3
3
+
fn main() {
4
4
+
let mut qemu = Command::new("qemu-system-x86_64");
5
5
+
qemu.arg("-drive");
6
6
+
qemu.arg(format!("format=raw,file={}", env!("BIOS_IMAGE")));
7
7
+
let exit_status = qemu.status().unwrap();
8
8
+
process::exit(exit_status.code().unwrap_or(-1));
9
9
+
}
+19
src/bin/qemu-uefi.rs
···
1
1
+
use std::{env, process::{self, Command}};
2
2
+
use ovmf_prebuilt::{Arch, FileType, Prebuilt, Source};
3
3
+
4
4
+
fn main() {
5
5
+
let prebuilt = Prebuilt::fetch(Source::LATEST, "target/ovmf").unwrap();
6
6
+
let ovmf_code = prebuilt.get_file(Arch::X64, FileType::Code);
7
7
+
let ovmf_vars = prebuilt.get_file(Arch::X64, FileType::Vars);
8
8
+
let mut qemu = Command::new("qemu-system-x86_64");
9
9
+
qemu.args([
10
10
+
"-drive",
11
11
+
&format!("format=raw,if=pflash,readonly=on,file={}", ovmf_code.display()),
12
12
+
"-drive",
13
13
+
&format!("format=raw,if=pflash,file={}", ovmf_vars.display()),
14
14
+
"-drive",
15
15
+
&format!("format=raw,file={}", env!("UEFI_IMAGE")),
16
16
+
]);
17
17
+
let exit_status = qemu.status().unwrap();
18
18
+
process::exit(exit_status.code().unwrap_or(-1));
19
19
+
}