All Projects → hermitcore → hermit-playground

hermitcore / hermit-playground

Licence: other
A playground to build C/C++/Go/Fortran applications on top of RustyHermit

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language
shell
77523 projects
go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to hermit-playground

Libhermit
HermitCore: A C-based, lightweight unikernel
Stars: ✭ 190 (+1361.54%)
Mutual labels:  kernel, virtualization, operating-system, high-performance-computing, cloud-computing
Libhermit Rs
libhermit-rs: A Rust-based library operating system
Stars: ✭ 558 (+4192.31%)
Mutual labels:  kernel, virtualization, operating-system, high-performance-computing, cloud-computing
Rusty Hermit
RustyHermit - A Rust-based, lightweight unikernel
Stars: ✭ 268 (+1961.54%)
Mutual labels:  virtualization, operating-system, high-performance-computing, cloud-computing
Methylenix
The operating system written in Rust
Stars: ✭ 32 (+146.15%)
Mutual labels:  kernel, operating-system
nautilus
Nautilus Aerokernel
Stars: ✭ 30 (+130.77%)
Mutual labels:  kernel, operating-system
beeos
A simple "Unix-like" kernel trying to be POSIX compliant
Stars: ✭ 103 (+692.31%)
Mutual labels:  kernel, operating-system
wiser
🐎 Extremely minimal vmm for linux written in C. Hopefully someday will spin linux-vm for you.
Stars: ✭ 249 (+1815.38%)
Mutual labels:  kernel, operating-system
poplar
Microkernel and userspace written in Rust exploring modern ideas
Stars: ✭ 217 (+1569.23%)
Mutual labels:  kernel, operating-system
cxos
Operating System development experiment in Ada
Stars: ✭ 32 (+146.15%)
Mutual labels:  kernel, operating-system
SimpleOS
Operating System Coded in Assembly and C
Stars: ✭ 72 (+453.85%)
Mutual labels:  kernel, operating-system
KnutOS
An x86_64 hobbyist OS written in C and Assembly
Stars: ✭ 16 (+23.08%)
Mutual labels:  kernel, operating-system
SynnixOS
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.
Stars: ✭ 40 (+207.69%)
Mutual labels:  kernel, operating-system
DentOS
Experimental Stand-alone 32-bit Kernel with Bootloader written in AT&T Assembly and Freestanding C
Stars: ✭ 32 (+146.15%)
Mutual labels:  kernel, operating-system
georgios
Hobby Operating System
Stars: ✭ 19 (+46.15%)
Mutual labels:  kernel, operating-system
duckOS
Yet another hobby x86 UNIX-like operating system written in C and C++. Features a dynamically linked userspace, an in-house c standard library, and more! And yes, it runs DOOM.
Stars: ✭ 250 (+1823.08%)
Mutual labels:  kernel, operating-system
scaraOS
A 32bit multiboot OS kernel for IA32 (PC/AT) systems.
Stars: ✭ 31 (+138.46%)
Mutual labels:  kernel, operating-system
TravorOS
A simple OS running on Intel x86 architecture | No longer updating
Stars: ✭ 24 (+84.62%)
Mutual labels:  kernel, operating-system
flower
A learning OS
Stars: ✭ 50 (+284.62%)
Mutual labels:  kernel, operating-system
rnk
rnk is a RTOS targeting ARM architecture.
Stars: ✭ 22 (+69.23%)
Mutual labels:  kernel, operating-system
sanos
Sanos operating system kernel
Stars: ✭ 55 (+323.08%)
Mutual labels:  kernel, operating-system

HermitCore-rs - A Rust-based, lightweight unikernel for a scalable and predictable runtime behavior

Build Status Slack Status

HermitCore is a new unikernel targeting a scalable and predictable runtime for high-performance and cloud computing. We decided to develop a new version of the kernel in Rust . We promise that this will make it easier to maintain and extend our kernel. All code beside the kernel can still be developed in your preferred language (C/C++/Go/Fortran). If you want to develope pure Rust applications, please look into RustyHermit.

This repository contains the Rust-based playground for C/C++/Go/Fortran applications. Currently, it isn't stable and does not support all features of the C-based version and runs only in our own hypervisor.

Requirements

The build process works currently only on x86-based Linux systems. To build the HermitCore-rs kernel and applications you need:

  • CMake
  • Recent host compiler such as GCC
  • HermitCore cross-toolchain, i.e. Binutils, GCC, newlib, pthreads
  • Rust compiler (nightly release)
  • Rust source code for cross-compiling, which can be installed with rustup component add rust-src.

HermitCore-rs cross-toolchain

We provide a Docker container with all required tools to build HermitCore-rs applications.

To test the toolchain, create a simple C program (e.g. hello world) and name the file main.c. Use following command to build the applications:

$ docker run -v $PWD:/volume -w /volume --rm -t ghcr.io/hermitcore/hermit-toolchain:latest x86_64-hermit-gcc -o main main.c

