Skip to content

Commit 4823ac8

Browse files
committed
release: update documentation on supported archs
Signed-off-by: Diana Popa <[email protected]>
1 parent 5e9e3a1 commit 4823ac8

File tree

2 files changed

+96
-51
lines changed

2 files changed

+96
-51
lines changed

docs/api_requests/actions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ curl --unix-socket /tmp/firecracker.socket -i \
8686
}"
8787
```
8888

89-
9089
## SendCtrlAltDel
9190

9291
This action will send the CTRL+ALT+DEL key sequence to the microVM. By
@@ -100,12 +99,14 @@ i8042 controller. Driver support for both these devices needs to be present in
10099
the guest OS. For Linux, that means the guest kernel needs
101100
`CONFIG_SERIO_I8042` and `CONFIG_KEYBOARD_ATKBD`.
102101

103-
**Note on boot time impact**: at, boot time the Linux driver for i8042 spends
102+
**Note1**: at boot time, the Linux driver for i8042 spends
104103
a few tens of milliseconds probing the device. This can be disabled by using
105104
these kernel command line parameters:
106105

107106
```i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd```
108107

108+
**Note2** This action is only supported on `x86_64` architecture.
109+
109110
### SendCtrlAltDel Example
110111

111112
```bash

docs/getting-started.md

Lines changed: 93 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ The generic requirements are explained below:
2525

2626
- **Linux 4.14+**
2727

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.
3030

3131
- **KVM**
3232

@@ -42,16 +42,18 @@ The generic requirements are explained below:
4242
the basic requirements to run Firecracker.</summary>
4343

4444
```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"
5557
```
5658

5759
</details>
@@ -62,7 +64,7 @@ Firecracker is linked statically against
6264
[musl](https://www.musl-libc.org/), having no library dependencies. You can
6365
just download the latest binary from our
6466
[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.
6668

6769
On the EC2 instance, this binary can be downloaded as:
6870

@@ -82,7 +84,6 @@ Make the binary executable:
8284
chmod +x firecracker
8385
```
8486

85-
8687
If, instead, you'd like to build Firecracker yourself, you should check out
8788
the [Building From Source section](#building-from-source) in this doc.
8889

@@ -100,14 +101,14 @@ First, make sure you have the `firecracker` binary available - either
100101
[built from source](#building-from-source).
101102

102103
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).
111112

112113
Now, let's open up two shell prompts: one to run Firecracker, and another one
113114
to control it (by writing to the API socket). For the purpose of this guide,
@@ -133,33 +134,72 @@ In your **second shell** prompt:
133134
- get the kernel and rootfs, if you don't have any available:
134135

135136
```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."
138160
```
139161

140162
- set the guest kernel:
141163

142164
```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
151190
```
152191

153192
- set the guest rootfs:
154193

155194
```bash
156-
curl --unix-socket /tmp/firecracker.socket -i \
195+
rootfs_path="hello-rootfs.ext4"
196+
curl --unix-socket /tmp/firecracker.socket -i \
157197
-X PUT 'http://localhost/drives/rootfs' \
158198
-H 'Accept: application/json' \
159199
-H 'Content-Type: application/json' \
160200
-d '{
161201
"drive_id": "rootfs",
162-
"path_on_host": "./hello-rootfs.ext4",
202+
"path_on_host": \"${rootfs_path}\,
163203
"is_root_device": true,
164204
"is_read_only": false
165205
}'
@@ -181,11 +221,9 @@ Going back to your first shell, you should now see a serial TTY prompting you
181221
to log into the guest machine. If you used our `hello-rootfs.ext4` image,
182222
you can login as `root`, using the password `root`.
183223

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.
189227

190228
**Note**: the default microVM will have 1 vCPU and 128 MiB RAM. If you wish to
191229
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 \
206244

207245
The quickest way to build and test Firecracker is by using our development
208246
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
210248
used throughout the development process. If you need help setting up
211249
[Docker](https://docker.com) on your system, you can check out
212250
[Appendix B: Setting Up Docker](#appendix-b-setting-up-docker).
@@ -231,9 +269,8 @@ git checkout tags/v0.10.1
231269

232270
Within the Firecracker repository root directory:
233271

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```
237274

238275
This will build and place the two Firecracker binaries at
239276
`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
264301
distributions:
265302

266303
```bash
267-
cargo build --target x86_64-unknown-linux-gnu
304+
arch=`uname -m`
305+
cargo build --target ${arch}-unknown-linux-gnu
268306
```
269307

270308
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
283321
and, as such, some performance tests may fail when run on a regular desktop
284322
machine. Specifically, don't be alarmed if you see
285323
`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+
```
287329

288330
## Appendix A: Setting Up KVM Access
289331

@@ -298,17 +340,19 @@ sudo setfacl -m u:${USER}:rw /dev/kvm
298340
Otherwise, if access is managed via the `kvm` group:
299341

300342
```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."
302345
```
303346

304347
If none of the above works, you will need to either install the file
305348
system ACL package for your distro and use the `setfacl` command as above,
306349
or run Firecracker as `root` (via `sudo`).
307350

308351
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+
```
312356

313357
**Note:** If you've just added your user to the `kvm` group via `usermod`, don't
314358
forget to log out and then back in, so this change takes effect.

0 commit comments

Comments
 (0)