mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-02 21:00:55 +00:00
* wip hvm * feat: move platform stuff all into it's own thing * hvm work * more hvm work * more hvm work * feat: rework to support multiple platforms * hvm nonredist * more hvm work * more hvm work * pvh work * work on loading cmdline * implement initrd loading for pvh * partially working pvh support * fix merge issues * pvh works! * swap over to pv support * remove old kernel stuff * fix support for pv * pvh is gone for now * fix(runtime): debug should be respected * fix(xen): arm64 is currently unsupported, treat it as such at runtime * fix(examples): use architecture cfg for boot example * fix(x86): use IOMMU only when needed for passthrough * chore(build): print kernel architecture during fetch
46 lines
1.4 KiB
Rust
46 lines
1.4 KiB
Rust
use std::{env, process};
|
|
use tokio::fs;
|
|
use xenclient::error::Result;
|
|
use xenclient::{DomainConfig, XenClient};
|
|
|
|
#[cfg(target_arch = "x86_64")]
|
|
type RuntimePlatform = xenclient::x86pv::X86PvPlatform;
|
|
|
|
#[cfg(not(target_arch = "x86_64"))]
|
|
type RuntimePlatform = xenclient::unsupported::UnsupportedPlatform;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
env_logger::init();
|
|
|
|
let args: Vec<String> = env::args().collect();
|
|
if args.len() != 3 {
|
|
println!("usage: boot <kernel-image> <initrd>");
|
|
process::exit(1);
|
|
}
|
|
let kernel_image_path = args.get(1).expect("argument not specified");
|
|
let initrd_path = args.get(2).expect("argument not specified");
|
|
let client = XenClient::new(0, RuntimePlatform::new()).await?;
|
|
let config = DomainConfig {
|
|
backend_domid: 0,
|
|
name: "xenclient-test".to_string(),
|
|
max_vcpus: 1,
|
|
mem_mb: 512,
|
|
kernel: fs::read(&kernel_image_path).await?,
|
|
initrd: fs::read(&initrd_path).await?,
|
|
cmdline: "earlyprintk=xen earlycon=xen console=hvc0 init=/init".to_string(),
|
|
swap_console_backend: None,
|
|
disks: vec![],
|
|
channels: vec![],
|
|
vifs: vec![],
|
|
pcis: vec![],
|
|
filesystems: vec![],
|
|
extra_keys: vec![],
|
|
extra_rw_paths: vec![],
|
|
event_channels: vec![],
|
|
};
|
|
let created = client.create(&config).await?;
|
|
println!("created domain {}", created.domid);
|
|
Ok(())
|
|
}
|