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
49 changes: 23 additions & 26 deletions makefile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a condition to check which files to copy over? It is annoying to get false negatives. I have a (semi) fix for that in the previous version, maybe do something similar.

Cheers

Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#
# OUTPUT PATHS
# variables shared by all child make process
#
PREFIX ?= /usr/local
QBIN_DIR ?= $(PREFIX)/bin
QCONFIG_DIR ?= /etc/quark
QLOG_DIR ?= /var/log/quark

export PREFIX ?= /usr/local
export QBIN_DIR ?= $(PREFIX)/bin
export QCONFIG_DIR ?= /etc/quark
export QLOG_DIR ?= /var/log/quark
export ARCH ?= ${shell uname -m}
export RUST_TOOLCHAIN = nightly-2023-12-11-$(ARCH)-unknown-linux-gnu
#
# BUILD PATHS
# BUILD PATHS, used by this make process only
#
QKERNEL_BUILD = build
QTARGET_RELEASE = target/release
Expand All @@ -18,10 +19,6 @@ QUARK_DEBUG = $(QTARGET_DEBUG)/quark
QUARK_RELEASE = $(QTARGET_RELEASE)/quark
VDSO = vdso/vdso.so

ARCH := ${shell uname -m}
RUST_TOOLCHAIN = nightly-2023-12-11-$(ARCH)-unknown-linux-gnu


.PHONY: all release debug clean install qvisor_release qvisor_debug cuda_make cuda_all cleanall

all:: release debug
Expand All @@ -33,16 +30,16 @@ release:: qvisor_release qkernel_release $(VDSO)
debug:: qvisor_debug qkernel_debug $(VDSO)

qvisor_release:
make -C ./qvisor TOOLCHAIN=$(RUST_TOOLCHAIN) release
make -C ./qvisor release

qkernel_release:
make -C ./qkernel TOOLCHAIN=$(RUST_TOOLCHAIN) release
make -C ./qkernel release

qvisor_debug:
make -C ./qvisor TOOLCHAIN=$(RUST_TOOLCHAIN) debug
make -C ./qvisor debug

qkernel_debug:
make -C ./qkernel TOOLCHAIN=$(RUST_TOOLCHAIN) debug
make -C ./qkernel debug

$(VDSO):
make -C ./vdso
Expand All @@ -65,21 +62,21 @@ cuda_release:: qvisor_cuda_release qkernel_release cuda_make
cuda_debug:: qvisor_cuda_debug qkernel_debug cuda_make

qvisor_cuda_release:
make -C ./qvisor TOOLCHAIN=$(RUST_TOOLCHAIN) cuda_release
make -C ./qvisor cuda_release

qvisor_cuda_debug:
make -C ./qvisor TOOLCHAIN=$(RUST_TOOLCHAIN) cuda_debug
make -C ./qvisor cuda_debug

install:
-sudo cp -f $(QKERNEL_RELEASE) $(QBIN_DIR)/
-sudo cp -f $(QUARK_RELEASE) $(QBIN_DIR)/quark
-sudo cp -f $(QUARK_RELEASE) $(QBIN_DIR)/containerd-shim-quark-v1
-sudo cp -f $(QKERNEL_DEBUG) $(QBIN_DIR)/
-sudo cp -f $(QUARK_DEBUG) $(QBIN_DIR)/quark_d
-sudo cp -f $(QUARK_DEBUG) $(QBIN_DIR)/containerd-shim-quarkd-v1
sudo cp -f $(VDSO) $(QBIN_DIR)/vdso.so
sudo mkdir -p $(QCONFIG_DIR)
sudo cp -f config.json $(QCONFIG_DIR)
-cp -f $(QKERNEL_RELEASE) $(QBIN_DIR)/
-cp -f $(QUARK_RELEASE) $(QBIN_DIR)/quark
-cp -f $(QUARK_RELEASE) $(QBIN_DIR)/containerd-shim-quark-v1
-cp -f $(QKERNEL_DEBUG) $(QBIN_DIR)/
-cp -f $(QUARK_DEBUG) $(QBIN_DIR)/quark_d
-cp -f $(QUARK_DEBUG) $(QBIN_DIR)/containerd-shim-quarkd-v1
cp -f $(VDSO) $(QBIN_DIR)/vdso.so
mkdir -p $(QCONFIG_DIR)
cp -f config.json $(QCONFIG_DIR)

cuda_make:
make -C cudaproxy release
Expand Down
4 changes: 2 additions & 2 deletions qkernel/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ $(kernel_debug): kernel_debug $(assembly_object_files)
$(assembly_object_files) $(qkernel_debug)

kernel:
CARGO_TARGET_DIR=../target cargo +$(TOOLCHAIN) xbuild --target $(arch)-qkernel.json --release
CARGO_TARGET_DIR=../target cargo +$(RUST_TOOLCHAIN) xbuild --target $(arch)-qkernel.json --release

kernel_debug:
CARGO_TARGET_DIR=../target cargo +$(TOOLCHAIN) xbuild --target $(arch)-qkernel.json
CARGO_TARGET_DIR=../target cargo +$(RUST_TOOLCHAIN) xbuild --target $(arch)-qkernel.json

