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