diff --git a/demo/hello_world/.gitignore b/demo/hello_world/.gitignore new file mode 100644 index 00000000..8a12aa82 --- /dev/null +++ b/demo/hello_world/.gitignore @@ -0,0 +1,2 @@ +hello_world +occlum_workspace diff --git a/demo/hello_world/Makefile b/demo/hello_world/Makefile new file mode 100644 index 00000000..a828241e --- /dev/null +++ b/demo/hello_world/Makefile @@ -0,0 +1,26 @@ +CC := musl-clang +CFLAGS := -fPIC -pie + +.PHONY: all test test-native clean + +all: hello_world + +hello_world: hello_world.c + $(CC) $(CFLAGS) $^ -o $@ + +# Run hello_world on Occlum inside an SGX enclave +test: + rm -rf occlum_workspace + mkdir occlum_workspace + cd occlum_workspace && \ + occlum init && \ + cp ../hello_world image/bin && \ + occlum build && \ + occlum run /bin/hello_world + +# Run hello_world on the native OS (e.g., Linux) +test-native: + ./hello_world + +clean: + rm -rf hello_world occlum_workspace diff --git a/demo/hello_world/hello_world.c b/demo/hello_world/hello_world.c new file mode 100644 index 00000000..744d6ffb --- /dev/null +++ b/demo/hello_world/hello_world.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello World\n"); + return 0; +}