-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (40 loc) · 1.64 KB
/
Makefile
File metadata and controls
52 lines (40 loc) · 1.64 KB
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
# Copyright 2024 Google LLC
#
# This project is dual-licensed under Apache 2.0 and MIT terms.
# See LICENSE-APACHE and LICENSE-MIT for details.
TARGET := --target aarch64-unknown-none
CROSVM_BIN := target/osdemo.crosvm.bin
CROSVM_RUSTFLAGS := "--cfg platform=\"crosvm\""
QEMU_BIN := target/osdemo.qemu.bin
QEMU_RUSTFLAGS := "--cfg platform=\"qemu\""
.PHONY: all build.qemu build.crosvm clean clippy crosvm qemu
all: $(CROSVM_BIN) $(QEMU_BIN)
clippy:
RUSTFLAGS=$(QEMU_RUSTFLAGS) cargo clippy $(TARGET)
build.crosvm:
RUSTFLAGS=$(CROSVM_RUSTFLAGS) cargo build $(TARGET)
build.qemu:
RUSTFLAGS=$(QEMU_RUSTFLAGS) cargo build $(TARGET)
$(CROSVM_BIN): build.crosvm
RUSTFLAGS=$(CROSVM_RUSTFLAGS) cargo objcopy $(TARGET) -- -O binary $@
$(QEMU_BIN): build.qemu
RUSTFLAGS=$(QEMU_RUSTFLAGS) cargo objcopy $(TARGET) -- -O binary $@
crosvm: $(CROSVM_BIN)
adb shell 'mkdir -p /data/local/tmp/virt_raw'
adb push $< /data/local/tmp/virt_raw/osdemo
adb shell "/apex/com.android.virt/bin/crosvm --log-level=info --extended-status run \
--disable-sandbox --bios=/data/local/tmp/virt_raw/osdemo --rwdisk=/dev/null" \
--cpus num-cores=4
qemu: $(QEMU_BIN)
qemu-system-aarch64 -machine virt,gic-version=3 -cpu max -display none -kernel $< -s \
-smp 4 -serial mon:stdio \
-global virtio-mmio.force-legacy=false \
-drive file=/dev/null,if=none,format=raw,id=x0 \
-device virtio-blk-device,drive=x0 \
-device virtio-serial,id=virtio-serial0 \
-chardev socket,path=/tmp/qemu-console,server=on,wait=off,id=char0,mux=on \
-device virtconsole,chardev=char0 \
-device vhost-vsock-device,id=virtiosocket0,guest-cid=102
clean:
cargo clean
rm -f target/*.bin