Add Hello World demo
This commit is contained in:
		
							parent
							
								
									347791f235
								
							
						
					
					
						commit
						ba78f09d1c
					
				
							
								
								
									
										2
									
								
								demo/hello_world/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								demo/hello_world/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | hello_world | ||||||
|  | occlum_workspace | ||||||
							
								
								
									
										26
									
								
								demo/hello_world/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										26
									
								
								demo/hello_world/Makefile
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
							
								
								
									
										6
									
								
								demo/hello_world/hello_world.c
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										6
									
								
								demo/hello_world/hello_world.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | #include <stdio.h> | ||||||
|  | 
 | ||||||
|  | int main() { | ||||||
|  |     printf("Hello World\n"); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user