Coder Social home page Coder Social logo

drup / mirage-skeleton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mirage/mirage-skeleton

0.0 2.0 0.0 614 KB

Build skeleton and examples of simple Mirage apps

License: The Unlicense

Makefile 2.83% OCaml 95.69% Shell 1.33% HTML 0.15%

mirage-skeleton's Introduction

Build Status

mirage-skeleton

This repository is a collection of tutorial code referred to from the Mirage website, example code for using specific devices like filesystems and networks, and higher-level applications like DHCP, DNS, and Web servers.

  • tutorial/ contains the tutorial content.
  • device-usage/ contains examples showing specific devices.
  • applications/ contains the higher-level examples, which may use several different devices.

Prerequisites

  • Install latest OPAM (at least 1.2.2), following instructions at https://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 3.0.0 before proceeding:
    $ mirage --version
    3.0.5

Trivial example

You can check that your build environment is working and get a feel for the normal workflow by trying to compile the noop application.

    $ cd tutorials/noop
    $ mirage configure -t unix # initial setup for UNIX backend
    $ make depend # install dependencies
    $ make # build the program
    $ ./noop # run the program

Note that in the general case, you may need to specify more options at the mirage configure stage. You can find out about them with mirage configure --help. For example, you may need to specify what networking method should be used, with, e.g., --net socket or --net direct at the mirage configure stage.

Configure, Build, Run

Each unikernel lives in its own directory, and can be configured, built, and run from that location. For example:

    $ cd applications/static_website_tls
    $ mirage configure -t unix # initial setup for UNIX backend
    $ make depend # install dependencies
    $ make # build the program
    $ ./https # run the program

If you want to clean up mirage's artifacts after building, mirage clean will do the trick:

    $ cd applications/static_website_tls
    $ mirage clean

There is also a top-level Makefile at the root of this repository with convenience functions for configuring, building, and running all of the examples in one step.

    $ 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 -t [ukvm|kvm|qubes|macosx|unix|xen]

The boot target is selected via the -t flag. The default target is unix. Depending on what devices are present in config.ml, there may be additional configuration options for the unikernel. To list the options,

    $ mirage help configure

and see the section labeled UNIKERNEL PARAMETERS.

To install dependencies

After running mirage configure:

    $ make depend

to install the list of dependencies discovered in the mirage configure phase.

To build a unikernel:

    $ make

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

To run a unikernel:

The mechanics of running the generated artifact will be dependent on the backend used. For details, see solo5's readme for Ukvm and Virtio, the qubes-test-mirage repository's readme for Qubes, or the MirageOS website instructions on booting Xen unikernels.

For the Macosx and Unix backends, running as a normal process should suffice.

For summaries by backend that assume the hello example, see below:

Unix:

    $ cd hello
    $ mirage configure -t unix
    $ make depend
    $ make
    $ ./hello

Xen:

    $ cd hello
    $ mirage configure -t xen
    $ make depend
    $ make
    $ sudo xl create xen.xl -c

Ukvm:

    $ cd hello
    $ mirage configure -t ukvm
    $ make depend
    $ make
    $ ./ukvm-bin hello.ukvm

Virtio:

    $ cd hello
    $ mirage configure -t virtio
    $ make depend
    $ make
    $ solo5-run-virtio ./https.virtio

Macosx:

    $ cd hello
    $ mirage configure -t macosx
    $ make depend
    $ make
    $ ./hello

Qubes:

Some specific setup in the QubesOS manager is necessary to be able to easily run MirageOS unikernels -- please see the qubes-test-mirage readme for details.

    $ cd hello
    $ mirage configure -t qubes
    $ make depend
    $ make
    $ ~/test-unikernel hello.xen unikernel-test-vm

To clean up after building a unikernel:

    $ make clean

mirage-skeleton's People

Contributors

mor1 avatar avsm avatar samoht avatar yomimono avatar hannesm avatar djs55 avatar drup avatar olleolleolle avatar azul avatar talex5 avatar nojb avatar haesbaert avatar amirmc avatar mato avatar dsheets avatar mmaker avatar yallop avatar vbmithr avatar mk270 avatar jonludlam avatar garethr avatar anmonteiro avatar balrajsingh avatar chris00 avatar abbysmal avatar eyyub avatar florianheigl avatar heidihoward avatar lcdunstan avatar mattgray avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.