From dcdcb234795da757c31883b9e97ccd0ad3227a7f Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Mon, 25 Mar 2024 12:58:19 +1100 Subject: [PATCH] Add Makefile snippet for libvmm.a (#46) * Add Makefile snippet for libvmm.a To use this, in your project Makefile add: LionsOS := vmm: libvmm.a include ${LionsOS}/vmm.mk Signed-off-by: Peter Chubb * Don't require knowledge of LionsOS Instead allow the SDDF variable to be set by an including Makefile, or (_if_ vmm is being build as a LionsOS component) infer the value of SDDF Signed-off-by: Peter Chubb * Fix typo Include auto-generated dependencies properly. Signed-off-by: Peter Chubb * Add clean and clobber targets Signed-off-by: Peter Chubb * Get rid of LionsOS mentions Always require SDDF variable to be set before including this snippet. Signed-off-by: Peter Chubb --------- Signed-off-by: Peter Chubb Signed-off-by: Peter Chubb --- vmm.mk | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 vmm.mk diff --git a/vmm.mk b/vmm.mk new file mode 100644 index 00000000..99ae998b --- /dev/null +++ b/vmm.mk @@ -0,0 +1,66 @@ +# +# Copyright 2024, UNSW (ABN 57 195 873 179) +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Snippet to build libvmm.a, to be included in a full-system Makefile. +# Needs the variable LionsOS to point to the top of the LionsOS tree. +# +V3_BOARDS := BOARD_imx8mm_evk +ifeq ($(filter ${MICROKIT_BOARD},${V3_BOARDS}),) + VGIC := GIC_V2 + VGIC_FILES := src/arch/aarch64/vgic/vgic_v2.c +else + VGIC := GIC_V3 + VGIC_FILES := src/arch/aarch64/vgic/vgic_v3.c +endif + +AARCH64_FILES := src/arch/aarch64/fault.c \ + src/arch/aarch64/linux.c \ + src/arch/aarch64/linux.c \ + src/arch/aarch64/psci.c \ + src/arch/aarch64/smc.c \ + src/arch/aarch64/tcb.c \ + src/arch/aarch64/vcpu.c \ + src/arch/aarch64/virq.c \ + src/arch/aarch64/vgic/vgic.c \ + ${VGIC_FILES} + +# VIRTIO MMIO depends on sddf +ifeq ($(strip $(SDDF)),) + $(error libvmm needs the location of the SDDF to build virtIO components) +endif + +CFLAGS += -I${SDDF}/include + +ARCH_INDEP_FILES := src/util/printf.c \ + src/util/util.c \ + src/virtio/console.c \ + src/virtio/mmio.c \ + src/virtio/virtio.c \ + src/guest.c + +CFILES := ${AARCH64_FILES} ${ARCH_INDEP_FILES} +OBJECTS := ${CFILES:.c=.o} + +# Generate dependencies automatically +CFLAGS += -MD + +src/arch/aarch64/vgic/stamp: + mkdir -p src/arch/aarch64/vgic/ + mkdir -p src/util + mkdir -p src/virtio + touch $@ + +libvmm.a: ${OBJECTS} + ar rv $@ ${CFILES:.c=.o} + +${OBJECTS}: src/arch/aarch64/vgic/stamp + +-include ${CFILES:.c=.d} + +clean:: + rm -f ${OBJECTS} ${CFILES:.c=.d} + +clobber:: clean + rm -f src/arch/aarch64/vgic/stamp