I went through the Getting Started guide of Firecracker microVM via building from source via Docker and following the steps. I have working knowledge of Docker via CLI/Visual Studio UI/ECS and remember building AWS AMIs manually before the Docker ubiquity...
However, this part is completely uncharted territory for me and several googling rounds over the past weeks did not help:
Next, you will need an uncompressed Linux kernel binary, and an ext4 file system image (to use as rootfs). You can use these files from our microVM image S3 bucket: kernel, and rootfs.
What is hello-vmlinux.bin
and how to build one with my pre-installed apps? Could it be done similarly to Docker or AMI, i.e. in a simple way?
What is hello-rootfs.ext4
file and how to create a custom one for the same purpose as in 1. above?
A rootfs image is just a file system image, that hosts at least an init system. For instance, our getting started guide uses an EXT4 FS image with 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.
Firecracker is a virtual machine monitor (VMM) that uses the Linux Kernel-based Virtual Machine (KVM) to create and manage microVMs.
The main component of Firecracker is a virtual machine monitor (VMM) that uses the Linux Kernel Virtual Machine (KVM) to create and run microVMs. Firecracker has a minimalist design. It excludes unnecessary devices and guest-facing functionality to reduce the memory footprint and attack surface area of each microVM.
Each Firecracker microVM runs with a reduced memory overhead of less than 5 MiB, enabling a high density of microVMs to be packed on each server. Firecracker provides a rate limiter built into every microVM. This enables optimized sharing of network and storage resources, even across thousands of microVMs. How It Works
This enables fast startup times. Firecracker initiates user space or application code in as little as 125 ms and supports microVM creation rates of up to 150 microVMs per second per host. Scale and efficiency
You can control the Firecracker process via a RESTful API that enables common actions such as configuring the number of vCPUs or starting the machine. It provides built-in rate limiters, which allows you to granularly control network and storage resources used by thousands of microVMs on the same machine.
vmlinux.bin - it's linux kernel image which will be used by VM. Probably you can use provided kernel w/o any modifications.
hello-rootfs.ext4 - it's a file which contains root file system for your VM. You have to modify the file to add your application.
mkdir -p /tmp/myroot
sudo mount rootfs.ext4 /tmp/my-rootfs
Add start script for your application to /tmp/myroot/etc/init.d/ Start script have to be prepared for OpenRC init system.
Unmount rootfs
sudo umount /zprojects/modus/sketch/images/hello-rootfs.ext4
Start firecracker so your application will be started as a part of VM init system start up.
You probably would like to check how to provide network access to your VM also: vm network setup doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With