2018-09-19 16:51:50 +08:00
|
|
|
T := $(CURDIR)
|
|
|
|
OUT_DIR ?= $(shell mkdir -p $(T)/build;cd $(T)/build;pwd)
|
|
|
|
CC ?= gcc
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2018-09-19 16:51:50 +08:00
|
|
|
CFLAGS := -g -O0 -std=gnu11
|
|
|
|
CFLAGS += -D_GNU_SOURCE
|
|
|
|
CFLAGS += -DNO_OPENSSL
|
|
|
|
CFLAGS += -m64
|
|
|
|
CFLAGS += -Wall -ffunction-sections
|
|
|
|
CFLAGS += -Werror
|
|
|
|
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
|
|
|
|
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
|
|
|
|
CFLAGS += -fpie -fpic
|
|
|
|
#FIXME: remove me. work-around for system() calls, which will be removed
|
|
|
|
CFLAGS += -Wno-format-truncation -Wno-unused-result
|
2018-05-15 09:09:20 +08:00
|
|
|
|
2018-06-07 23:04:02 +08:00
|
|
|
CFLAGS += -I../../devicemodel/include
|
2018-06-23 00:08:59 +08:00
|
|
|
CFLAGS += -I../../devicemodel/include/public
|
2018-06-21 23:31:46 +08:00
|
|
|
CFLAGS += -I../../hypervisor/include
|
2018-09-19 16:51:50 +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
|
2018-06-21 23:31:46 +08:00
|
|
|
|
2018-06-07 23:04:02 +08:00
|
|
|
ifeq ($(RELEASE),0)
|
|
|
|
CFLAGS += -g -DMNGR_DEBUG
|
|
|
|
endif
|
|
|
|
|
2018-09-19 16:51:50 +08:00
|
|
|
LDFLAGS := -Wl,-z,noexecstack
|
|
|
|
LDFLAGS += -Wl,-z,relro,-z,now
|
2018-08-22 17:03:10 +08:00
|
|
|
LDFLAGS += -pie
|
2018-09-19 16:51:50 +08:00
|
|
|
LDFLAGS += -L$(OUT_DIR)
|
|
|
|
LDFLAGS += -lpthread
|
|
|
|
LDFLAGS += -lacrn-mngr
|
2018-06-07 23:04:02 +08:00
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
.PHONY: all
|
2018-06-21 23:31:46 +08:00
|
|
|
all: $(OUT_DIR)/libacrn-mngr.a $(OUT_DIR)/acrn_mngr.h $(OUT_DIR)/acrnctl $(OUT_DIR)/acrnd
|
2018-05-29 23:44:30 +08:00
|
|
|
|
|
|
|
$(OUT_DIR)/libacrn-mngr.a: acrn_mngr.c acrn_mngr.h
|
2018-06-07 23:04:02 +08:00
|
|
|
$(CC) $(CFLAGS) -c acrn_mngr.c -o $(OUT_DIR)/acrn_mngr.o
|
2018-06-01 16:32:07 +08:00
|
|
|
ar -cr $@ $(OUT_DIR)/acrn_mngr.o
|
2018-06-07 23:04:02 +08:00
|
|
|
|
|
|
|
ifneq ($(OUT_DIR),.)
|
2018-07-12 00:39:30 +08:00
|
|
|
$(OUT_DIR)/acrn_mngr.h: ./acrn_mngr.h
|
2018-05-30 02:16:56 +08:00
|
|
|
cp ./acrn_mngr.h $(OUT_DIR)/
|
2018-06-07 23:04:02 +08:00
|
|
|
endif
|
2018-05-29 23:44:30 +08:00
|
|
|
|
2018-06-07 23:04:02 +08:00
|
|
|
$(OUT_DIR)/acrnctl: acrnctl.c acrn_mngr.h $(OUT_DIR)/libacrn-mngr.a
|
|
|
|
$(CC) -o $(OUT_DIR)/acrnctl acrnctl.c acrn_vm_ops.c $(CFLAGS) $(LDFLAGS)
|
DM:tools: add acrnctl tool
The acrnctl can help user to create, delete, launch and stop UOSs,
To see what it can do, just run:
# acrnctl
or
# acrnctl help
you may see:
support:
list
start
stop
del
add
Use acrnctl [cmd] help for details
There are examples:
(1) add a VM
Each time you can just add one VM. Suppose you have an UOS
launch script, such as launch_UOS.sh
you can run:
# acrnctl add launch_UOS.sh -U 1
vm1-14:59:30 added
Note that, launch script shoud be able to launch ONE UOS. If
it fail, it is better to print some error logs, to tell user
the reason, so that he knows how to solve it.
The vmname is important, the acrnctl searchs VMs by their
names. so duplicated VM names are not allowed. Beside, if the
launch script changes VM name at launch time, acrnctl will
not recgonize it.
(2) delete VMs
# acrnctl del vm1-14:59:30
(3) show VMs
# acrnctl list
vm1-14:59:30 untracked
vm-yocto stop
vm-android stop
(4) start VM
you can start a vm with 'stop' status, each time can start
one VM.
# acrnctl start vm-yocto
(5) stop VM
you can stop VMs, if their status is not 'stop'
# acrnctl stop vm-yocto vm1-14:59:30 vm-android
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>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-04-03 21:43:00 +08:00
|
|
|
|
2018-06-21 23:31:46 +08:00
|
|
|
$(OUT_DIR)/acrnd: acrnd.c $(OUT_DIR)/libacrn-mngr.a
|
|
|
|
$(CC) -o $(OUT_DIR)/acrnd acrnd.c acrn_vm_ops.c $(CFLAGS) $(LDFLAGS)
|
|
|
|
ifneq ($(OUT_DIR),.)
|
|
|
|
cp ./acrnd.service $(OUT_DIR)/acrnd.service
|
|
|
|
endif
|
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
.PHONY: clean
|
DM:tools: add acrnctl tool
The acrnctl can help user to create, delete, launch and stop UOSs,
To see what it can do, just run:
# acrnctl
or
# acrnctl help
you may see:
support:
list
start
stop
del
add
Use acrnctl [cmd] help for details
There are examples:
(1) add a VM
Each time you can just add one VM. Suppose you have an UOS
launch script, such as launch_UOS.sh
you can run:
# acrnctl add launch_UOS.sh -U 1
vm1-14:59:30 added
Note that, launch script shoud be able to launch ONE UOS. If
it fail, it is better to print some error logs, to tell user
the reason, so that he knows how to solve it.
The vmname is important, the acrnctl searchs VMs by their
names. so duplicated VM names are not allowed. Beside, if the
launch script changes VM name at launch time, acrnctl will
not recgonize it.
(2) delete VMs
# acrnctl del vm1-14:59:30
(3) show VMs
# acrnctl list
vm1-14:59:30 untracked
vm-yocto stop
vm-android stop
(4) start VM
you can start a vm with 'stop' status, each time can start
one VM.
# acrnctl start vm-yocto
(5) stop VM
you can stop VMs, if their status is not 'stop'
# acrnctl stop vm-yocto vm1-14:59:30 vm-android
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>
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-04-03 21:43:00 +08:00
|
|
|
clean:
|
2018-05-17 03:21:45 +08:00
|
|
|
rm -f $(OUT_DIR)/acrnctl
|
2018-06-01 16:32:07 +08:00
|
|
|
rm -f $(OUT_DIR)/acrn_mngr.o
|
2018-05-29 23:44:30 +08:00
|
|
|
rm -f $(OUT_DIR)/libacrn-mngr.a
|
2018-09-19 16:51:50 +08:00
|
|
|
rm -f $(OUT_DIR)/acrnd
|
2018-06-07 23:04:02 +08:00
|
|
|
ifneq ($(OUT_DIR),.)
|
2018-06-04 15:57:25 +08:00
|
|
|
rm -f $(OUT_DIR)/acrn_mngr.h
|
2018-06-21 23:31:46 +08:00
|
|
|
rm -f $(OUT_DIR)/acrnd.service
|
2018-09-19 16:51:50 +08:00
|
|
|
rm -rf $(OUT_DIR)
|
2018-06-07 23:04:02 +08:00
|
|
|
endif
|
2018-05-17 03:21:45 +08:00
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
.PHONY: install
|
2018-07-31 15:01:51 +08:00
|
|
|
install: $(OUT_DIR)/acrnctl $(OUT_DIR)/acrn_mngr.h $(OUT_DIR)/libacrn-mngr.a
|
2018-05-17 03:21:45 +08:00
|
|
|
install -d $(DESTDIR)/usr/bin
|
2018-06-21 23:31:46 +08:00
|
|
|
install -d $(DESTDIR)/usr/lib/systemd/system
|
2018-07-31 15:01:51 +08:00
|
|
|
install -d $(DESTDIR)/usr/lib64/
|
|
|
|
install -d $(DESTDIR)/usr/include/acrn
|
2018-05-17 03:21:45 +08:00
|
|
|
install -t $(DESTDIR)/usr/bin $(OUT_DIR)/acrnctl
|
2018-06-21 23:31:46 +08:00
|
|
|
install -t $(DESTDIR)/usr/bin $(OUT_DIR)/acrnd
|
2018-07-31 15:01:51 +08:00
|
|
|
install -t $(DESTDIR)/usr/lib64/ $(OUT_DIR)/libacrn-mngr.a
|
|
|
|
install -t $(DESTDIR)/usr/include/acrn $(OUT_DIR)/acrn_mngr.h
|
2018-06-21 23:31:46 +08:00
|
|
|
install -p -D -m 0644 $(OUT_DIR)/acrnd.service $(DESTDIR)/usr/lib/systemd/system
|