-
-
Notifications
You must be signed in to change notification settings - Fork 604
Running unmodified Linux executables on OSv
From the beginning, OSv has been designed to implement a subset of Linux flavor of POSIX API. But until the release 0.54.0 most Linux applications had to be re-compiled from source as shared libraries or some, like Java, rely on OSv version of /usr/bin/java
wrapper to run. This meant one could NOT run a Linux executable "as is". In other words, OSv has always been Linux-compatible at source level but not at binary level.
Starting with the release 0.54.0, it should be in general possible to run unmodified Linux position-independent executables (so-called "PIEs") and position-dependent executables "as-is" as long as they do not use "fork/execve" or other unsupported Linux API. It means that very often one can take a binary from Linux host and run it on OSv without having to locate the source code on the Internet and build it as a shared library. At this moment OSv still does not support statically-linked executables as described here.
So how can one run arbitrary Linux executable on OSv? In high-level it as simple as locating and adding the relevant executable file and any related files onto the filesystem that is part of an OSv image and running that image on the hypervisor of choice. Creating an OSv image requires fusing its kernel and application files together by either using Capstan or the Python-based build scripts. The former involves collecting all files to be added into a directory or using a template and is described in more detail here and there. The latter, which most of this Wiki focuses on, involves using fairly new shell script manifest_from_host.sh
and build
that consumes a "manifest" produced by former one and delegates to number of python scripts to build a final image.
Very often an executable would depend on a number of shared libraries which also need to be added to the image.