../build/arch/$(arch)/%.o: src/qlib/kernel/arch/$(arch)/%.s
@mkdir -p $(shell dirname $@)
Expand Down
21 changes: 21 additions & 0 deletions qvisor/Cargo.lock

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

1 change: 1 addition & 0 deletions qvisor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ rcublas-sys = { version = "0.5.0", optional = true }
cuda11-cublasLt-sys = { version = "0.3.0", optional = true }
libelf = { version = "0.1.0", optional = true }
io-uring = "0.6.3"
const_format = "0.2.32"

[features]
cuda = ["cuda-driver-sys", "cuda-runtime-sys", "libelf", "rcublas-sys", "cuda11-cublasLt-sys"]
Expand Down
8 changes: 4 additions & 4 deletions qvisor/makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.PHONY: debug release cuda_debug cuda_release

debug:
CARGO_TARGET_DIR=../target cargo +$(TOOLCHAIN) build
CARGO_TARGET_DIR=../target cargo +$(RUST_TOOLCHAIN) build

release:
CARGO_TARGET_DIR=../target cargo +$(TOOLCHAIN) build --release
CARGO_TARGET_DIR=../target cargo +$(RUST_TOOLCHAIN) build --release

cuda_debug:
CARGO_TARGET_DIR=../target cargo +$(TOOLCHAIN) build --features cuda
CARGO_TARGET_DIR=../target cargo +$(RUST_TOOLCHAIN) build --features cuda

cuda_release:
CARGO_TARGET_DIR=../target cargo +$(TOOLCHAIN) build --release --features cuda
CARGO_TARGET_DIR=../target cargo +$(RUST_TOOLCHAIN) build --release --features cuda
4 changes: 2 additions & 2 deletions qvisor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extern crate regex;
extern crate simplelog;
extern crate spin;
extern crate tabwriter;
#[macro_use]
extern crate const_format;

#[macro_use]
pub mod print;
Expand Down Expand Up @@ -169,8 +171,6 @@ lazy_static! {
);
}

pub const LOG_FILE: &'static str = "/var/log/quark/quark.log";

pub fn InitSingleton() {
self::qlib::InitSingleton();
}
Expand Down
11 changes: 8 additions & 3 deletions qvisor/src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ pub fn SetSyncPrint(syncPrint: bool) {
LOG.SetSyncPrint(syncPrint);
}

pub const LOG_FILE_DEFAULT: &str = "/var/log/quark/quark.log";
pub const RAWLOG_FILE_DEFAULT: &str = "/var/log/quark/raw.log";
pub const LOG_FILE_FORMAT: &str = "/var/log/quark/{}.log";

pub const LOG_DIR: &str = match option_env!("QLOG_DIR") {
Some(s) => s,
None => "/var/log/quark"
};
pub const LOG_FILE_DEFAULT: &str = concatcp!(LOG_DIR, "/quark.log");
pub const RAWLOG_FILE_DEFAULT: &str = concatcp!(LOG_DIR, "/raw.log");
pub const LOG_FILE_FORMAT: &str = concatcp!(LOG_DIR, "/{}.log");
pub const TIME_FORMAT: &str = "%H:%M:%S%.3f";

pub const MEMORY_LEAK_LOG: bool = false;
Expand Down
6 changes: 5 additions & 1 deletion qvisor/src/runc/cmd/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ impl CmdCmd {
}

impl Config {
pub const CONFIG_FILE: &'static str = "/etc/quark/config.json";
pub const CONFIG_DIR: &'static str = match option_env!("QCONFIG_DIR") {
Some(s) => s,
None => "/etc/quark"
};
pub const CONFIG_FILE: &'static str = concatcp!(Config::CONFIG_DIR, "/config.json");

// if the config file exist, load file and return true; otherwise return false
pub fn Load(&mut self) -> bool {
Expand Down
12 changes: 7 additions & 5 deletions qvisor/src/runc/runtime/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ impl VirtualMachine {
);
}

pub const QUARK_BIN_DIR: &'static str = match option_env!("QBIN_DIR") {
Some(s) => s,
None => "/usr/local/bin"
};
pub const VDSO_PATH: &'static str = concatcp!(VirtualMachine::QUARK_BIN_DIR, "/vdso.so");
#[cfg(debug_assertions)]
pub const KERNEL_IMAGE: &'static str = "/usr/local/bin/qkernel_d.bin";

pub const KERNEL_IMAGE: &'static str = concatcp!(VirtualMachine::QUARK_BIN_DIR, "/qkernel_d.bin");
#[cfg(not(debug_assertions))]
pub const KERNEL_IMAGE: &'static str = "/usr/local/bin/qkernel.bin";

pub const VDSO_PATH: &'static str = "/usr/local/bin/vdso.so";
pub const KERNEL_IMAGE: &'static str = concatcp!(VirtualMachine::QUARK_BIN_DIR, "/qkernel.bin");

pub fn InitShareSpace(
cpuCount: usize,
Expand Down