Examples of simple MirageOS apps
OCaml Makefile Other
Latest commit f36d295 Jan 2, 2017 @mor1 mor1 committed on GitHub Merge pull request #214 from FlorianHeigl/patch-1
w3c compliance
Permalink
Failed to load latest commit information.
app_info Add a console example with app_info. Jul 22, 2016
block replace OS.Time calls with proper functorized Time Jul 27, 2016
conduit_server conduit_server: fix warnings Mar 12, 2016
conduit_server_manual replace OS.Time calls with proper functorized Time Jul 27, 2016
console Fixes a couple of examples (consistent use of time impl/jobs). Jul 28, 2016
dhcp replace OS.Time calls with proper functorized Time Jul 27, 2016
dns Merge pull request #166 from yomimono/mode-shift Jul 22, 2016
ethifv4 replace OS.Time calls with proper functorized Time Jul 27, 2016
hello minor Jul 28, 2016
http-fetch replace OS.Time calls with proper functorized Time Jul 27, 2016
io_page Fixes a couple of examples (consistent use of time impl/jobs). Jul 28, 2016
kv_ro Fix the unikernels to work with functoria. Feb 26, 2016
kv_ro_crunch replace OS.Time calls with proper functorized Time Jul 27, 2016
lwt make lwt with -t $(MODE) instead of --$(MODE). Jul 21, 2016
netif-forward Ask for two distinct network interfaces via key_gen Jun 28, 2016
network merlin: don't need REC declarations? Jul 6, 2016
ping replace OS.Time calls with proper functorized Time Jul 27, 2016
ping6 replace OS.Time calls with proper functorized Time Jul 27, 2016
stackv4 merlin: don't need REC declarations? Jul 6, 2016
static_website w3c compliance Dec 26, 2016
static_website_tls static_website_tls: tidy up and add logging Jul 6, 2016
tracing Add a link to the wiki. Dec 5, 2015
.gitignore Ignore some generated files. Jul 22, 2016
.merlin make merlin happier Jul 6, 2016
.travis.yml test on both 4.02 and 4.03 Jun 12, 2016
Makefile changes references to --unix/--xen to -t unix/xen Jul 21, 2016
Makefile.config use sudo to testrun the examples Mar 13, 2016
README.md add -f to specify config file Jul 22, 2016
UNLICENSE whitespace Jul 23, 2014
opam fix typo in url Mar 19, 2015
testrun.sh run all executables on travis Mar 13, 2016

README.md

Build Status

Prerequisites

  • Install latest OPAM (at least 1.1.0), following instructions at http://opam.ocaml.org/

  • Install the mirage package with OPAM, updating your package first if necessary:

    $ opam update -u
    $ opam install mirage
    $ eval `opam config env`
  • Please ensure that your Mirage command-line version is at least 2.7.0 before proceeding:
    $ mirage --version
    2.7.0

Configure, Build, Run

Each example is invoked in the same way:

$ make ${example}-configure
$ make ${example}-build

So to configure the hello example, run make hello-configure, and to build it, run make hello-build. The binaries built in the process can then be found in the example's directory:

$ cd hello/
$ ./mir-console
Hello World!
Hello World!
...

If you want to clean up afterwards, the usual does the trick:

$ make ${example}-clean

Some global targets are also provided in the Makefile:

$ make all                   ## equivalent to ...
$ make configure build
$ make clean

Details

The Makefile simply invokes sample-specific sample/Makefile. Each of those invokes the mirage command-line tool to configure, build and run the sample, passing flags and environment as directed. The mirage command-line tool assumes that the OPAM package manager is present and is used to manage installation of an OCaml dependencies.

The mirage command-line tool supports four commands, each of which either uses config.ml in the current directory or supports passing a config.ml directly.

To configure a unikernel before building:

$ mirage configure [-f config.ml] -t [unix|xen]

The boot target is selected via -t unix or -t xen. The default is selected based on the presence of target-specific packages, e.g., mirage-unix or mirage-xen.

To build a unikernel:

$ make

The output will be created next to the config.ml file used.

To run a unikernel:

$ make run

This will either execute the native binary created (if on -t unix) or create a default .xl configuration file (if on -t xen). In the latter case you will need to edit the generated configuration file appropriately if you wish to use block or network devices.

To clean up after building a unikernel:

$ make clean

Experimental Modules

The unikernels in this repository can also be used as a test suite for Mirage. The master branch should work with packages released in the main opam repository, and the mirage-dev branch will work with packages held in a staging repository for experimental Mirage packages. To use the staging repository:

$ opam remote add mirage-dev git://github.com/mirage/mirage-dev

Then upgrade packages and build the mirage-dev branch of mirage-skeleton.