@@ -25,8 +25,9 @@ The generic requirements are explained below:
25
25
26
26
- ** Linux 4.14+**
27
27
28
- Firecracker currently supports physical Linux x86_64 hosts, running kernel
29
- version 4.14 or later.
28
+ Firecracker currently supports physical Linux ** x86_64** and ** aarch64**
29
+ hosts, running kernel version 4.14 or later. However, the ** aarch64** support
30
+ is not feature complete (alpha stage).
30
31
31
32
- ** KVM**
32
33
@@ -42,16 +43,18 @@ The generic requirements are explained below:
42
43
the basic requirements to run Firecracker.</summary >
43
44
44
45
``` bash
45
- err=" " ; \
46
- [ " $( uname) $( uname -m) " = " Linux x86_64" ] \
47
- || err=" ERROR: your system is not Linux x86_64." ; \
48
- [ -r /dev/kvm ] && [ -w /dev/kvm ] \
49
- || err=" $err \nERROR: /dev/kvm is innaccessible." ; \
50
- (( $(uname - r | cut - d. - f1 )* 1000 + $(uname - r | cut - d. - f2 ) >= 4014 )) \
51
- || err=" $err \nERROR: your kernel version ($( uname -r) ) is too old." ; \
52
- dmesg | grep -i " hypervisor detected" \
53
- && echo " WARNING: you are running in a virtual machine. Firecracker is not well tested under nested virtualization." ; \
54
- [ -z " $err " ] && echo " Your system looks ready for Firecracker!" || echo -e " $err "
46
+ err=" " ;
47
+ [ " $( uname) $( uname -m) " = " Linux x86_64" ] \
48
+ || [ " $( uname) $( uname -m) " = " Linux aarch64" ] \
49
+ || err=" ERROR: your system is not Linux x86_64 or Linux aarch64." ; \
50
+ [ -r /dev/kvm ] && [ -w /dev/kvm ] \
51
+ || err=" $err \nERROR: /dev/kvm is innaccessible." ; \
52
+ (( $(uname - r | cut - d. - f1 )* 1000 + $(uname - r | cut - d. - f2 ) >= 4014 )) \
53
+ || err=" $err \nERROR: your kernel version ($( uname -r) ) is too old." ; \
54
+ dmesg | grep -i " hypervisor detected" \
55
+ && echo " WARNING: you are running in a virtual machine." \
56
+ && echo " Firecracker is not well tested under nested virtualization." ; \
57
+ [ -z " $err " ] && echo " Your system looks ready for Firecracker!" || echo -e " $err "
55
58
```
56
59
57
60
</details >
@@ -62,7 +65,7 @@ Firecracker is linked statically against
62
65
[ musl] ( https://www.musl-libc.org/ ) , having no library dependencies. You can
63
66
just download the latest binary from our
64
67
[ release page] ( https://github.com/firecracker-microvm/firecracker/releases ) ,
65
- and run it on your x86_64 Linux machine.
68
+ and run it on your x86_64 or aarch64 Linux machine.
66
69
67
70
On the EC2 instance, this binary can be downloaded as:
68
71
@@ -82,7 +85,6 @@ Make the binary executable:
82
85
chmod +x firecracker
83
86
```
84
87
85
-
86
88
If, instead, you'd like to build Firecracker yourself, you should check out
87
89
the [ Building From Source section] ( #building-from-source ) in this doc.
88
90
@@ -100,14 +102,14 @@ First, make sure you have the `firecracker` binary available - either
100
102
[ built from source] ( #building-from-source ) .
101
103
102
104
Next, you will need an uncompressed Linux kernel binary, and an ext4
103
- file system image (to use as rootfs). You can use these files from our
104
- microVM image S3 bucket:
105
- [ kernel ] (
106
- https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin
107
- ), and
108
- [ rootfs ] (
109
- https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4
110
- ).
105
+ file system image (to use as rootfs).
106
+
107
+ 1 . To run an ` x86_64 ` guest you can download such resources from:
108
+ [ kernel ] ( https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin )
109
+ and [ rootfs ] ( https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4 ) .
110
+ 1 . To run an ` aarch64 ` guest, download them from:
111
+ [ kernel ] ( https://s3.amazonaws.com/spec.ccfc.min/img/aarch64/ubuntu_with_ssh/kernel/vmlinux.bin )
112
+ and [ rootfs ] ( https://s3.amazonaws.com/spec.ccfc.min/img/aarch64/ubuntu_with_ssh/fsfiles/xenial.rootfs.ext4 ) .
111
113
112
114
Now, let's open up two shell prompts: one to run Firecracker, and another one
113
115
to control it (by writing to the API socket). For the purpose of this guide,
@@ -133,33 +135,72 @@ In your **second shell** prompt:
133
135
- get the kernel and rootfs, if you don't have any available:
134
136
135
137
``` bash
136
- curl -fsSL -o hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin
137
- curl -fsSL -o hello-rootfs.ext4 https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4
138
+ arch=` uname -m`
139
+ dest_kernel=" hello-vmlinux.bin"
140
+ dest_rootfs=" hello-rootfs.ext4"
141
+ image_bucket_url=" https://s3.amazonaws.com/spec.ccfc.min/img"
142
+
143
+ if [ ${arch} = " x86_64" ]; then
144
+ kernel=" ${image_bucket_url} /hello/kernel/hello-vmlinux.bin"
145
+ rootfs=" ${image_bucket_url} /hello/fsfiles/hello-rootfs.ext4"
146
+ elif [ ${arch} = " aarch64" ]; then
147
+ kernel=" ${image_bucket_url} /aarch64/ubuntu_with_ssh/kernel/vmlinux.bin"
148
+ rootfs=" ${image_bucket_url} /aarch64/ubuntu_with_ssh/fsfiles/xenial.rootfs.ext4"
149
+ else
150
+ echo " Cannot run firecracker on $arch architecture!"
151
+ exit 1
152
+ fi
153
+
154
+ echo " Downloading $kernel ..."
155
+ curl -fsSL -o $dest_kernel $kernel
156
+
157
+ echo " Downloading $rootfs ..."
158
+ curl -fsSL -o $dest_rootfs $rootfs
159
+
160
+ echo " Saved kernel file to $dest_kernel and root block device to $dest_rootfs ."
138
161
```
139
162
140
163
- set the guest kernel:
141
164
142
165
``` bash
143
- curl --unix-socket /tmp/firecracker.socket -i \
144
- -X PUT ' http://localhost/boot-source' \
145
- -H ' Accept: application/json' \
146
- -H ' Content-Type: application/json' \
147
- -d ' {
148
- "kernel_image_path": "./hello-vmlinux.bin",
149
- "boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
150
- }'
166
+ arch=` uname -m`
167
+ kernel_path=" hello-vmlinux.bin"
168
+
169
+ if [ ${arch} = " x86_64" ]; then
170
+ curl --unix-socket /tmp/firecracker.socket -i \
171
+ -X PUT ' http://localhost/boot-source' \
172
+ -H ' Accept: application/json' \
173
+ -H ' Content-Type: application/json' \
174
+ -d ' {
175
+ "kernel_image_path": \"${kernel_path}\",
176
+ "boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
177
+ }'
178
+ elif [ ${arch} = " aarch64" ]; then
179
+ curl --unix-socket /tmp/firecracker.socket -i \
180
+ -X PUT ' http://localhost/boot-source' \
181
+ -H ' Accept: application/json' \
182
+ -H ' Content-Type: application/json' \
183
+ -d ' {
184
+ "kernel_image_path": \"${kernel_path}\,
185
+ "boot_args": "keep_bootcon console=tty1 reboot=k panic=1 pci=off"
186
+ }'
187
+ else
188
+ echo " Cannot run firecracker on $arch architecture!"
189
+ exit 1
190
+ fi
151
191
```
152
192
153
193
- set the guest rootfs:
154
194
155
195
``` bash
156
- curl --unix-socket /tmp/firecracker.socket -i \
196
+ rootfs_path=" hello-rootfs.ext4"
197
+ curl --unix-socket /tmp/firecracker.socket -i \
157
198
-X PUT ' http://localhost/drives/rootfs' \
158
199
-H ' Accept: application/json' \
159
200
-H ' Content-Type: application/json' \
160
201
-d ' {
161
202
"drive_id": "rootfs",
162
- "path_on_host": "./hello-rootfs.ext4" ,
203
+ "path_on_host": \"${rootfs_path}\ ,
163
204
"is_root_device": true,
164
205
"is_read_only": false
165
206
}'
@@ -181,11 +222,9 @@ Going back to your first shell, you should now see a serial TTY prompting you
181
222
to log into the guest machine. If you used our ` hello-rootfs.ext4 ` image,
182
223
you can login as ` root ` , using the password ` root ` .
183
224
184
- When you're done,
185
- issuing a ` reboot ` command inside the guest will shutdown Firecracker
186
- gracefully. This is because, since microVMs are not designed to be restarted,
187
- and Firecracker doesn't currently implement guest power management, we're
188
- using the keyboard reset action as a shut down switch.
225
+ When you're done, issuing a ` reboot ` command inside the guest will actually
226
+ shutdown Firecracker gracefully. This is due to the fact that Firecracker
227
+ doesn't implement guest power management.
189
228
190
229
** Note** : the default microVM will have 1 vCPU and 128 MiB RAM. If you wish to
191
230
customize that (say, 2 vCPUs and 1024MiB RAM), you can do so before issuing
@@ -206,7 +245,7 @@ curl --unix-socket /tmp/firecracker.socket -i \
206
245
207
246
The quickest way to build and test Firecracker is by using our development
208
247
tool ([ ` tools/devtool ` ] ( ../tools/devtool ) ). It employs a
209
- [ Docker container] ( ../tools/devctr/Dockerfile ) to store the software toolchain
248
+ per-architecture [ Docker container] ( ../tools/devctr/ ) to store the software toolchain
210
249
used throughout the development process. If you need help setting up
211
250
[ Docker] ( https://docker.com ) on your system, you can check out
212
251
[ Appendix B: Setting Up Docker] ( #appendix-b-setting-up-docker ) .
@@ -231,9 +270,8 @@ git checkout tags/v0.10.1
231
270
232
271
Within the Firecracker repository root directory:
233
272
234
- ``` bash
235
- tools/devtool build
236
- ```
273
+ 1 . on an ** x86_64** machine: ``` tools/devtool build ```
274
+ 1 . on an ** aarch64** machine: ``` tools/devtool build -- --target aarch64-unknown-linux-musl ```
237
275
238
276
This will build and place the two Firecracker binaries at
239
277
` build/debug/firecracker ` and ` build/debug/jailer ` . The default build profile
@@ -264,7 +302,8 @@ toolchains, such as the default Rust toolchains provided in certain Linux
264
302
distributions:
265
303
266
304
``` bash
267
- cargo build --target x86_64-unknown-linux-gnu
305
+ arch=` uname -m`
306
+ cargo build --target ${arch} -unknown-linux-gnu
268
307
```
269
308
270
309
That being said, Firecracker binaries built without ` devtool ` are always
@@ -283,7 +322,11 @@ Please note that the test suite is designed to ensure our
283
322
and, as such, some performance tests may fail when run on a regular desktop
284
323
machine. Specifically, don't be alarmed if you see
285
324
` tests/integration_tests/performance/test_process_startup_time.py ` failing when
286
- not run on an EC2 .metal instance.
325
+ not run on an EC2 .metal instance. You can skip performance tests with:
326
+
327
+ ``` bash
328
+ ./tools/devtool test -- --ignore integration_tests/performance
329
+ ```
287
330
288
331
## Appendix A: Setting Up KVM Access
289
332
@@ -298,17 +341,19 @@ sudo setfacl -m u:${USER}:rw /dev/kvm
298
341
Otherwise, if access is managed via the ` kvm ` group:
299
342
300
343
``` bash
301
- [ $( stat -c " %G" /dev/kvm) = kvm ] && sudo usermod -aG kvm ${USER} && echo " Access granted."
344
+ [ $( stat -c " %G" /dev/kvm) = kvm ] && sudo usermod -aG kvm ${USER} \
345
+ && echo " Access granted."
302
346
```
303
347
304
348
If none of the above works, you will need to either install the file
305
349
system ACL package for your distro and use the ` setfacl ` command as above,
306
350
or run Firecracker as ` root ` (via ` sudo ` ).
307
351
308
352
You can check if you have access to ` /dev/kvm ` with:
309
- ``` bash
310
- [ -r /dev/kvm ] && [ -w /dev/kvm ] && echo " OK" || echo " FAIL"
311
- ```
353
+
354
+ ``` bash
355
+ [ -r /dev/kvm ] && [ -w /dev/kvm ] && echo " OK" || echo " FAIL"
356
+ ```
312
357
313
358
** Note:** If you've just added your user to the ` kvm ` group via ` usermod ` , don't
314
359
forget to log out and then back in, so this change takes effect.
0 commit comments