[{eoan, disco, bionic, xenial}:linux PATCH 1/1] UBUNTU: [Packaging] Add systemd service to load intel_sgx

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Wed Dec 4 16:28:52 UTC 2019

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

diff --git a/debian/linux-cloud-tools-common.intel-sgx-load-module.service b/debian/linux-cloud-tools-common.intel-sgx-load-module.service
new file mode 100644
index 000000000000..a1882acbda22
--- /dev/null
+++ b/debian/linux-cloud-tools-common.intel-sgx-load-module.service
@@ -0,0 +1,13 @@
+Description=Install SGX kernel module
+ExecStart=/sbin/modprobe intel_sgx
+ExecStop=/sbin/modprobe -r intel_sgx
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index b27275685612..7b115e0a9bb9 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -196,6 +196,9 @@ ifeq ($(do_tools_hyperv),true)
 	dh_installinit -p$(cloudpkg) -o --name hv-fcopy-daemon
 	dh_systemd_start -p$(cloudpkg)
+	# 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
 	dh_installdeb -i

More information about the kernel-team mailing list