6

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.

  1. 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?

  2. What is hello-rootfs.ext4 file and how to create a custom one for the same purpose as in 1. above?

tgogos
  • 23,218
  • 20
  • 96
  • 128
V.B.
  • 6,236
  • 1
  • 33
  • 56
  • 3
    Unik does it by creating a filesystem (ext4) with the compiled program using alpine-minirootfs-3.8.1-x86_64.tar.gz. You can check the below link: https://github.com/solo-io/unik/blob/master/containers/compilers/firecracker/build-image – Swarvanu Sengupta Jan 19 '19 at 11:44

1 Answers1

6

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.

  1. Mount provided rootfs to do your changes

mkdir -p /tmp/myroot

sudo mount rootfs.ext4 /tmp/my-rootfs

  1. Copy your application and all dependencies to /tmp/my-rootfs/opt/
  2. Add start script for your application to /tmp/myroot/etc/init.d/ Start script have to be prepared for OpenRC init system.

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

MaxV
  • 2,601
  • 3
  • 18
  • 25