[hyper mode] Add support for the package command

This commit is contained in:
LI Qing 2023-02-08 11:00:44 +08:00 committed by volcano
parent 386e968ccb
commit 5174feae15

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