[Makefiles] Get arch and distro specific vars from Makefile.configs

Extend Makefile.configs and define several variables for make to use
derived from 'gcc -dumpmachine'. In particular:
- ARCH as the architecture, e.g., x86_64
- ARCH_LONG as the long version of the architecture, e.g., x86_64-linux-gnu
- ARCH_LIBDIR as the directory where libraries are located,
  e.g., /lib/x86_64-linux-gnu

In Makefiles and manifest templates, replace the hard-coded
x86_64-linux_gnu and /lib/x86_64-linux-gnu through these variables.
Extend the already existing sed scripts to replace the necessary
variables.
This commit is contained in:
Stefan Berger
2020-04-27 16:05:00 +00:00
committed by Dmitrii Kuvaiskii
parent b8bfb52520
commit 206eb81eec
54 changed files with 308 additions and 233 deletions
+4 -1
View File
@@ -26,6 +26,8 @@ ifeq ($(SGX),1)
all: nodejs.token
endif
include ../../Scripts/Makefile.configs
# Node.js dependencies (generated from ldd). For SGX, the manifest needs to list all the libraries
# loaded during execution, so that the signer can include the file hashes.
@@ -55,6 +57,7 @@ nodejs.manifest: nodejs.manifest.template nodejs-trusted-libs
-e 's|$$(GRAPHENEDEBUG)|'"$(GRAPHENEDEBUG)"'|g' \
-e 's|$$(NODEJS_DIR)|'"$(NODEJS_DIR)"'|g' \
-e 's|$$(NODEJS_TRUSTED_LIBS)|'"`cat nodejs-trusted-libs`"'|g' \
-e 's|$$(ARCH_LIBDIR)|'"$(ARCH_LIBDIR)"'|g' \
$< > $@
# Generate SGX-specific manifest, enclave signature, and token for enclave initialization
@@ -77,7 +80,7 @@ pal_loader:
.PHONY: check
check: all
./pal_loader nodejs.manifest helloworld.js 3000 & SERVER_ID=$$!; \
sleep 30; \
sleep 3; \
curl localhost:3000 > OUTPUT; \
kill -9 $$SERVER_ID;
@grep -q "Hello World!" OUTPUT && echo "[ Success 1/1 ]"
@@ -16,7 +16,7 @@ loader.debug_type = $(GRAPHENEDEBUG)
# Specify paths to search for libraries. The usual LD_LIBRARY_PATH syntax
# applies. Paths must be in-Graphene visible paths, not host-OS paths (i.e.,
# paths must be taken from fs.mount.xxx.path, not fs.mount.xxx.uri).
loader.env.LD_LIBRARY_PATH = /lib:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu
loader.env.LD_LIBRARY_PATH = /lib:$(ARCH_LIBDIR):/usr/$(ARCH_LIBDIR)
# Mount host-OS directory to required libraries (in 'uri') into in-Graphene
# visible directory /lib (in 'path').
@@ -25,12 +25,12 @@ fs.mount.lib.path = /lib
fs.mount.lib.uri = file:$(GRAPHENEDIR)/Runtime
fs.mount.lib2.type = chroot
fs.mount.lib2.path = /lib/x86_64-linux-gnu
fs.mount.lib2.uri = file:/lib/x86_64-linux-gnu
fs.mount.lib2.path = $(ARCH_LIBDIR)
fs.mount.lib2.uri = file:$(ARCH_LIBDIR)
fs.mount.lib3.type = chroot
fs.mount.lib3.path = /usr/lib/x86_64-linux-gnu
fs.mount.lib3.uri = file:/usr/lib/x86_64-linux-gnu
fs.mount.lib3.path = /usr/$(ARCH_LIBDIR)
fs.mount.lib3.uri = file:/usr/$(ARCH_LIBDIR)
# Set enclave size to 2GB. Recall that SGX v1 requires to specify enclave size at
# enclave creation time.