The command mounts the current directory as working directory into a docker container and runs the cross-compiler to build the application. Afterwards, you will find the executable main in your current directory.

If you want to build the toolchain yourself, have a look at the path2rs branch of the repository hermit-toolchain. It contains scripts to build the whole toolchain for HermitCore-rs.

Building

Preliminary work

As a first step, the repository and its submodules have to be cloned:

$ git clone [email protected]:hermitcore/hermit-playground.git
$ cd hermit-playground
$ git submodule init
$ git submodule update

Building the library operating systems and its examples

To build the Rust-based kernel and its examples, go to the directory with the source code and issue the following commands:

$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

If your toolchain is not located in /opt/hermit/bin then you have to supply its location to the cmake command above like so:

$ cmake -DTOOLCHAIN_BIN_DIR=/home/user/hermit/bin ..

Assuming that binaries like x86_64-hermit-gcc and friends are located in that directory. To install your new version in the same directory, you have to set the installation path and install HermitCore-rs as follows:

$ cmake -DTOOLCHAIN_BIN_DIR=/home/user/hermit/bin -DCMAKE_INSTALL_PREFIX=/home/user/hermit ..
$ make
$ make install

Note: If you use the cross compiler outside of this repository, it uses the library operating system located by the toolchain (e.g. /opt/hermit/x86_64-hermit/lib/libhermit.a).

Uhyve - A lightweight hypervisor

Part of HermitCore is a small hypervisor, which is called uhyve. This tool helps to start HermitCore applications within a KVM-accelerated virtual machine. In principle it is a bridge to the Linux system. If the uyhve is registered as loader to the Linux system, HermitCore applications can be started like common Linux applications. uhyve can be registered with the following command:

$ sudo -c sh 'echo ":hermit:M:7:\\x42::/opt/hermit/bin/uhyve:" > /proc/sys/fs/binfmt_misc/register'

Applications can then be directly called like:

$ /opt/hermit/x86_64-hermit/extra/tests/hello

Otherwise, uhyve must be started directly and needs the path to the HermitCore application as an argument:

$ /opt/hermit/bin/uhyve /opt/hermit/x86_64-hermit/extra/tests/hello

Afterwards, the uhyve starts the HermitCore application within a VM.

Testing

HermitCore applications can be directly started as a standalone kernel within a virtual machine:

$ cd build
$ make install DESTDIR=~/hermit-build
$ cd ~/hermit-build/opt/hermit
$ bin/uhyve x86_64-hermit/extra/tests/hello

The application will be started within our thin hypervisor powered by Linux's KVM API and therefore requires KVM support. In principle, it is an extension of ukvm.

The environment variable HERMIT_CPUS specifies the number of CPUs (and no longer a range of core ids). Furthermore, the variable HERMIT_MEM defines the memory size of the virtual machine. The suffixes M and G can be used to specify a value in megabytes or gigabytes respectively. By default, the loader initializes a system with one core and 2 GiB RAM. For instance, the following command starts the stream benchmark in a virtual machine, which has 4 cores and 6GB memory:

$ HERMIT_CPUS=4 HERMIT_MEM=6G bin/uhyve x86_64-hermit/extra/benchmarks/stream

To enable an Ethernet device for uhyve, we have to setup a tap device on the host system. For instance, the following command establishes the tap device tap100 on Linux:

$ sudo ip tuntap add tap100 mode tap
$ sudo ip addr add 10.0.5.1/24 broadcast 10.0.5.255 dev tap100
$ sudo ip link set dev tap100 up
$ sudo bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap100/proxy_arp'

By default, uhyve's network interface uses 10.0.5.2as IP address, 10.0.5.1 for the gateway and 255.255.255.0 as network mask. The default configuration can be overwritten by the environment variables HERMIT_IP, HERMIT_GATEWAY and HERMIT_MASk. To enable the device, HERMIT_NETIF must be set to the name of the tap device. For instance, the following command starts an HermitCore application within uhyve and enables the network support:

$ HERMIT_IP="10.0.5.3" HERMIT_GATEWAY="10.0.5.1" HERMIT_MASK="255.255.255.0" HERMIT_NETIF=tap100 bin/uhyve x86_64-hermit/extra/tests/hello

Building your own HermitCore applications

You can take usr/tests as a starting point to build your own applications. All that is required is that you include [...]/HermitCore/cmake/HermitCore-Application.cmake in the first line of your application's CMakeLists.txt. It doesn't have to reside inside the HermitCore repository. Other than that, it should behave like normal CMake.

Tips

Dumping the kernel log

By setting the environment variable HERMIT_VERBOSE to 1, uhyve prints the kernel log messages to the screen at termination.

Missing features

(might be comming)

  • Multikernel support
  • Running baremetal/without hypervisor

Credits

HermitCore's Emoji is provided for free by EmojiOne.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

HermitCore-rs is being developed on GitHub. Create your own fork, send us a pull request, and chat with us on Slack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].