Skip to content
Open
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
1 change: 1 addition & 0 deletions src/devices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "devices"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2021"
build = "build.rs"

[features]
tee = []
Expand Down
10 changes: 10 additions & 0 deletions src/devices/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn main() {
let init_binary_path = std::env::var("KRUN_INIT_BINARY_PATH").unwrap_or_else(|_| {
format!(
"{}/../../init/init",
std::env::var("CARGO_MANIFEST_DIR").unwrap()
)
});
println!("cargo:rustc-env=KRUN_INIT_BINARY_PATH={init_binary_path}");
println!("cargo:rerun-if-env-changed=KRUN_INIT_BINARY_PATH");
}
2 changes: 1 addition & 1 deletion src/devices/src/virtio/fs/linux/passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const EMPTY_CSTR: &[u8] = b"\0";
const PROC_CSTR: &[u8] = b"/proc/self/fd\0";
const INIT_CSTR: &[u8] = b"init.krun\0";

static INIT_BINARY: &[u8] = include_bytes!("../../../../../../init/init");
static INIT_BINARY: &[u8] = include_bytes!(env!("KRUN_INIT_BINARY_PATH"));

type Inode = u64;
type Handle = u64;
Expand Down
2 changes: 1 addition & 1 deletion src/devices/src/virtio/fs/macos/passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const SECURITY_CAPABILITY: &[u8] = b"security.capability\0";

const UID_MAX: u32 = u32::MAX - 1;

static INIT_BINARY: &[u8] = include_bytes!("../../../../../../init/init");
static INIT_BINARY: &[u8] = include_bytes!(env!("KRUN_INIT_BINARY_PATH"));

type Inode = u64;
type Handle = u64;
Expand Down
1 change: 1 addition & 0 deletions src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "vmm"
version = "0.1.0"
authors = ["Amazon Firecracker team <firecracker-devel@amazon.com>"]
edition = "2021"
build = "build.rs"

[features]
tee = []
Expand Down
13 changes: 13 additions & 0 deletions src/vmm/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
fn main() {
#[cfg(target_arch = "aarch64")]
{
let edk2_binary_path = std::env::var("KRUN_EDK2_BINARY_PATH").unwrap_or_else(|_| {
format!(
"{}/../../edk2/KRUN_EFI.silent.fd",
std::env::var("CARGO_MANIFEST_DIR").unwrap()
)
});
println!("cargo:rustc-env=KRUN_EDK2_BINARY_PATH={edk2_binary_path}");
println!("cargo:rerun-if-env-changed=KRUN_EDK2_BINARY_PATH");
}
}
2 changes: 1 addition & 1 deletion src/vmm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ use vm_memory::{GuestAddress, GuestMemoryMmap};

#[cfg(target_arch = "aarch64")]
#[allow(dead_code)]
static EDK2_BINARY: &[u8] = include_bytes!("../../../edk2/KRUN_EFI.silent.fd");
static EDK2_BINARY: &[u8] = include_bytes!(env!("KRUN_EDK2_BINARY_PATH"));

/// Errors associated with starting the instance.
#[derive(Debug)]
Expand Down
Loading