Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 110 additions & 11 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ axstd = {git = "https://github.com/arceos-hypervisor/arceos.git", tag = "hv-0.4.
"irq",
"multitask",
"smp", # "page-alloc-64g",
"myplat",
"driver-dyn",
]}

axalloc = {git = "https://github.com/arceos-hypervisor/arceos.git", tag = "hv-0.4.1"}
Expand Down
14 changes: 7 additions & 7 deletions configs/board/orangepi-5-plus.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cargo_args = []
features = [
# "ept-level-4",
"axstd/myplat",
"axstd/bus-mmio",
"driver/sdmmc",
"driver/rk3588-clk",
"fs",
# "ept-level-4",
"dyn-plat",
"axstd/bus-mmio",
"driver/sdmmc",
"driver/rk3588-clk",
"fs",
]
log = "Info"
target = "aarch64-unknown-none-softfloat"
to_bin = true
vm_configs = []
vm_configs = []
2 changes: 1 addition & 1 deletion configs/board/phytiumpi.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cargo_args = []
features = [
# "ept-level-4",
"axstd/myplat",
"dyn-plat",
"axstd/bus-mmio",
]
log = "Info"
Expand Down
2 changes: 1 addition & 1 deletion configs/board/qemu-aarch64.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cargo_args = []
features = [
"ept-level-4",
"axstd/myplat",
"axstd/bus-mmio",
"dyn-plat",
]
log = "Info"
target = "aarch64-unknown-none-softfloat"
Expand Down
8 changes: 8 additions & 0 deletions configs/board/qemu-x86_64.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cargo_args = []
features = [
"ept-level-4",
]
log = "Info"
target = "x86_64-unknown-none"
to_bin = false
vm_configs = []
2 changes: 1 addition & 1 deletion configs/board/roc-rk3568-pc.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cargo_args = []
features = [
# "ept-level-4",
"axstd/myplat",
"dyn-plat",
"axstd/bus-mmio",
]
log = "Info"
Expand Down
5 changes: 2 additions & 3 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name = "axvisor"
[features]
ept-level-4 = ["axaddrspace/4-level-ept"]
fs = ["axstd/fs", "axruntime/fs"]
dyn-plat = ["axstd/myplat", "axstd/driver-dyn", "axruntime/driver-dyn"]

[dependencies]
bitflags.workspace = true
Expand All @@ -27,14 +28,12 @@ axstd = {workspace = true, features = [
"irq",
"multitask",
"smp",
"myplat",
"driver-dyn",
]}

# System dependent modules provided by ArceOS-Hypervisor.
axaddrspace.workspace = true
axhvc.workspace = true
axruntime = {workspace = true, features = ["alloc", "irq", "paging", "smp", "driver-dyn", "multitask"]}
axruntime = {workspace = true, features = ["alloc", "irq", "paging", "smp", "multitask"]}
axvcpu.workspace = true
axvm.workspace = true

Expand Down
34 changes: 1 addition & 33 deletions kernel/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::{
env,
ffi::OsString,
fs,
io::{self, Write},
io::Write,
path::{Path, PathBuf},
};

Expand Down Expand Up @@ -239,10 +239,6 @@ fn generate_guest_img_loading_functions(

fn main() -> anyhow::Result<()> {
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let mut smp = None;
if let Ok(s) = std::env::var("AXVISOR_SMP") {
smp = Some(s.parse::<usize>().unwrap_or(1));
}

// let platform = env::var("AX_PLATFORM").unwrap_or("".to_string());

Expand All @@ -256,10 +252,6 @@ fn main() -> anyhow::Result<()> {

println!("cargo:rustc-cfg=platform=\"{platform}\"");

if platform != "dummy" {
gen_linker_script(&arch, platform.as_str(), smp.unwrap_or(1)).unwrap();
}

let config_files = get_configs();
let mut output_file = open_output_file();

Expand Down Expand Up @@ -298,27 +290,3 @@ fn main() -> anyhow::Result<()> {
}
Ok(())
}

fn gen_linker_script(arch: &str, platform: &str, smp: usize) -> io::Result<()> {
let fname = format!("linker_{platform}.lds");
let output_arch = if arch == "x86_64" {
"i386:x86-64"
} else if arch.contains("riscv") {
"riscv" // OUTPUT_ARCH of both riscv32/riscv64 is "riscv"
} else {
arch
};
let ld_content = std::fs::read_to_string("../scripts/lds/linker.lds.S")?;
let ld_content = ld_content.replace("%ARCH%", output_arch);
let ld_content = ld_content.replace("%KERNEL_BASE%", &format!("{:#x}", 0x800000000000usize));
let ld_content = ld_content.replace("%SMP%", &format!("{smp}",));

// target/<target_triple>/<mode>/build/axvisor-xxxx/out
let out_dir = std::env::var("OUT_DIR").unwrap();
// target/<target_triple>/<mode>/linker_xxxx.lds
let out_path = Path::new(&out_dir).join("../../../").join(fname);

println!("writing linker script to {}", out_path.display());
std::fs::write(out_path, ld_content)?;
Ok(())
}
Loading
Loading