how-to-make-rootfs-criu-compatible

Cedana has a fork of the kata-containers repository. Certain files have been changed for enabling the creation of an Ubuntu RootFS. The changes are configurational in nature, and can be found in this commit. Docker should be installed on the host machine.

cd ~/kata-containers/tools/osbuilder/rootfs-builder
sudo USE_DOCKER=true ./rootfs.sh ubuntu

This creates a folder, “rootfs-ubuntu” which will be attached to the guest VM. We will now move the CRIU source code into the rootfs

cd ~/kata-containers/tools/osbuilder/rootfs-builder/rootfs-ubuntu/
sudo git clone https://github.com/checkpoint-restore/criu.git

Additionally, we also need to move the CRIU builder + daemon launcher script for the guest into the rootfs. The location in the rootfs is kata-containers/tools/osbuilder/rootfs-builder/rootfs-ubuntu/bin

cd ~/kata-containers/tools/osbuilder/rootfs-builder/rootfs-ubuntu/
sudo cp ~/cedana/scripts/kata-utils/build_start_daemon.sh bin/

We also need to move the cedana binary in the rootfs, so that the guest can access it.

cd ~/kata-containers/tools/osbuilder/rootfs-builder/rootfs-ubuntu/
sudo cp ~/cedana/cedana .

Now that we have a rootfs, we need to create an image out of it. This step is simple.

cd ~/kata-containers/tools/osbuilder/image-builder
sudo USE_DOCKER=true ./image_builder.sh ../rootfs-builder/rootfs-ubuntu/

The final argument is the location of the rootfs directory created in the previous step. This creates an image file called “kata-containers.img”. We need to copy the img into the appropriate place as per the config file

cd ~/kata-containers/tools/osbuilder/image-builder
sudo cp kata-containers.img /usr/share/kata-containers/

Last updated

Was this helpful?