[disco:linux-azure, xenial:linux-azure][PATCH 1/3] UBUNTU: SAUCE: sgx-update: Add script to fetch SGX from Intel repo

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Tue Sep 17 11:05:45 UTC 2019


BugLink: https://bugs.launchpad.net/bugs/1844245

Add a script to simplify the process of fetching the new version of
the SGX driver source code.

The user is still responsible for reviewing the new changes and
tagging the commit with a proper launchpad bug.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
 ubuntu/Makefile   |  4 ++++
 ubuntu/sgx-update | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100755 ubuntu/sgx-update

diff --git a/ubuntu/Makefile b/ubuntu/Makefile
index c499b2112dec..3230b018df8c 100644
--- a/ubuntu/Makefile
+++ b/ubuntu/Makefile
@@ -31,6 +31,10 @@ endif
 ##
 ##
 ##
+obj-y += sgx/
+##
+##
+##
 ##
 ##
 ##
diff --git a/ubuntu/sgx-update b/ubuntu/sgx-update
new file mode 100755
index 000000000000..3f701040337f
--- /dev/null
+++ b/ubuntu/sgx-update
@@ -0,0 +1,33 @@
+#!/bin/bash -eu
+remote_repo="${1:-https://github.com/haimc-intel/SGXDataCenterAttestationPrimitives}"
+remote_branch="${2:-inker-ph1}"
+driver_path=driver/linux/
+
+# Get the latest version of the driver
+tmp=$(mktemp -d)
+trap "rm -rf '$tmp'" 0
+git clone "$remote_repo" ${remote_branch:+-b "$remote_branch"} "$tmp"
+commit_id="$(cd "$tmp" && git rev-parse HEAD)"
+
+# Sync the new files
+here="$(readlink -f "$(dirname "$0")")"
+intree_path="$here/sgx/"
+include_path="$here/../arch/x86/include/"
+git rm -rf "$intree_path" || true
+mkdir "$intree_path"
+rsync -av "$tmp/$driver_path/"* "$intree_path/" \
+      --exclude 'include' \
+      --exclude '*.conf' \
+      --exclude '*.rules'
+rsync -av "$tmp/$driver_path/include/"* "$include_path/"
+
+# Commit changes
+git add "$intree_path"
+git add "$include_path"
+{
+	echo "UBUNTU: SAUCE: Update ubuntu/sgx driver to ${commit_id:0:12}"
+	echo
+	echo "Sync in-tree driver with commit id $commit_id from"
+	echo "$remote_repo" "$remote_branch"
+} | git commit -s -F - &&
+	echo "Please review the commit before pushing it!"
-- 
2.20.1




More information about the kernel-team mailing list