Skip to content

Commit

Permalink
Add Makefile snippet for libvmm.a (#46)
Browse files Browse the repository at this point in the history
* Add Makefile snippet for libvmm.a

To use this, in your project Makefile add:

LionsOS := <path-to-top-of-LionsOS-tree>
vmm: libvmm.a
include ${LionsOS}/vmm.mk

Signed-off-by: Peter Chubb <[email protected]>

* 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 <[email protected]>

* Fix typo

Include auto-generated dependencies properly.

Signed-off-by: Peter Chubb <[email protected]>

* Add clean and clobber targets

Signed-off-by: Peter Chubb <[email protected]>

* Get rid of LionsOS mentions

Always require SDDF variable to be set before including this snippet.

Signed-off-by: Peter Chubb <[email protected]>

---------

Signed-off-by: Peter Chubb <[email protected]>
Signed-off-by: Peter Chubb <[email protected]>
  • Loading branch information
wom-bat authored Mar 25, 2024
1 parent 4b53eaa commit dcdcb23
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions vmm.mk
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dcdcb23

Please sign in to comment.