forked from kuasar-io/kuasar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (59 loc) · 2.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
HYPERVISOR ?= cloud_hypervisor
GUESTOS_IMAGE ?= centos
WASM_RUNTIME ?= wasmedge
KERNEL_VERSION ?= 6.2
.PHONY: vmm wasm quark clean all install-vmm install-wasm install-quark install
all: vmm quark wasm
bin/vmm-sandboxer:
@cd vmm && cargo build --release --features=${HYPERVISOR}
@mkdir -p bin && cp vmm/target/release/vmm-sandboxer bin/vmm-sandboxer
bin/vmm-task:
@cd vmm/task && cargo build --release --target=x86_64-unknown-linux-musl
@mkdir -p bin && cp vmm/target/x86_64-unknown-linux-musl/release/vmm-task bin/vmm-task
bin/vmlinux.bin:
@bash -x vmm/scripts/kernel/${HYPERVISOR}/build.sh ${KERNEL_VERSION}
@mkdir -p bin && cp vmm/scripts/kernel/${HYPERVISOR}/vmlinux.bin bin/vmlinux.bin && rm vmm/scripts/kernel/${HYPERVISOR}/vmlinux.bin
bin/kuasar.img:
@bash -x vmm/scripts/image/${GUESTOS_IMAGE}/build.sh image
@mkdir -p bin && cp /tmp/kuasar.img bin/kuasar.img && rm /tmp/kuasar.img
bin/kuasar.initrd:
@bash -x vmm/scripts/image/${GUESTOS_IMAGE}/build.sh initrd
@mkdir -p bin && cp /tmp/kuasar.initrd bin/kuasar.initrd && rm /tmp/kuasar.initrd
bin/wasm-sandboxer:
@cd wasm && cargo build --release --features=${WASM_RUNTIME}
@mkdir -p bin && cp wasm/target/release/wasm-sandboxer bin/wasm-sandboxer
bin/quark-sandboxer:
@cd quark && cargo build --release
@mkdir -p bin && cp quark/target/release/quark-sandboxer bin/quark-sandboxer
wasm: bin/wasm-sandboxer
quark: bin/quark-sandboxer
ifeq ($(HYPERVISOR), "stratovirt")
vmm: bin/vmm-sandboxer bin/kuasar.initrd bin/vmlinux.bin
else
vmm: bin/vmm-sandboxer bin/kuasar.img bin/vmlinux.bin
endif
clean:
@rm -rf bin
@cd vmm && cargo clean
@cd wasm && cargo clean
@cd quark && cargo clean
ifeq ($(HYPERVISOR), "stratovirt")
install-vmm:
@install -p -m 755 bin/vmm-sandboxer /usr/local/bin/vmm-sandboxer
@install -d /var/lib/kuasar
@install -p -m 644 bin/vmlinux.bin /var/lib/kuasar/vmlinux.bin
@install -p -m 644 bin/kuasar.img /var/lib/kuasar/kuasar.initrd
@install -p -m 644 vmm/sandbox/config_stratovirt.toml /var/lib/kuasar/config_stratovirt.toml
else
install-vmm:
@install -p -m 755 bin/vmm-sandboxer /usr/local/bin/vmm-sandboxer
@install -d /var/lib/kuasar
@install -p -m 644 bin/vmlinux.bin /var/lib/kuasar/vmlinux.bin
@install -p -m 644 bin/kuasar.img /var/lib/kuasar/kuasar.img
@install -p -m 644 vmm/sandbox/config_clh.toml /var/lib/kuasar/config_clh.toml
endif
install-wasm:
@install -p -m 755 bin/wasm-sandboxer /usr/local/bin/wasm-sandboxer
install-quark:
@install -p -m 755 bin/quark-sandboxer /usr/local/bin/quark-sandboxer
install: all install-vmm install-wasm install-quark