Ubunt20.04 安装 Gramine

参考资料

Gramine Quick start

Gramine安装

Gramine安装要求:

安装过程如下:

sudo curl -fsSLo /usr/share/keyrings/gramine-keyring.gpg https://packages.gramineproject.io/gramine-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/gramine-keyring.gpg] https://packages.gramineproject.io/ $(lsb_release -sc) main" \
| sudo tee /etc/apt/sources.list.d/gramine.list

sudo curl -fsSLo /usr/share/keyrings/intel-sgx-deb.asc https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx-deb.asc] https://download.01.org/intel-sgx/sgx_repo/ubuntu $(lsb_release -sc) main" \
| sudo tee /etc/apt/sources.list.d/intel-sgx.list

sudo apt-get update
sudo apt-get install gramine

运行helloworld

sudo apt-get install gcc make  # for Ubuntu distribution
git clone --depth 1 --branch v1.4 https://github.com/gramineproject/gramine.git
cd gramine/CI-Examples/helloworld

不使用SGX编译

make
gramine-direct helloworld

使用SGX

make SGX=1
gramine-sgx helloworld

问题:error: Gramine with Linux-SGX backend requires support for FSGSBASE CPU instructions in the host kernel. Please update your system. private@baas-node4:~/codes/tee/gramine/CI-Examples/helloworld$

解决方法:

升级kernel到5.15

因为使用的Gramine要求kernel在5.11以上。慎用该方法,会导致其他许多问题。因为我的是空服务器,所以采用该方法。

// 更新 repo 列表
sudo apt update
// 升级系统和软件(可选)
sudo apt upgrade -y
// 重启
sudo reboot

// 列出可用的 5.15 内核版本
apt list linux-headers-5.15.*-*-generic linux-image-5.15.*-*-generic

// 其中:
// Install kernel-generic:通用内核,一般 PC 及 Server
// Install low-latency kernel:低延迟内核,适用于工业嵌入式系统(Industrial embedded systems)

// 指定版本即可,比如当前为 5.15.0-46
sudo apt install linux-headers-5.15.0-46-generic linux-image-5.15.0-46-generic

// 重启后生效
sudo reboot

uname -a

升级完kernel之后原来使用dkms安装的sdk可以卸载了。因为从kernel 5.11开始已经默认安装了SGX驱动。

参考文档:

猜你喜欢

转载自blog.csdn.net/shuizhongmose/article/details/131306761