Modify rpm installer to align with current intallation structure

This commit is contained in:
Hui, Chunyang 2020-09-14 09:12:43 +00:00 committed by Tate, Hongliang Tian
parent 1310eb9363
commit c6d4a34b7f
7 changed files with 44 additions and 70 deletions

@ -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 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-sgx-tools-*.rpm
rpm -i occlum-pal-*.rpm rpm -i occlum-pal-*.rpm
rpm -i occlum-runtime-*.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 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 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 ## DEB Installer

@ -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}') 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) VERSION_NUM := $(MAJOR_VER_NUM).$(MINOR_VER_NUM).$(PATCH_VER_NUM)
RPM_FILELIST = occlum-filelist occlum-pal-filelist occlum-platform-filelist # Occlum specific version
EXPORT_SCRIPT = occlum-pal.sh occlum-platform.sh 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_PATCH = toolchains/gcc/musl-cross-make-disable-download.patch
GCC_SCRIPT = toolchains/gcc/occlum-gcc.sh GCC_SCRIPT = toolchains/gcc/occlum-gcc.sh
SGX_TOOLS_FILELIST = tools/occlum-sgx-tools-filelist
PACKAGE_DIR = /tmp 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 main: main_deps
@mkdir -p $(TARGET_DIR) @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) @cd $(PACKAGE_DIR) && tar -cvzf "$$HOME/rpmbuild/SOURCES/$(VERSION_NUM).tar.gz" occlum-$(VERSION_NUM)
c/c++: deps_c 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 @mv $$HOME/rpmbuild $$HOME/rpmbuild-occlum-toolchains-gcc
@cp $$HOME/rpmbuild-occlum-toolchains-gcc/RPMS/x86_64/*.rpm $(TARGET_DIR) @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)" @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 \ @if [ -d $$HOME/rpmbuild ]; then \
mv $$HOME/rpmbuild $$HOME/rpmbuild-old-$$(date +%Y%m%d-%T); fi mv $$HOME/rpmbuild $$HOME/rpmbuild-old-$$(date +%Y%m%d-%T); fi
@mkdir -p $$HOME/rpmbuild/{BUILD,RPMS,SPECS,SOURCES,SRPMS} @mkdir -p $$HOME/rpmbuild/{BUILD,RPMS,SPECS,SOURCES,SRPMS}
@MUSL_VERSION=$(VERSION_NUM) toolchains/gcc/download_sources.sh @MUSL_VERSION=$(MUSL_VERSION) toolchains/gcc/download_sources.sh
@spectool -g -R --define '_musl_version $(VERSION_NUM)' toolchains/gcc/occlum-toolchains-gcc.spec @spectool -g -R --define '_musl_version $(MUSL_VERSION)' toolchains/gcc/occlum-toolchains-gcc.spec
@cp -t $$HOME/rpmbuild/SOURCES $(GCC_PATCH) $(GCC_SCRIPT) @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: clean:
@rm -rf $(PACKAGE_DIR)/occlum-$(VERSION_NUM) @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) @rm -rf $(TARGET_DIR)

@ -3,6 +3,9 @@
%define _unpackaged_files_terminate_build 0 %define _unpackaged_files_terminate_build 0
%define sgxsdk_install_dir /opt/intel %define sgxsdk_install_dir /opt/intel
# Remove checking for python shebang error in sgx-gdb
%undefine __brp_mangle_shebangs
Name: occlum Name: occlum
Version: %{_version} Version: %{_version}
Release: %{centos_base_release}%{?dist} Release: %{centos_base_release}%{?dist}
@ -14,8 +17,8 @@ Source0: https://github.com/occlum/occlum/archive/%{_version}.tar.gz
Source10: occlum-pal.sh Source10: occlum-pal.sh
Source11: occlum-filelist Source11: occlum-filelist
Source12: occlum-pal-filelist Source12: occlum-pal-filelist
Source13: occlum-platform-filelist Source13: occlum-runtime-filelist
SOURCE14: occlum-platform.sh SOURCE14: occlum-runtime.sh
ExclusiveArch: x86_64 ExclusiveArch: x86_64
@ -32,6 +35,8 @@ BuildRequires: git
BuildRequires: fuse-devel BuildRequires: fuse-devel
BuildRequires: fuse-libs BuildRequires: fuse-libs
Requires: occlum-pal, occlum-runtime, occlum-toolchains-gcc, occlum-sgx-tools
%description %description
Occlum is a memory-safe, multi-process library OS (LibOS) for Intel SGX. 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, 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. occlum-pal is the Platform Abstraction Layer of Occlum enclave.
It provides interfaces to execute trused applications inside enclave. It provides interfaces to execute trused applications inside enclave.
%package platform %package runtime
Summary: Platform Abstraction Layer command for occlum enclave Summary: Necessary binaries for occlum run/exec
%description platform %description runtime
occlum-platform contains command for occlum enclave. 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 %prep
%setup -q -c -n %{name}-%{_version} %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} %files pal -f %{SOURCE12}
/etc/profile.d/occlum-pal.sh /etc/profile.d/occlum-pal.sh
%files platform -f %{SOURCE13} %files runtime -f %{SOURCE13}
/etc/profile.d/occlum-platform.sh /etc/profile.d/occlum-runtime.sh
%files sgx-tools
/opt/occlum/sgxsdk-tools
%post pal %post pal
echo 'Please execute command "source /etc/profile" to validate envs immediately' 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' echo 'Please execute command "source /etc/profile" to validate envs immediately'
%changelog %changelog

@ -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

@ -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 <sanqian.hcy@antfin.com> - 0.14.0-1
- Package init