blob: 7df23b8e68de2a6f95b951c7c3c19c40073e0490 [file] [log] [blame]
(window.webpackJsonp=window.webpackJsonp||[]).push([[86],{432:function(e,t,a){"use strict";a.r(t);var c=a(11),n=Object(c.a)({},(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[a("h1",{attrs:{id:"executing-builtin-functions-in-occlum"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#executing-builtin-functions-in-occlum"}},[e._v("#")]),e._v(" Executing builtin-functions in Occlum")]),e._v(" "),a("p",[e._v("The example shows how to run teaclave builtin-functions in Occlum.")]),e._v(" "),a("h2",{attrs:{id:"build"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#build"}},[e._v("#")]),e._v(" Build")]),e._v(" "),a("ol",[a("li",[e._v("Clone the teaclave project.")])]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v("git clone https://github.com/apache/incubator-teaclave.git ./teaclave && cd ./teaclave\n")])])]),a("ol",{attrs:{start:"2"}},[a("li",[e._v("Edit "),a("code",[e._v("config/build.config.toml")]),e._v(" and add the executable binary as accepted inbound service of scheduler. The following is an example that uses teaclave_execution_service_libos as the name of binary.")])]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v('scheduler = ["teaclave_execution_service", "teaclave_execution_service_libos"]\n')])])]),a("blockquote",[a("p",[e._v("NOTE"),a("br"),e._v("\nThe same name should be used in "),a("code",[e._v("build.config.toml")]),e._v(" and "),a("code",[e._v("enclave_info.toml")]),e._v(".")])]),e._v(" "),a("ol",{attrs:{start:"3"}},[a("li",[e._v("Build teaclave project. After building the project, you can find the binary teaclave_execution_service_libos in "),a("code",[e._v("${TEACLAVE_BIN_INSTALL_DIR}")]),e._v(". Work at teaclave project source directory.")])]),e._v(" "),a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v("mkdir build && cd build\ncmake ..\nmake\n")])])]),a("ol",{attrs:{start:"4"}},[a("li",[e._v("Build occlum instance. "),a("code",[e._v("cmake/scripts/build_occlum_instance.sh")]),e._v(" is a demo script to build an instance.")])]),e._v(" "),a("blockquote",[a("p",[e._v("NOTE"),a("br"),e._v("\nYou should edit the attestation information and the advertised_address of scheduler in "),a("code",[e._v("runtime.config.toml")]),e._v(" required by teaclave_execution_service_libos before building the occlum instance.")])]),e._v(" "),a("ol",{attrs:{start:"5"}},[a("li",[e._v("Update enclave_info and auditors for Teaclave platform.")])]),e._v(" "),a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v("sgx_sign dump -enclave ${TEACLAVE_BIN_INSTALL_DIR}/teaclave_instance/build/lib/libocclum-libos.signed.so \\\n -dumpfile ${TEACLAVE_OUT_DIR}/teaclave_execution_service_libos_enclave.meta.txt\n\ncat ${TEACLAVE_OUT_DIR}/teaclave_execution_service_libos_enclave.meta.txt | \\\npython ${MT_SCRIPT_DIR}/gen_enclave_info_toml.py teaclave_execution_service_libos \\\n > ${TEACLAVE_OUT_DIR}/teaclave_execution_service_libos_enclave_info.toml\n\ncd ${TEACLAVE_BUILD_ROOT} && make update_sig\n")])])]),a("h2",{attrs:{id:"run"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#run"}},[e._v("#")]),e._v(" Run")]),e._v(" "),a("p",[e._v("Run teaclave services except teaclave_execution_serice and run teaclave_execution_service_libos on Occlum")]),e._v(" "),a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[e._v("# Required by teaclave services\nmkdir -p /tmp/fusiont_data \ncd ${TEACLAVE_SERVICE_INSTALL_DIR} \n\n# Before running services, you should check the information in runtime.config.toml.\n# For DCAP mode, start the teaclave_dcap_ref_as service first.\n./teaclave_authentication_service &\n./teaclave_storage_service &\n./teaclave_management_service &\n./teaclave_scheduler_service &\n./teaclave_access_control_service &\n./teaclave_frontend_service &\n\ncd $TEACLAVE_BIN_INSTALL_DIR/teaclave_instance && occlum run /bin/teaclave_execution_service_libos\n\n")])])])])}),[],!1,null,null,null);t.default=n.exports}}]);