new file mode 100644
@@ -0,0 +1,13 @@
+[Unit]
+Description=Install SGX kernel module
+DefaultDependencies=false
+ConditionVirtualization=microsoft
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/sbin/modprobe intel_sgx
+ExecStop=/sbin/modprobe -r intel_sgx
+
+[Install]
+WantedBy=multi-user.target
@@ -196,6 +196,9 @@ ifeq ($(do_tools_hyperv),true)
dh_installinit -p$(cloudpkg) -o --name hv-fcopy-daemon
dh_systemd_start -p$(cloudpkg)
endif
+ # Keep intel_sgx service disabled by default, so add it after dh_systemd_enable
+ # and dh_systemd_start are called:
+ dh_installinit -p$(cloudpkg) --no-start --no-enable --name intel-sgx-load-module
endif
endif
dh_installdeb -i
BugLink: https://bugs.launchpad.net/bugs/1844245 Include a systemd service to simplify the process of loading intel_sgx during the boot if the user decides to do so. Since intel_sgx will only be available in linux-azure, restrict the new service with ConditionVirtualization=microsoft. Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com> --- ...cloud-tools-common.intel-sgx-load-module.service | 13 +++++++++++++ debian/rules.d/3-binary-indep.mk | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 debian/linux-cloud-tools-common.intel-sgx-load-module.service