-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (49 loc) · 1.93 KB
/
Copy pathMakefile
File metadata and controls
61 lines (49 loc) · 1.93 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
53
54
55
56
57
58
59
60
61
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
TARGET := --target aarch64-unknown-none
HOST_TARGET := $(shell rustc -vV | sed -n 's/^host: //p')
PLATFORM ?= qemu
PAYLOAD ?=
BIN := target/ritm.$(PLATFORM).bin
ELF := target/aarch64-unknown-none/debug/ritm
PLATFORM_BUILD_ENV = RUSTFLAGS='--cfg platform="$(1)"'
BUILD_ENV = $(call PLATFORM_BUILD_ENV,$(PLATFORM))
ifneq ($(strip $(PAYLOAD)),)
PLATFORM_BUILD_ENV += RITM_PAYLOAD='$(abspath $(PAYLOAD))'
endif
.PHONY: all build clean clippy clippy-fix qemu test
all: $(BIN)
clippy:
$(BUILD_ENV) cargo clippy $(TARGET)
clippy-fix:
$(BUILD_ENV) cargo clippy --fix $(TARGET)
build:
$(BUILD_ENV) cargo build $(TARGET)
target/ritm.%.bin:
$(call PLATFORM_BUILD_ENV,$*) cargo build $(TARGET)
$(call PLATFORM_BUILD_ENV,$*) cargo objcopy $(TARGET) -- -O binary $@
# RITM does not configure SVE or pointer authentication state for EL1 guests yet.
qemu: build
@test -n "$(strip $(PAYLOAD))" || { echo "PAYLOAD is required for make qemu"; exit 2; }
qemu-system-aarch64 -machine virt,virtualization=on,gic-version=3 -cpu cortex-a57 -display none -net none -kernel $(ELF) -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 \
-append "ritm.boot_mode=el1"
test:
cargo test -p memory_access --target $(HOST_TARGET)
tests/integration_test.py
tests/psci_test.py
clean:
cargo clean
rm -f target/*.bin