OSv, a new operating system for the cloud.
C C++ Python Java Roff Makefile Other
Latest commit 7ce5eb7 Jan 17, 2018 @wkozaczuk wkozaczuk committed with nyh Added number of syscalls to support golang
This patch adds number of syscalls to that are needed to make Golang
apps run on OSv.

Most of this changes were produced by Benoit Canet.

Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
Message-Id: <1516166270-13397-1-git-send-email-jwkozaczuk@gmail.com>
Failed to load latest commit information.
apps @ 550ca3c update apps submodule Jan 16, 2018
arch x64/processor.hh: fix wrongly named variable Jan 8, 2018
bsd Invalidate route cache when removing IP address Nov 14, 2017
compiler osv: use __ASSEMBLY__ instead of ASSEMBLY Jan 24, 2017
conf build: move arch-specific configuration to conf/$(arch).mk Jun 18, 2014
core memory: respect _bitset length bounds in page_range_allocator Jan 16, 2018
documentation Update devices-and-drivers.txt Sep 22, 2013
drivers drivers/isa-serial.cc: Prevent spinning under VMWare. Nov 2, 2017
external nfs: Add a makefile option to build in libnfs. Dec 20, 2015
fastlz gcc 7: add missing include Jul 16, 2017
fs Fix crash in read_partition_table() Sep 20, 2017
images Remove deprecated "mgmt" submodule Jul 26, 2016
include new object loading exceptions in core/elf.cc Oct 26, 2017
java/jvm Move java/* to modules/java* and modularize java images build process Dec 21, 2016
libc include stresep function Sep 13, 2017
licenses zfs: Port lz4 compression algorithm from FreeBSD May 23, 2014
modules Fix httpserver/Makefile Dec 10, 2017
musl @ 372a948 Add musl git submodule Aug 4, 2014
scripts setup.py: add "--allowerasing" to yum command Jan 14, 2018
static/etc mount: read initial entries from fstab May 30, 2014
tests Fix the bug in SYSCALL implementation when called with 6 arguments Jan 14, 2018
tools cpiod: add verbose program option Nov 8, 2017
.gitignore Move java/* to modules/java* and modularize java images build process Dec 21, 2016
.gitmodules Split httpserver module into httpserver-api and httpserver-html5-gui Sep 10, 2017
CODINGSTYLE.md Add line breaks to CODINGSTYLE Jan 26, 2015
Doxyfile doxygen: add include strip path Sep 16, 2014
LICENSE Add LICENSE files to the main project Sep 15, 2013
Makefile lzloader miscompiles with gcc 6.2 Nov 19, 2017
PORTING build.mk: enable first AArch64 stubbed support Apr 2, 2014
README.md README: Arch Linux: workaround for openssl-1.0 Oct 6, 2017
bootfs.S Encapsulate boot filesystem image in an object file for direct linking Dec 23, 2012
bootfs.manifest.skel mkfs.so: split mkfs.so in mkfs.so and cpiod.so. Dec 3, 2013
config.json Remove deprecated "mgmt" submodule Jul 26, 2016
dummy-shlib.cc loader: add a dummy shared library to the build Dec 23, 2012
gen-ctype-data.cc locale: fix std::toupper(), std::tolower(), and std::regex Feb 1, 2016
linux.cc Added number of syscalls to support golang Jan 17, 2018
loader.cc command line: check for empty cmdline case after parsing cmdline Sep 13, 2017
runtime.cc runtime.c: avoid explicit "extern C" when header files are available Aug 1, 2017
usr.manifest.skel build: don't put unnecessary libraries in every image May 23, 2016
usr_nozfs.manifest.skel ramfs: support symbolic links Apr 27, 2017



OSv is a new open-source operating system for virtual-machines. OSv was designed from the ground up to execute a single application on top of a hypervisor, resulting in superior performance and effortless management when compared to traditional operating systems which were designed for a vast range of physical machines.

OSv has new APIs for new applications, but also runs unmodified Linux applications (most of Linux's ABI is supported) and in particular can run an unmodified JVM, and applications built on top of one.

For more information about OSv, see http://osv.io/ and https://github.com/cloudius-systems/osv/wiki



OSv can only be built on a 64-bit x86 Linux distribution. Please note that this means the "x86_64" or "amd64" version, not the 32-bit "i386" version.

If you wish, you can run the script 'scripts/setup.py' as root to install all dependencies. Otherwise, you may follow the manual instructions below.

First, install prerequisite packages:



Debian stable(wheezy) Debian stable(wheezy) requires to compile gcc, gdb and qemu. And also need to configure bridge manually.

More details are available on wiki page: Building OSv on Debian stable

Debian testing(jessie)

apt-get install build-essential libboost-all-dev genromfs autoconf libtool openjdk-7-jdk ant qemu-utils maven libmaven-shade-plugin-java python-dpkt tcpdump gdb qemu-system-x86 gawk gnutls-bin openssl python-requests lib32stdc++-4.9-dev p11-kit

Arch Linux

pacman -S base-devel git python apache-ant maven qemu gdb boost yaml-cpp unzip openssl-1.0

Apply the following patch to make it work with openssl-1.0

diff --git a/modules/lua/Makefile b/modules/lua/Makefile
index 9676f349..ddb6a075 100644
--- a/modules/lua/Makefile
+++ b/modules/lua/Makefile
@@ -123,7 +123,7 @@ $(CDIR)/ssl.lua: $(LUA_ROCKS_BIN)
 # Workaround because LuaRocks ignores /lib64
 ifneq ("$(wildcard /usr/lib64/libssl.so*)", "")
-       out/bin/luarocks install LuaSec 0.5 OPENSSL_LIBDIR=/usr/lib64
+       out/bin/luarocks install LuaSec 0.5 OPENSSL_LIBDIR=/usr/lib/openssl-1.0 OPENSSL_INCDIR=/usr/include/openssl-1.0
        out/bin/luarocks install LuaSec 0.5

Before start building OSv, you'll need to add your account to kvm group.

usermod -aG kvm <user name>



You may use Oracle JDK if you don't want to pull too many dependencies for openjdk-7-jdk

To ensure functional C++11 support, Gcc 4.8 or above is required, as this was the first version to fully comply with the C++11 standard.

Make sure all git submodules are up-to-date:

git submodule update --init --recursive

Finally, build everything at once:


to build only the OSv kernel, or more usefully,


to build an image of the OSv kernel and the default application.

scripts/build creates the image build/last/usr.img in qcow2 format. To convert this image to other formats, use the scripts/convert tool, which can create an image in the vmdk, vdi, raw, or qcow2-old formats (qcow2-old is an older qcow2 format, compatible with older versions of QEMU). For example:

scripts/convert raw

By default make will use the static libraries and headers of gcc in external submodule. To change this pass host via *_env variables:

make build_env=host

This will use static libraries and headers in the system instead (make sure they are installed before run make), if you only want to use C++ static libraries in the system, just set cxx_lib_env to host:

make cxx_lib_env=host

Running OSv


By default, this runs OSv under KVM, with 4 VCPUs and 2GB of memory, and runs the default management application containing a shell, a REST API server and a browser base dashboard (at port 8000).

If running under KVM you can terminate by hitting Ctrl+A X.

External Networking

To start osv with external networking:

sudo ./scripts/run.py -n -v

The -v is for kvm's vhost that provides better performance and its setup requires a tap and thus we use sudo.

By default OSv spawns a dhcpd that auto config the virtual nics. Static config can be done within OSv, configure networking like so:

ifconfig virtio-net0 netmask up
route add default gw

Test networking:

test invoke TCPExternalCommunication

Running Java or C applications that already reside within the image:

# Building and running a simple java application example
$ scripts/build image=java-example
$ scripts/run.py -e "java.so -cp /java-example Hello"

# Running an ifconfig by explicit execution of ifconfig.so (compiled C++ code)
$ scripts/build
$ sudo scripts/run.py -nv -e "/tools/ifconfig.so"