|
1 | 1 | # Creating Custom rootfs and kernel Images
|
2 | 2 |
|
3 |
| -## Creating a kernel Image |
| 3 | +## Creating a Linux kernel Image |
4 | 4 |
|
5 | 5 | ### Manual compilation
|
6 | 6 |
|
@@ -72,7 +72,7 @@ config="resources/guest_configs/microvm-kernel-arm64-4.14.config"
|
72 | 72 |
|
73 | 73 | on an aarch64 machine.
|
74 | 74 |
|
75 |
| -## Creating a rootfs Image |
| 75 | +## Creating a Linux rootfs Image |
76 | 76 |
|
77 | 77 | A rootfs image is just a file system image, that hosts at least an init
|
78 | 78 | system. For instance, our getting started guide uses an EXT4 FS image with
|
@@ -185,3 +185,46 @@ The images resulting using this method are minimized Ubuntu 18.04.
|
185 | 185 |
|
186 | 186 | You should now have a kernel image (`vmlinux`) and a rootfs image
|
187 | 187 | (`rootfs.ext4`), that you can boot with Firecracker.
|
| 188 | + |
| 189 | +## Creating FreeBSD rootfs and kernel Images |
| 190 | + |
| 191 | +Here's a quick step-by-step guide to building a FreeBSD rootfs and kernel that |
| 192 | +Firecracker can boot: |
| 193 | + |
| 194 | +1. Boot a FreeBSD system. In EC2, the |
| 195 | + [FreeBSD 13 Marketplace image](https://aws.amazon.com/marketplace/pp/prodview-ukzmy5dzc6nbq) |
| 196 | + is a good option; you can also use weekly snapshot AMIs published by the |
| 197 | + FreeBSD project. (Firecracker support is in FreeBSD 14 and later, so you'll |
| 198 | + need FreeBSD 13 or later to build it.) |
| 199 | + |
| 200 | + The build will require about 50 GB of disk space, so size the disk |
| 201 | + appropriately. |
| 202 | + |
| 203 | +1. Log in to the FreeBSD system and become root. If using EC2, you'll want to |
| 204 | + ssh in as `ec2-user` with your chosen SSH key and then `su` to become root. |
| 205 | + |
| 206 | +1. Install git and check out the FreeBSD src tree: |
| 207 | + |
| 208 | + |
| 209 | + ```sh |
| 210 | + pkg install -y git |
| 211 | + git clone https://git.freebsd.org/src.git /usr/src |
| 212 | + ``` |
| 213 | + |
| 214 | + At present (July 2023) Firecracker support is only present in the `main` |
| 215 | + branch. |
| 216 | + |
| 217 | +1. Build FreeBSD: |
| 218 | + |
| 219 | + ```sh |
| 220 | + make -C /usr/src buildworld buildkernel KERNCONF=FIRECRACKER |
| 221 | + make -C /usr/src/release firecracker DESTDIR=`pwd` |
| 222 | + ``` |
| 223 | + |
| 224 | +You should now have a rootfs `freebsd-rootfs.bin` and a kernel `freebsd-kern.bin` |
| 225 | +in the current directory (or elsewhere if you change the `DESTDIR` value) that |
| 226 | +you can boot with Firecracker. Note that the FreeBSD rootfs generated in this |
| 227 | +manner is somewhat minimized compared to "stock" FreeBSD; it omits utilities |
| 228 | +which are only relevant on physical systems (e.g., utilities related to floppy |
| 229 | +disks, USB devices, and some network interfaces) and also debug files and the |
| 230 | +system compiler. |
0 commit comments