Add simulation support for Occlum embedded mode demo
This commit is contained in:
parent
4ebedd9bf5
commit
15ce6efdc0
@ -1,3 +1,12 @@
|
||||
SGX_SDK ?= /opt/intel/sgxsdk
|
||||
SGX_MODE ?= HW
|
||||
|
||||
ifneq ($(SGX_MODE), HW)
|
||||
OCCLUM_LIB := /opt/occlum/build_sim/lib
|
||||
else
|
||||
OCCLUM_LIB := /opt/occlum/build/lib
|
||||
endif
|
||||
|
||||
.PHONY: all build_src test clean
|
||||
|
||||
all: occlum_context
|
||||
@ -16,7 +25,7 @@ build_src:
|
||||
|
||||
TOTAL_BYTES := 10000000000 # 10GB
|
||||
test:
|
||||
LD_LIBRARY_PATH=/opt/occlum/build/lib RUST_BACKTRACE=1 \
|
||||
LD_LIBRARY_PATH=$(OCCLUM_LIB):$(SGX_SDK)/sdk_libs RUST_BACKTRACE=1 \
|
||||
./bench_driver/build/bench_driver $(TOTAL_BYTES)
|
||||
|
||||
clean:
|
||||
|
@ -63,3 +63,9 @@ To run the benchmark, use the following command
|
||||
```
|
||||
make test
|
||||
```
|
||||
|
||||
To test in SGX simulation mode, use the following command
|
||||
```
|
||||
SGX_MODE=SIM make
|
||||
SGX_MODE=SIM make test
|
||||
```
|
@ -1,5 +1,6 @@
|
||||
SGX_SDK ?= /opt/intel/sgxsdk
|
||||
OCCLUM_PREFIX ?= /opt/occlum
|
||||
SGX_MODE ?= HW
|
||||
|
||||
BUILD_DIR := build
|
||||
BIN := $(BUILD_DIR)/bench_driver
|
||||
@ -7,12 +8,22 @@ BIN := $(BUILD_DIR)/bench_driver
|
||||
C_SRCS := $(sort $(wildcard *.c))
|
||||
C_OBJS := $(addprefix $(BUILD_DIR)/,$(C_SRCS:.c=.o))
|
||||
|
||||
ifneq ($(SGX_MODE), HW)
|
||||
URTS_LIBRARY_NAME := sgx_urts_sim
|
||||
UAE_SERVICE_LIBRARY_NAME := sgx_uae_service_sim
|
||||
OCCLUM_BUILD := build_sim
|
||||
else
|
||||
URTS_LIBRARY_NAME := sgx_urts
|
||||
UAE_SERVICE_LIBRARY_NAME := sgx_uae_service
|
||||
OCCLUM_BUILD := build
|
||||
endif
|
||||
|
||||
C_FLAGS := -Wall \
|
||||
-I$(SGX_SDK)/include \
|
||||
-I$(OCCLUM_PREFIX)/include
|
||||
LINK_FLAGS := $(C_FLAGS) -lpthread \
|
||||
-L$(SGX_SDK)/lib64 -lsgx_urts -lsgx_uprotected_fs \
|
||||
-L$(OCCLUM_PREFIX)/build/lib -locclum-pal
|
||||
-L$(SGX_SDK)/lib64 -l$(URTS_LIBRARY_NAME) -l$(UAE_SERVICE_LIBRARY_NAME) -lsgx_uprotected_fs \
|
||||
-L$(OCCLUM_PREFIX)/$(OCCLUM_BUILD)/lib -locclum-pal
|
||||
|
||||
ALL_BUILD_SUBDIRS := $(sort $(patsubst %/,%,$(dir $(BIN) $(C_OBJS))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user