1
- # Simple KVM firmware
1
+ # Rust Hypervisor Firmware
2
2
3
- ** This project is an experiment and should not be used production workloads.**
3
+ This repository contains a simple firmware that is designed to be launched from
4
+ anything that supports loading ELF binaries and running them with the
5
+ PVH booting standard
4
6
5
- This repository contains a simple KVM firmware that is designed to be launched
6
- from anything that supports loading ELF binaries and running them with the
7
- Linux kernel loading standard.
8
-
9
- The ultimate goal is to be able to use this "firmware" to be able to load a
10
- bootloader from within a disk image.
7
+ The purpose is to be able to use this firmware to be able to load a
8
+ bootloader from within a disk image without requiring the use of a complex
9
+ firmware such as TianoCore/edk2 and without requiring the VMM to reuse
10
+ functionality used for booting the Linux kernel.
11
11
12
12
Currently it will directly load a kernel from a disk image that follows the
13
13
[ Boot Loader Specification] ( https://systemd.io/BOOT_LOADER_SPECIFICATION )
14
14
15
+ There is also minimal EFI compatibility support allowing the boot of some
16
+ images that use EFI (shim + GRUB2 as used by Ubuntu).
17
+
15
18
The firmware is primarily developed against [ Cloud
16
- Hypervisor] ( https://github.com/intel/cloud-hypervisor ) .
19
+ Hypervisor] ( https://github.com/cloud-hypervisor/cloud-hypervisor ) but there is
20
+ also support for using QEMU's PVH loader.
17
21
18
- This project was orginally developed using
22
+ This project was originally developed using
19
23
[ Firecracker] ( https://github.com/firecracker-microvm ) however as it does not
20
24
currently support resetting the virtio block device it is not possible to boot
21
25
all the way into the OS.
@@ -32,7 +36,7 @@ target/target/release/hypervisor-fw
32
36
33
37
## Features
34
38
35
- * virtio (MMIO & PCI) block support
39
+ * virtio (PCI) block support
36
40
* GPT parsing (to find EFI system partition)
37
41
* FAT12/16/32 directory traversal and file reading
38
42
* bzImage loader
@@ -42,17 +46,16 @@ target/target/release/hypervisor-fw
42
46
43
47
## Running
44
48
45
- Works with Cloud Hypervisor and Firecracker as a drop in replacement for the
46
- Linux kernel. It does not work with crosvm as crosvm has a hardcoded kernel
47
- function start address.
49
+ Works with Cloud Hypervisor and QEMU via their PVH loaders as an alternative to
50
+ the Linux kernel.
48
51
49
- Cloud Hypervisor is currently the primary development target for the firmware
50
- although support for other VMMs will be considered.
52
+ Cloud Hypervisor and QEMU are currently the primary development targets for the
53
+ firmware although support for other VMMs will be considered.
51
54
52
55
### Cloud Hypervisor
53
56
54
57
As per [ getting
55
- started] ( https://github.com/intel /cloud-hypervisor/blob/master/README.md#2-getting-started )
58
+ started] ( https://github.com/cloud-hypervisor /cloud-hypervisor/blob/master/README.md#2-getting-started )
56
59
57
60
However instead of using the binary firmware for the parameter to ` --kernel `
58
61
instead use the binary you build above.
@@ -62,57 +65,29 @@ $ pushd $CLOUDH
62
65
$ sudo setcap cap_net_admin+ep ./cloud-hypervisor/target/release/cloud-hypervisor
63
66
$ ./cloud-hypervisor/target/release/cloud-hypervisor \
64
67
--kernel ./target/target/release/hypervisor-fw \
65
- --disk path=./clear-29160-kvm.img \
68
+ --disk path=focal-server-cloudimg-amd64.raw \
66
69
--cpus boot=4 \
67
70
--memory size=512M \
68
71
--net "tap=,mac=,ip=,mask=" \
69
72
--rng
70
73
$ popd
71
74
```
72
75
73
- ### Firecracker
76
+ ### QEMU
74
77
75
- As per [ quick
76
- start] ( https://github.com/firecracker-microvm/firecracker/blob/master/docs/getting-started.md )
78
+ Use the QEMU ` -kernel ` parameter to specify the path to the firmware.
77
79
78
- Replacing the kernel and rootfs to point at the firmware and the full disk
79
- image instead.
80
+ e.g.
80
81
81
82
```
82
- curl --unix-socket /tmp/firecracker.socket -i \
83
- -X PUT 'http://localhost/boot-source' \
84
- -H 'Accept: application/json' \
85
- -H 'Content-Type: application/json' \
86
- -d '{
87
- "kernel_image_path": "target/target/release/hypervisor-fw",
88
- "boot_args": ""
89
- }'
90
-
91
- curl --unix-socket /tmp/firecracker.socket -i \
92
- -X PUT 'http://localhost/drives/rootfs' \
93
- -H 'Accept: application/json' \
94
- -H 'Content-Type: application/json' \
95
- -d '{
96
- "drive_id": "rootfs",
97
- "path_on_host": "clear-28660-kvm.img",
98
- "is_root_device": true,
99
- "is_read_only": false
100
- }'
101
-
102
- curl --unix-socket /tmp/firecracker.socket -i \
103
- -X PUT 'http://localhost/actions' \
104
- -H 'Accept: application/json' \
105
- -H 'Content-Type: application/json' \
106
- -d '{
107
- "action_type": "InstanceStart"
108
- }'
109
-
83
+ $ qemu-system-x86_64 -machine q35,accel=kvm -cpu host,-vmx -m 1G\
84
+ -kernel ./target/target/release/hypervisor-fw \
85
+ -display none -nodefaults \
86
+ -serial stdio \
87
+ -drive id=os,file=focal-server-cloudimg-amd64.raw,if=none \
88
+ -device virtio-blk-pci,drive=os,disable-legacy=on
110
89
```
111
90
112
- ** Currently Firecracker's virtio block device does not support resetting the
113
- device and as such it is not possible for the booted Linux kernel to take over
114
- the device from the firmware.**
115
-
116
91
## Testing
117
92
118
93
"cargo test" needs disk images from make-test-disks.sh
@@ -122,28 +97,3 @@ And clear-28660-kvm.img:
122
97
https://download.clearlinux.org/releases/28660/clear/clear-28660-kvm.img.xz
123
98
124
99
sha1sum: 5fc086643dea4b20c59a795a262e0d2400fab15f
125
-
126
- ## Security
127
-
128
- ** Reporting a Potential Security Vulnerability** : If you have discovered
129
- potential security vulnerability in this project, please send an e-mail to
130
- [email protected] . For issues related to Intel Products, please visit
131
- https://security-center.intel.com .
132
-
133
- It is important to include the following details:
134
- - The projects and versions affected
135
- - Detailed description of the vulnerability
136
- - Information on known exploits
137
-
138
- Vulnerability information is extremely sensitive. Please encrypt all security
139
- vulnerability reports using our * PGP key*
140
-
141
- A member of the Intel Product Security Team will review your e-mail and
142
- contact you to to collaborate on resolving the issue. For more information on
143
- how Intel works to resolve security issues, see: * Vulnerability Handling
144
- Guidelines*
145
-
146
- PGP Key: https://www.intel.com/content/www/us/en/security-center/pgp-public-key.html
147
-
148
- Vulnerability Handling Guidelines: https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html
149
-
0 commit comments