Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Merge several versions back into one#31

Merged
pqwy merged 2 commits into
mirage:masterfrom
pqwy:dedup
Oct 27, 2016
Merged

Merge several versions back into one#31
pqwy merged 2 commits into
mirage:masterfrom
pqwy:dedup

Conversation

@pqwy
Copy link
Copy Markdown
Contributor

@pqwy pqwy commented Jul 23, 2016

This is my take on how to support multiple backends.

There are two reasons for splitting the lib into -xen and -solo5 specific ones, neatly conflated. One is that the stubs need different compilation options for the two backends. This is easily solved through existing _linkopts mechanisms. I'd argue that it also should be solved through these, because a separate library name is not an appropriate container for a C compilation flavor that is completely invisible on the OCaml level.

The second reason is trickier, in that entropy hooks into the event loop. This is provided by the OS module of all backends in a uniform way. The problem is that linking to that module as exposed by any one library fixes the compiled code to that library.

The second part can be solved by shimming over (the common part) of OS, exposing only the cmi to the client, and sealing the deal by using -opaque compilation to prevent any information not in the sig from leaking out. The shim passively redirects to the right implementation, as long as mirage exposes this information.

The benefits of this are:

  • It demonstrates a technique to avoid the explosion of spurious libraries that contain exactly the same code.
  • The mirage tool needs to know less about us.
  • Any dependent library, like nocrypto, does not need to know anything about target-specificity here. This is a completely private detail.
  • Lastly, it was easy to add the pure unix flavor, so entropy can now be used wherever.

I welcome testing, particularly on solo. And obviously, this hinges on the mirage PR.

Merge the two opam-level packages back into one. Deal with variations of C stub
build options through the `_linkflags` mechanism.

Cheese, sausages, crackers, and absolutely indispensable `topkg` support
provided by @dbuenzli.
Bounce the single call into Mirage API over a shim lib for the intersection of
the OS API provided by the backends.
@pqwy
Copy link
Copy Markdown
Contributor Author

pqwy commented Jul 23, 2016

A simple unikernel generating keys works on xen, ukvm, virtio and unix, under 4.02.3 and 4.03.0.

@pqwy pqwy mentioned this pull request Oct 24, 2016
2 tasks
@pqwy pqwy merged commit 1ca3c4e into mirage:master Oct 27, 2016
@pqwy pqwy deleted the dedup branch October 28, 2016 16:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant