From 5174feae15ef7d42759803b5ece994a89fb81223 Mon Sep 17 00:00:00 2001 From: LI Qing Date: Wed, 8 Feb 2023 11:00:44 +0800 Subject: [PATCH] [hyper mode] Add support for the package command --- tools/occlum | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/occlum b/tools/occlum index ae902a71..ca26b118 100755 --- a/tools/occlum +++ b/tools/occlum @@ -496,9 +496,9 @@ cmd_package() { fi SGX_MODE=$(cat $instance_dir/.sgx_mode) - if [[ -n $SGX_MODE && "$SGX_MODE" != "HW" && "$debug" != "true" ]]; then - echo '"occlum package" command should only be used for an Occlum instance of SGX hardware mode, not the simulation mode.' - echo 'Please run "occlum build --sgx-mode HW" and then use "occlum package"' + if [[ -n $SGX_MODE && "$SGX_MODE" == "SIM" && "$debug" != "true" ]]; then + echo '"occlum package" command should only be used for an Occlum instance of SGX hardware mode or hyper mode, not the simulation mode.' + echo 'Please run "occlum build --sgx-mode HW/HYPER" and then use "occlum package"' echo 'Or, use "occlum package --debug" to support similation mode package' exit 1 fi @@ -515,16 +515,19 @@ cmd_package() { $instance_base_name/initfs $instance_base_name/run \ $instance_base_name/.__occlum_status $instance_base_name/.sgx_mode \ " - if [[ "$debug" == "true" && "$SGX_MODE" != "HW" ]]; then - sim_files="\ - $instance_base_name/build/lib/libocclum-libos_sim.so* \ + if [[ "$SGX_MODE" == "SIM" ]]; then + extra_files="\ $instance_base_name/build/lib/libocclum-pal_sim.so* \ " + elif [[ "$SGX_MODE" == "HYPER" ]]; then + extra_files="\ + $instance_base_name/build/lib/libocclum-pal_hyper.so* \ + " fi cd .. && tar -cvzf $instance_dir/$package_name \ --transform s/$instance_base_name/$(basename $package_name .tar.gz)/ \ - $pkg_files $sim_files + $pkg_files $extra_files echo "The package $package_name is generated successfully" }