From c6d4a34b7f7ba7bbb5c39e6c03fda96ae2a58ee9 Mon Sep 17 00:00:00 2001 From: "Hui, Chunyang" Date: Mon, 14 Sep 2020 09:12:43 +0000 Subject: [PATCH] Modify rpm installer to align with current intallation structure --- tools/installer/README.md | 13 ++++++-- tools/installer/rpm/Makefile | 33 +++++++------------ ...tform-filelist => occlum-runtime-filelist} | 0 .../{occlum-platform.sh => occlum-runtime.sh} | 0 tools/installer/rpm/occlum.spec | 32 +++++++++++++----- .../rpm/tools/occlum-sgx-tools-filelist | 7 ---- .../installer/rpm/tools/occlum-sgx-tools.spec | 29 ---------------- 7 files changed, 44 insertions(+), 70 deletions(-) rename tools/installer/rpm/{occlum-platform-filelist => occlum-runtime-filelist} (100%) rename tools/installer/rpm/{occlum-platform.sh => occlum-runtime.sh} (100%) delete mode 100644 tools/installer/rpm/tools/occlum-sgx-tools-filelist delete mode 100644 tools/installer/rpm/tools/occlum-sgx-tools.spec diff --git a/tools/installer/README.md b/tools/installer/README.md index d624c58a..b3c88fcc 100644 --- a/tools/installer/README.md +++ b/tools/installer/README.md @@ -49,14 +49,17 @@ Also, UAE service libraries are needed but may not installed together with SGX P rpm -i libsgx-uae-service-2.9.101.2-1.el7.x86_64.rpm ``` -**Step 3. Install Occlum Installer and Toolchains Installer** +**Step 3. Install enable_RDFSBASE Kernel Module** +Please follow [this README](https://github.com/occlum/enable_rdfsbase/blob/master/README.md) to install `enable_rdfsbase` kernel module. + +**Step 4. Install Occlum Installer and Toolchains Installer** ``` rpm -i occlum-sgx-tools-*.rpm rpm -i occlum-pal-*.rpm rpm -i occlum-runtime-*.rpm ``` -Toolchains are needed when compile applications and also during runtime. Choose to install the toolchain installer based on the application's language. Currently, we only supports `C/C++`. More language toolchain installers are on the way. To install `C/C++` toolchain, just run the command: +Toolchains are needed when compiling applications and also during runtime. Choose to install the toolchain installer based on the application's language. Currently, we only supports `C/C++`. More language toolchain installers are on the way. To install `C/C++` toolchain, just run the command: ``` rpm -i occlum-toolchains-gcc-*.rpm ``` @@ -71,7 +74,11 @@ To make the new installed binaries and libraries work, this command must be exec source /etc/profile ``` -Finally, you are good to go! +**Step 5. Install Debug Packages (OPTIONAL)** +If users want to debug the application running inside the libos, debug packages are also needed. Just run: +``` +rpm -i occlum-debuginfo*.rpm occlum-debugsource*.rpm occlum-pal-debuginfo*.rpm occlum-runtime-debuginfo*.rpm occlum-sgx-tools-debuginfo*.rpm occlum-toolchains-gcc-debuginfo*.rpm occlum-toolchains-gcc-debugsource*.rpm +``` ## DEB Installer diff --git a/tools/installer/rpm/Makefile b/tools/installer/rpm/Makefile index af524b94..f760cff9 100644 --- a/tools/installer/rpm/Makefile +++ b/tools/installer/rpm/Makefile @@ -7,19 +7,20 @@ MINOR_VER_NUM = $(shell grep '\#define OCCLUM_MINOR_VERSION' $(PROJECT_DIR)/src/ PATCH_VER_NUM = $(shell grep '\#define OCCLUM_PATCH_VERSION' $(PROJECT_DIR)/src/pal/include/occlum_version.h | awk '{print $$3}') VERSION_NUM := $(MAJOR_VER_NUM).$(MINOR_VER_NUM).$(PATCH_VER_NUM) -RPM_FILELIST = occlum-filelist occlum-pal-filelist occlum-platform-filelist -EXPORT_SCRIPT = occlum-pal.sh occlum-platform.sh +# Occlum specific version +MUSL_VERSION = 0.15.0 + +RPM_FILELIST = occlum-filelist occlum-pal-filelist occlum-runtime-filelist +EXPORT_SCRIPT = occlum-pal.sh occlum-runtime.sh GCC_PATCH = toolchains/gcc/musl-cross-make-disable-download.patch GCC_SCRIPT = toolchains/gcc/occlum-gcc.sh -SGX_TOOLS_FILELIST = tools/occlum-sgx-tools-filelist - PACKAGE_DIR = /tmp -.PHONY: all main main_deps c/c++ deps_c tools clean +.PHONY: all main main_deps c/c++ deps_c clean -all: tools main +all: main main: main_deps @mkdir -p $(TARGET_DIR) @@ -44,7 +45,7 @@ $(PACKAGE_DIR)/$(VERSION_NUM).tar.gz: @cd $(PACKAGE_DIR) && tar -cvzf "$$HOME/rpmbuild/SOURCES/$(VERSION_NUM).tar.gz" occlum-$(VERSION_NUM) c/c++: deps_c - @rpmbuild -ba --define '_musl_version $(VERSION_NUM)' toolchains/gcc/occlum-toolchains-gcc.spec + @rpmbuild -ba --define '_musl_version $(MUSL_VERSION)' toolchains/gcc/occlum-toolchains-gcc.spec @mv $$HOME/rpmbuild $$HOME/rpmbuild-occlum-toolchains-gcc @cp $$HOME/rpmbuild-occlum-toolchains-gcc/RPMS/x86_64/*.rpm $(TARGET_DIR) @echo "$$(ls $$HOME/rpmbuild-occlum-toolchains-gcc/RPMS/x86_64) can be found at $(TARGET_DIR)" @@ -56,23 +57,11 @@ $$HOME/rpmbuild/SOURCES/$(GCC_PATCH): @if [ -d $$HOME/rpmbuild ]; then \ mv $$HOME/rpmbuild $$HOME/rpmbuild-old-$$(date +%Y%m%d-%T); fi @mkdir -p $$HOME/rpmbuild/{BUILD,RPMS,SPECS,SOURCES,SRPMS} - @MUSL_VERSION=$(VERSION_NUM) toolchains/gcc/download_sources.sh - @spectool -g -R --define '_musl_version $(VERSION_NUM)' toolchains/gcc/occlum-toolchains-gcc.spec + @MUSL_VERSION=$(MUSL_VERSION) toolchains/gcc/download_sources.sh + @spectool -g -R --define '_musl_version $(MUSL_VERSION)' toolchains/gcc/occlum-toolchains-gcc.spec @cp -t $$HOME/rpmbuild/SOURCES $(GCC_PATCH) $(GCC_SCRIPT) -# TODO: Occlum specific SGX related tools and libraries should be put to a different place -tools: - @mkdir -p $(TARGET_DIR) - @if [ -d $$HOME/rpmbuild ]; then \ - mv $$HOME/rpmbuild $$HOME/rpmbuild-old-$$(date +%Y%m%d-%T); fi - @mkdir -p $$HOME/rpmbuild/{BUILD,RPMS,SPECS,SOURCES,SRPMS} - @cp -t $$HOME/rpmbuild/SOURCES $(SGX_TOOLS_FILELIST) - @rpmbuild -ba tools/occlum-sgx-tools.spec - @mv $$HOME/rpmbuild $$HOME/rpmbuild-occlum-sgx-tools - @cp $$HOME/rpmbuild-occlum-sgx-tools/RPMS/x86_64/*.rpm $(TARGET_DIR) - @echo "$$(ls $$HOME/rpmbuild-occlum-sgx-tools/RPMS/x86_64) can be found at $(TARGET_DIR)" - clean: @rm -rf $(PACKAGE_DIR)/occlum-$(VERSION_NUM) - @rm -rf $$HOME/rpmbuild $$HOME/rpmbuild-occlum-sgx-tools $$HOME/rpmbuild-occlum-toolchains-gcc $$HOME/rpmbuild-occlum + @rm -rf $$HOME/rpmbuild $$HOME/rpmbuild-occlum-toolchains-gcc $$HOME/rpmbuild-occlum @rm -rf $(TARGET_DIR) diff --git a/tools/installer/rpm/occlum-platform-filelist b/tools/installer/rpm/occlum-runtime-filelist similarity index 100% rename from tools/installer/rpm/occlum-platform-filelist rename to tools/installer/rpm/occlum-runtime-filelist diff --git a/tools/installer/rpm/occlum-platform.sh b/tools/installer/rpm/occlum-runtime.sh similarity index 100% rename from tools/installer/rpm/occlum-platform.sh rename to tools/installer/rpm/occlum-runtime.sh diff --git a/tools/installer/rpm/occlum.spec b/tools/installer/rpm/occlum.spec index 725600aa..2077b02c 100644 --- a/tools/installer/rpm/occlum.spec +++ b/tools/installer/rpm/occlum.spec @@ -3,6 +3,9 @@ %define _unpackaged_files_terminate_build 0 %define sgxsdk_install_dir /opt/intel +# Remove checking for python shebang error in sgx-gdb +%undefine __brp_mangle_shebangs + Name: occlum Version: %{_version} Release: %{centos_base_release}%{?dist} @@ -14,8 +17,8 @@ Source0: https://github.com/occlum/occlum/archive/%{_version}.tar.gz Source10: occlum-pal.sh Source11: occlum-filelist Source12: occlum-pal-filelist -Source13: occlum-platform-filelist -SOURCE14: occlum-platform.sh +Source13: occlum-runtime-filelist +SOURCE14: occlum-runtime.sh ExclusiveArch: x86_64 @@ -32,6 +35,8 @@ BuildRequires: git BuildRequires: fuse-devel BuildRequires: fuse-libs +Requires: occlum-pal, occlum-runtime, occlum-toolchains-gcc, occlum-sgx-tools + %description Occlum is a memory-safe, multi-process library OS (LibOS) for Intel SGX. As a LibOS, it enables legacy applications to run on SGX with little or even no modifications of source code, @@ -44,11 +49,17 @@ Summary: Platform Abstraction Layer of Occlum enclave occlum-pal is the Platform Abstraction Layer of Occlum enclave. It provides interfaces to execute trused applications inside enclave. -%package platform -Summary: Platform Abstraction Layer command for occlum enclave +%package runtime +Summary: Necessary binaries for occlum run/exec -%description platform -occlum-platform contains command for occlum enclave. +%description runtime +occlum-runtime contains command for occlum run/exec. + +%package sgx-tools +Summary: minimum dependencies from Intel SGX SDK e.g. sgx-gdb, sgx_sign + +%description sgx-tools +minimum dependencies from Intel SGX SDK e.g. sgx-gdb, sgx_sign %prep %setup -q -c -n %{name}-%{_version} @@ -76,13 +87,16 @@ install -p -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ %files pal -f %{SOURCE12} /etc/profile.d/occlum-pal.sh -%files platform -f %{SOURCE13} -/etc/profile.d/occlum-platform.sh +%files runtime -f %{SOURCE13} +/etc/profile.d/occlum-runtime.sh + +%files sgx-tools +/opt/occlum/sgxsdk-tools %post pal echo 'Please execute command "source /etc/profile" to validate envs immediately' -%post platform +%post runtime echo 'Please execute command "source /etc/profile" to validate envs immediately' %changelog diff --git a/tools/installer/rpm/tools/occlum-sgx-tools-filelist b/tools/installer/rpm/tools/occlum-sgx-tools-filelist deleted file mode 100644 index 86788812..00000000 --- a/tools/installer/rpm/tools/occlum-sgx-tools-filelist +++ /dev/null @@ -1,7 +0,0 @@ -/opt/intel/sgxsdk/lib64/libsgx_uae_service_sim.so -/opt/intel/sgxsdk/sdk_libs/libsgx_uae_service_sim.so -/opt/intel/sgxsdk/lib64/libsgx_ptrace.so -/opt/intel/sgxsdk/lib64/gdb-sgx-plugin/* -/opt/intel/sgxsdk/bin/sgx-gdb -/opt/intel/sgxsdk/bin/x64/sgx_sign -/opt/intel/sgxsdk/environment diff --git a/tools/installer/rpm/tools/occlum-sgx-tools.spec b/tools/installer/rpm/tools/occlum-sgx-tools.spec deleted file mode 100644 index 3d4475f4..00000000 --- a/tools/installer/rpm/tools/occlum-sgx-tools.spec +++ /dev/null @@ -1,29 +0,0 @@ -%define centos_base_release 1 - -Name: occlum-sgx-tools -Version: 0.15.1 -Release: %{centos_base_release}%{?dist} -Summary: Occlum sgx tools - -Group: Development/Libraries -License: BSD License -URL: https://github.com/occlum/occlum -Source0: occlum-sgx-tools-filelist - -ExclusiveArch: x86_64 - -%description -Occlum sgx tools used during `occlum build` and `occlum gdb` - -%prep -mkdir -p %{?buildroot} -cp --parents /opt/intel/sgxsdk/lib64/{libsgx_ptrace.so,libsgx_uae_service_sim.so} %{?buildroot} -cp --parents /opt/intel/sgxsdk/lib64/gdb-sgx-plugin/* %{?buildroot} -cp --parents /opt/intel/sgxsdk/{bin/sgx-gdb,bin/x64/sgx_sign,environment,sdk_libs/libsgx_uae_service_sim.so} %{?buildroot} - -%files -%files -f %{SOURCE0} - -%changelog -* Wed Aug 05 2020 Chunyang Hui - 0.14.0-1 -- Package init