Install VM-with-vSGX based on KVM and QEMU Quick Guide

本文档提供了一个快速指南,详细介绍了在Ubuntu 20.04系统上,如何基于KVM和QEMU安装支持Intel SGX的虚拟机。内容包括安装前的必要条件,如主机系统支持SGX、内核版本需求,以及如何更新Ubuntu内核、构建带有SGX支持的最新QEMU,安装Libvirt,并配置AppArmor以允许QEMU访问所需的设备。
摘要由CSDN通过智能技术生成

Requirements

To use Intel SGX in a virtual machine, you must meet the following requirements:

  • The host system must support Intel SGX.
  • Intel SGX must be enabled, either explicitly in the BIOS or via the software enabling procedure.
  • If you want to use Flexible Launch Control in guest systems, the hardware must also support the feature.
  • You must run Linux kernel version 5.13 or later, on the host and in the guest VMs.

Notes: Our Host OS is Ubuntu 20.04, and the device has FLC support.

Installation Procedure

  • Update ubuntu kernel
# Download the latest kernel v5.16-rc8
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16-rc8/amd64/linux-headers-5.16.0-051600rc8-generic_5.16.0-051600rc8.202201022330_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16-rc8/amd64/linux-headers-5.16.0-051600rc8_5.16.0-051600rc8.202201022330_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16-rc8/amd64/linux-image-unsigned-5.16.0-051600rc8-generic_5.16.0-051600rc8.202201022330_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16-rc8/amd64/linux-modules-5.16.0-051600rc8-generic_5.16.0-051600rc8.202201022330_amd64.deb

# Install Kernel
sudo dpkg -i *.deb

# It will have some issue like missed the libssl3 support, fix it by the workaround
# Add the following line at the end of /etc/apt/sources.list
deb http://cz.archive.ubuntu.com/ubuntu jammy main
sudo apt update
sudo apt install libssl3

# Check the kernel
grep -A100 submenu  /boot/grub/grub.cfg |grep menuentry

# Reboot to the new kernel (by default)
sudo reboot

# Verify the SGX
$ dmesg | grep sgx
[    3.748768] sgx: EPC section 0x2000c00000-0x207f7fffff
[    3.753699] sgx: EPC section 0x4000c00000-0x407fffffff
  • Build the latest Qemu (which already has SGX support)
# Download qemu code
git clone https://github.com/qemu/qemu

# Install the requirements
sudo apt install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev

sudo apt install git-email libaio-dev libbluetooth-dev libbrlapi-dev libbz2-dev libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev libibverbs-dev libjpeg8-dev libncurses5-dev
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值