These are common instructions for applications in the extended maintainers catalog.
Each application gets their own directory, used for documenting, setting up, configuring, building, running, testing and debugging the application.
Common information, configuration scripts are collected together in other directories such as utils/
.
The following are common information for examples of applications running in binary compatibility (i.e. bincompat) mode. Instructions assume you are running commands in the application example subdirectory.
Applications running in binary compatibility mode use app-elfloader
images to load and run native Linux ELFs (Executable and Linking Format files).
The images are generated using library/base/
.
We call them base
images or base
kernels.
The images are also stored in the Unikraft registry and can be pulled from there.
A typical directory for a bincompat app contains:
Kraftfile
: build / run rules, including pulling thebase
imageDockerfile
: filesystem, including binary and librariesMakefile
: used to generate the root filesystem from theDockerfile
rulesREADME.md
: specific application instructions, such as starting and testing an applicationconfig.yaml
: configuration file to generate script files to run the application- specific application files, such as configuration files and source code files
The following are required before building and running a bincompat app. In case you have already done them for other bincompat runs, you can skip them:
-
Configure
kraft
to be able to pull contents from GitHub. For this, first generate a GitHub token that has all therepo
list items checked. Configurekraft
to use the token:kraft login -u <username> -t <token> github.com
In the command above, replace
<username>
with your GitHub username and<token>
with the generated token. -
Install Docker following the official instructions. This can be either Docker Engine or Docker Desktop.
-
Start a BuildKit container to be used by KraftKit to build the filesystem from the Dockerfile. Source the corresponding script from the
utils/
directory. This can be one of the following commands, depending on the location of your application directory:source ../../utils/start-buildkit.sh source ../../../utils/start-buildkit.sh
-
Running the application requires kernel images (called
base
kernel images). If not already generated, generate the kernels in thekernels/
directory, while inside thelibrary/base/
directory: This can be one of the following commands, depending on the location of your application directory:../../utils/bincompat/base-build-all.sh ../../../utils/bincompat/base-build-all.sh
config.yaml
is used to generate the scripts and configuration files required to build and run the application.
To generate these files, run one of the following commands, depending on the location of your application directory:
../../utils/bincompat/generate.py
It generates the run*
scripts and configuration files used to run the application in bincompat mode using different tools / VMMs.
You build and run the application using KraftKit.
Follow the specific instructions in the README.md
file in the application directory for specifics on building and running with KraftKit and on using the application.
To make it easier to run application in bincompat mode, use the generated scripts. Follow the steps:
-
Build the application root filesystem as an initial ramdisk from the
Dockerfile
using:make initrd
This creates the
rootfs/
directory and therootfs.cpio
file with the root filesystem:tree rootfs/
-
Run the scripts:
./run-qemu-x86_64.sh ./run-fc-x86_64.sh ./kraft-run-qemu.sh
All scripts start a local instance of the
base
image with the application running in bincompat mode. The application filesystem (binary executable, libraries, configuration files) are packed inside therootfs.cpio
initrd file. There is no Kraft script to run Firecracker, as Kraft doesn't currently support running images with networking support using Firecracker. -
You can run the
strace
ordebug
kernels with the scripts:./run-qemu-x86_64.sh ../../kernels/base_qemu-x86_64-strace ./run-qemu-x86_64.sh ../../kernels/base_qemu-x86_64-debug
-
Build, run and use the application as detailed in the application
README.md
.