2018-03-07 21:01:19 +08:00
|
|
|
#
|
|
|
|
# ACRN-DM
|
|
|
|
#
|
|
|
|
MAJOR_VERSION=0
|
|
|
|
MINOR_VERSION=1
|
2018-04-13 17:28:26 +08:00
|
|
|
RC_VERSION=4
|
2018-03-07 21:01:19 +08:00
|
|
|
BASEDIR := $(shell pwd)
|
|
|
|
DM_OBJDIR ?= $(CURDIR)/build
|
|
|
|
|
2018-03-28 12:47:25 +08:00
|
|
|
CC ?= gcc
|
2018-03-07 21:01:19 +08:00
|
|
|
|
|
|
|
CFLAGS := -g -O0 -std=gnu11
|
|
|
|
CFLAGS += -D_GNU_SOURCE
|
|
|
|
CFLAGS += -DNO_OPENSSL
|
|
|
|
CFLAGS += -m64
|
|
|
|
CFLAGS += -Wall -ffunction-sections
|
|
|
|
CFLAGS += -Werror
|
2018-03-13 17:02:51 +08:00
|
|
|
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
|
2018-04-12 11:36:28 +08:00
|
|
|
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
|
2018-03-07 21:01:19 +08:00
|
|
|
|
|
|
|
CFLAGS += -I$(BASEDIR)/include
|
|
|
|
CFLAGS += -I$(BASEDIR)/include/public
|
|
|
|
|
2018-02-11 15:51:35 +08:00
|
|
|
GCC_MAJOR=$(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1)
|
|
|
|
GCC_MINOR=$(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
|
|
|
|
|
|
|
|
#enable stack overflow check
|
|
|
|
STACK_PROTECTOR := 1
|
|
|
|
|
|
|
|
ifdef STACK_PROTECTOR
|
|
|
|
ifeq (true, $(shell [ $(GCC_MAJOR) -gt 4 ] && echo true))
|
|
|
|
CFLAGS += -fstack-protector-strong
|
|
|
|
else
|
|
|
|
ifeq (true, $(shell [ $(GCC_MAJOR) -eq 4 ] && [ $(GCC_MINOR) -ge 9 ] && echo true))
|
|
|
|
CFLAGS += -fstack-protector-strong
|
|
|
|
else
|
|
|
|
CFLAGS += -fstack-protector
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
LDFLAGS += -Wl,-z,noexecstack
|
2018-02-11 16:35:15 +08:00
|
|
|
LDFLAGS += -Wl,-z,relro,-z,now
|
2018-02-11 15:51:35 +08:00
|
|
|
|
2018-03-07 21:01:19 +08:00
|
|
|
LIBS = -lrt
|
|
|
|
LIBS += -lpthread
|
|
|
|
LIBS += -lcrypto
|
|
|
|
LIBS += -lpciaccess
|
|
|
|
LIBS += -lz
|
|
|
|
LIBS += -luuid
|
2018-04-14 11:22:07 +08:00
|
|
|
LIBS += -lusb-1.0
|
2018-03-07 21:01:19 +08:00
|
|
|
|
|
|
|
# hw
|
2018-05-09 11:30:55 +08:00
|
|
|
SRCS += hw/block_if.c
|
|
|
|
SRCS += hw/usb_core.c
|
|
|
|
SRCS += hw/uart_core.c
|
2018-03-07 21:01:19 +08:00
|
|
|
SRCS += hw/pci/virtio/virtio.c
|
|
|
|
SRCS += hw/pci/virtio/virtio_kernel.c
|
|
|
|
SRCS += hw/platform/usb_mouse.c
|
2018-04-15 17:59:21 +08:00
|
|
|
SRCS += hw/platform/usb_pmapper.c
|
2018-03-07 21:01:19 +08:00
|
|
|
SRCS += hw/platform/atkbdc.c
|
|
|
|
SRCS += hw/platform/ps2mouse.c
|
|
|
|
SRCS += hw/platform/rtc.c
|
|
|
|
SRCS += hw/platform/ps2kbd.c
|
|
|
|
SRCS += hw/platform/ioapic.c
|
|
|
|
SRCS += hw/platform/cmos_io.c
|
2018-04-10 19:14:38 +08:00
|
|
|
SRCS += hw/platform/ioc.c
|
2018-04-13 14:55:21 +08:00
|
|
|
SRCS += hw/platform/ioc_cbc.c
|
2018-05-09 11:30:55 +08:00
|
|
|
SRCS += hw/platform/acpi/acpi.c
|
|
|
|
SRCS += hw/platform/acpi/acpi_pm.c
|
2018-05-28 05:32:06 +08:00
|
|
|
SRCS += hw/platform/rpmb/rpmb_sim.c
|
|
|
|
SRCS += hw/platform/rpmb/rpmb_backend.c
|
2018-03-07 21:01:19 +08:00
|
|
|
SRCS += hw/pci/wdt_i6300esb.c
|
|
|
|
SRCS += hw/pci/lpc.c
|
|
|
|
SRCS += hw/pci/xhci.c
|
|
|
|
SRCS += hw/pci/core.c
|
|
|
|
SRCS += hw/pci/virtio/virtio_console.c
|
|
|
|
SRCS += hw/pci/virtio/virtio_block.c
|
2018-04-16 08:35:23 +08:00
|
|
|
SRCS += hw/pci/virtio/virtio_input.c
|
2018-03-07 21:01:19 +08:00
|
|
|
SRCS += hw/pci/ahci.c
|
|
|
|
SRCS += hw/pci/hostbridge.c
|
|
|
|
SRCS += hw/pci/passthrough.c
|
|
|
|
SRCS += hw/pci/virtio/virtio_net.c
|
|
|
|
SRCS += hw/pci/virtio/virtio_rnd.c
|
|
|
|
SRCS += hw/pci/virtio/virtio_hyper_dmabuf.c
|
2017-11-23 09:27:01 +08:00
|
|
|
SRCS += hw/pci/virtio/virtio_heci.c
|
2018-05-16 10:41:33 +08:00
|
|
|
SRCS += hw/pci/virtio/virtio_rpmb.c
|
2018-03-07 21:01:19 +08:00
|
|
|
SRCS += hw/pci/irq.c
|
|
|
|
SRCS += hw/pci/uart.c
|
2018-03-29 23:05:04 +08:00
|
|
|
SRCS += hw/pci/gvt.c
|
2018-03-07 21:01:19 +08:00
|
|
|
|
|
|
|
# core
|
|
|
|
#SRCS += core/bootrom.c
|
monitor: an interface of acrn-dm
A monitor component will be added to acrn-dm, which crteats socket,
bind and listening at /run/acrn/vmname. Acrnctl & acrnd could conn
-ect to the socket for communication, using defined message, in
include/monitor_msg.h
For each defined message, a message handler callback could be
registered via monitor_add_msg_handler(). On received of a defined
message, a certain call back will be called. Each callback can only
see the message sender's socket-fd.
When acrn-dm want report something, not triggered by incoming message
it can send broadcast message, use monitor_broadcast().
Acked-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Yin, Fengwei <fengwei.yin@intel.com>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-04-03 02:57:47 +08:00
|
|
|
SRCS += core/monitor.c
|
2018-03-21 14:57:44 +08:00
|
|
|
SRCS += core/sw_load_common.c
|
|
|
|
SRCS += core/sw_load_bzimage.c
|
2018-03-21 15:13:02 +08:00
|
|
|
SRCS += core/sw_load_vsbl.c
|
2018-03-07 21:01:19 +08:00
|
|
|
SRCS += core/smbiostbl.c
|
|
|
|
SRCS += core/mevent.c
|
|
|
|
SRCS += core/gc.c
|
|
|
|
SRCS += core/console.c
|
|
|
|
SRCS += core/inout.c
|
|
|
|
SRCS += core/mem.c
|
|
|
|
SRCS += core/post.c
|
|
|
|
SRCS += core/consport.c
|
|
|
|
SRCS += core/vmmapi.c
|
|
|
|
SRCS += core/mptbl.c
|
|
|
|
SRCS += core/main.c
|
2018-03-14 22:03:52 +08:00
|
|
|
SRCS += core/hugetlb.c
|
2018-05-15 14:28:38 +08:00
|
|
|
SRCS += core/vrpmb.c
|
2018-03-07 21:01:19 +08:00
|
|
|
|
2018-05-09 11:30:55 +08:00
|
|
|
# arch
|
|
|
|
SRCS += arch/x86/pm.c
|
|
|
|
|
|
|
|
|
2018-03-07 21:01:19 +08:00
|
|
|
OBJS := $(patsubst %.c,$(DM_OBJDIR)/%.o,$(SRCS))
|
|
|
|
|
|
|
|
HEADERS := $(shell find $(BASEDIR) -name '*.h')
|
|
|
|
DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
|
|
|
|
|
|
|
|
PROGRAM := acrn-dm
|
|
|
|
|
2018-05-24 16:16:57 +08:00
|
|
|
SAMPLES_NUC := $(wildcard samples/nuc/*)
|
|
|
|
SAMPLES_MRB := $(wildcard samples/apl-mrb/*)
|
2018-03-08 12:21:59 +08:00
|
|
|
|
2018-03-07 21:01:19 +08:00
|
|
|
all: include/version.h $(PROGRAM)
|
|
|
|
@echo -n ""
|
|
|
|
|
|
|
|
$(PROGRAM): $(OBJS)
|
|
|
|
$(CC) -o $(DM_OBJDIR)/$@ $(CFLAGS) $(LDFLAGS) $^ $(LIBS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJS)
|
|
|
|
rm -f include/version.h
|
|
|
|
rm -f $(OBJS)
|
|
|
|
rm -rf $(DM_OBJDIR)
|
|
|
|
if test -f $(PROGRAM); then rm $(PROGRAM); fi
|
|
|
|
|
|
|
|
distclean:
|
|
|
|
rm -f $(DISTCLEAN_OBJS)
|
|
|
|
rm -f include/version.h
|
|
|
|
rm -f $(OBJS)
|
|
|
|
rm -rf $(DM_OBJDIR)
|
|
|
|
rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS GPATH GRTAGS GSYMS
|
|
|
|
|
|
|
|
include/version.h:
|
|
|
|
touch include/version.h
|
|
|
|
@COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\
|
|
|
|
DIRTY=`git diff-index --name-only HEAD`;\
|
|
|
|
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
|
|
|
|
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
|
2018-05-15 16:24:47 +08:00
|
|
|
echo "/*" > include/version.h; \
|
|
|
|
sed 's/^/ * /' ../LICENSE >> include/version.h; \
|
|
|
|
echo " */" >> include/version.h; \
|
|
|
|
echo "" >> include/version.h; \
|
2018-03-07 21:01:19 +08:00
|
|
|
echo "#define DM_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\
|
|
|
|
echo "#define DM_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\
|
2018-03-08 17:48:40 +08:00
|
|
|
echo "#define DM_RC_VERSION $(RC_VERSION)" >> include/version.h;\
|
2018-03-07 21:01:19 +08:00
|
|
|
echo "#define DM_BUILD_VERSION "\""$$PATCH"\""" >> include/version.h;\
|
|
|
|
echo "#define DM_BUILD_TIME "\""$$TIME"\""" >> include/version.h;\
|
|
|
|
echo "#define DM_BUILD_USER "\""$(USER)"\""" >> include/version.h
|
|
|
|
|
|
|
|
$(DM_OBJDIR)/%.o: %.c $(HEADERS)
|
|
|
|
[ ! -e $@ ] && mkdir -p $(dir $@); \
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2018-05-24 16:16:57 +08:00
|
|
|
install: $(DM_OBJDIR)/$(PROGRAM) install-samples-nuc install-samples-mrb
|
|
|
|
install -D --mode=0755 $(DM_OBJDIR)/$(PROGRAM) $(DESTDIR)/usr/bin/$(PROGRAM)
|
2018-03-08 12:21:59 +08:00
|
|
|
|
2018-05-24 16:16:57 +08:00
|
|
|
install-samples-nuc: $(SAMPLES_NUC)
|
|
|
|
install -D -t $(DESTDIR)/usr/share/acrn/samples/nuc $^
|
|
|
|
|
|
|
|
install-samples-mrb: $(SAMPLES_MRB)
|
|
|
|
install -D -t $(DESTDIR)/usr/share/acrn/samples/apl-mrb $^
|