Skip to content

Commit

Permalink
docs: details on building rootfs
Browse files Browse the repository at this point in the history
Mention the ability to use devtool to automate
the steps of building a Firecracker tailored disk
image.

Signed-off-by: Diana Popa <[email protected]>
  • Loading branch information
dianpopa authored and gbionescu committed Aug 26, 2021
1 parent 24da8bd commit 4001cbd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
14 changes: 7 additions & 7 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 85,10 @@ file system image (to use as rootfs).

1. To run an `x86_64` guest you can download such resources from:
[kernel](https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/x86_64/kernels/vmlinux.bin)
and [rootfs](https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4).
and [rootfs](https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/x86_64/rootfs/bionic.rootfs.ext4).
1. To run an `aarch64` guest, download them from:
[kernel](https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/aarch64/kernels/vmlinux.bin)
and [rootfs](https://s3.amazonaws.com/spec.ccfc.min/img/aarch64/ubuntu_with_ssh/fsfiles/xenial.rootfs.ext4).
and [rootfs](https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/aarch64/rootfs/bionic.rootfs.ext4).

Now, let's open up two shell prompts: one to run Firecracker, and another one
to control it (by writing to the API socket). For the purpose of this guide,
Expand Down Expand Up @@ -117,14 117,14 @@ In your **second shell** prompt:
arch=`uname -m`
dest_kernel="hello-vmlinux.bin"
dest_rootfs="hello-rootfs.ext4"
image_bucket_url="https://s3.amazonaws.com/spec.ccfc.min/img"
image_bucket_url="https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/$arch"

if [ ${arch} = "x86_64" ]; then
kernel="${image_bucket_url}/quickstart_guide/x86_64/kernels/vmlinux.bin"
rootfs="${image_bucket_url}/hello/fsfiles/hello-rootfs.ext4"
kernel="${image_bucket_url}/kernels/vmlinux.bin"
rootfs="${image_bucket_url}/rootfs/bionic.rootfs.ext4"
elif [ ${arch} = "aarch64" ]; then
kernel="${image_bucket_url}/quickstart_guide/aarch64/kernels/vmlinux.bin"
rootfs="${image_bucket_url}/aarch64/ubuntu_with_ssh/fsfiles/xenial.rootfs.ext4"
kernel="${image_bucket_url}/kernels/vmlinux.bin"
rootfs="${image_bucket_url}/rootfs/bionic.rootfs.ext4"
else
echo "Cannot run firecracker on $arch architecture!"
exit 1
Expand Down
23 changes: 22 additions & 1 deletion docs/rootfs-and-kernel-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 76,10 @@ OpenRC as an init system. Note that, whichever file system you choose to use,
support for it will have to be compiled into the kernel, so it can be mounted
at boot time.

To build an EXT4 image:
In order to obtain an EXT4 image that you can use with Firecracker, you have
the following options:

### Manual build

1. Prepare a properly-sized file. We'll use 50MiB here, but this depends
on how much data you'll want to fit inside:
Expand Down Expand Up @@ -158,5 161,23 @@ Alpine Linux:
sudo umount /tmp/my-rootfs
```

### Use the provided recipe

The disk images used in our CI to test Firecracker's features are obtained by
using the recipe inside devtool:

```bash
./tools/devtool build_rootfs -s 300
```

or

```bash
./tools/devtool build_rootfs -p
```

in order to obtain a partuuid enabled rootfs.
The images resulting using this method are minimized Ubuntu 18.04.

You should now have a kernel image (`vmlinux`) and a rootfs image
(`rootfs.ext4`), that you can boot with Firecracker.

0 comments on commit 4001cbd

Please sign in to comment.