OCaml 4.02 cross compiler for the rumprun unikernel stack
Shell
51
109 commits
updated Dec 8, 2015
This OPAM repository contains:
Experimental work in progress, may eat your data or at least wreak havoc with your OPAM instrallation! Using a separate OPAM switch is recommended.
For detailed technical documentation of this work, and current status of upstreaming the Mirage/Rumprun port, please see mirage/mirage#479.
If you are using an x86_64 machine to build: ensure that you are using a
32-bit OCaml compiler matching the version of ocaml-rumprun. opam switch 4.02.1+32bit should do the trick.
Add this repository to your OPAM installation:
opam repository add rumprun git://github.com/mato/opam-rumprun
On an x86_64 machine:
./build-rr.sh hw -- -F ACFLAGS=-m32 -F ACLFLAGS=-march=i686
Depending on your Linux distribution, you may need the gcc-multilib package installed.
On an x86 machine:
./build-rr.sh hw
Add the rumprun/bin directory added to your $PATH.
Install the ocaml-rumprun package, specifying a RUMPRUN_PLATFORM matching the rumprun toolchain you just built (look in the rumprun/bin directory):
RUMPRUN_PLATFORM=i486-rumprun-netbsdelf opam install ocaml-rumprun
Build a native "Hello, World!":
echo 'let () = print_endline "Hello, World!"' > hello.ml
ocamlfind -toolchain rumprun ocamlopt hello.ml -o hello
rumprun-bake hw_virtio hello.bin hello
Run it using (for example) KVM (root may be required):
rumprun kvm -i ./hello.bin
Rumprun provides a POSIX-like environment, so you can use the normal OCaml Unix module and pthreads. A simple example:
echo 'open Unix;; let () = print_endline (string_of_float (Unix.gettimeofday ()))' > unixtime.ml
ocamlfind -toolchain rumprun ocamlopt -package unix -linkpkg unixtime.ml -o unixtime
rumprun-bake hw_virtio unixtime.bin unixtime
Run it using (for example) KVM (root may be required):
rumprun kvm -i ./unixtime.bin
The following examples require that you install the MirageOS package.
Please note: The MirageOS package is currently on version 2.5.0+rumprun as
the rumprun-specific changes have not yet been upstreamed. You will need to pin
your installation of Mirage to this specific version. Using a separate OPAM
switch is recommended.
opam pin add mirage 2.5.0+rumprun
opam install mirage
(...)
∗ installed mirage.2.5.0+rumprun
Done.
Verify that version 2.5.0+rumprun is installed.
You will also need to clone the mirage-skeleton repository and check out the mirage-dev branch.
cd mirage-skeleton/consolemirage configure --target rumprunmake depend && makerumprun-bake hw_virtio mir-console.bin mir-consolerumprun kvm -i ./mir-console.bincd mirage-skeleton/stackv4NET=socket mirage configure --target rumprunmake depend && makerumprun-bake hw_virtio mir-stackv4.bin mir-stackv4rumprun kvm -i [network configuration...] ./mir-stackv4.binFor the KVM network configuration, something like this will give you a host-only tap0 network interface which can talk to the mirage unikernel:
-I 'qnet0,vioif,-net tap,ifname=tap0' -W qnet0,inet,static,172.20.0.10/24
The exact syntax depends on your QEMU version, networking setup and the phase of the moon. YMWV.
cd mirage-skeleton/static_websiteNET=socket mirage configure --target rumprunmake depend && makerumprun-bake hw_virtio mir-www.bin mir-wwwrumprun kvm -i [network configuration...] ./mir-www.binmirage-seal is a tool that seals the contents of a directory into a static unikernel, serving its contents over HTTP(S).
To use mirage-seal on rumprun:
Add an OPAM pin for the version with rumprun target support:
opam pin add mirage-seal git://github.com/mato/mirage-seal#rumprun
Put some HTML files in files/, and run:
mirage-seal -d files/ --no-tls --sockets -t rumprun
This will build ./mir-seal which you can rumpbake and rumprun as appropriate.
Currently the following MirageOS components are working on rumprun:
Work in progress:
Shell
100.0%
OCaml 4.02 cross compiler for the rumprun unikernel stack
Shell
51
109 commits
updated Dec 8, 2015
This OPAM repository contains:
Experimental work in progress, may eat your data or at least wreak havoc with your OPAM instrallation! Using a separate OPAM switch is recommended.
For detailed technical documentation of this work, and current status of upstreaming the Mirage/Rumprun port, please see mirage/mirage#479.
If you are using an x86_64 machine to build: ensure that you are using a
32-bit OCaml compiler matching the version of ocaml-rumprun. opam switch 4.02.1+32bit should do the trick.
Add this repository to your OPAM installation:
opam repository add rumprun git://github.com/mato/opam-rumprun
On an x86_64 machine:
./build-rr.sh hw -- -F ACFLAGS=-m32 -F ACLFLAGS=-march=i686
Depending on your Linux distribution, you may need the gcc-multilib package installed.
On an x86 machine:
./build-rr.sh hw
Add the rumprun/bin directory added to your $PATH.
Install the ocaml-rumprun package, specifying a RUMPRUN_PLATFORM matching the rumprun toolchain you just built (look in the rumprun/bin directory):
RUMPRUN_PLATFORM=i486-rumprun-netbsdelf opam install ocaml-rumprun
Build a native "Hello, World!":
echo 'let () = print_endline "Hello, World!"' > hello.ml
ocamlfind -toolchain rumprun ocamlopt hello.ml -o hello
rumprun-bake hw_virtio hello.bin hello
Run it using (for example) KVM (root may be required):
rumprun kvm -i ./hello.bin
Rumprun provides a POSIX-like environment, so you can use the normal OCaml Unix module and pthreads. A simple example:
echo 'open Unix;; let () = print_endline (string_of_float (Unix.gettimeofday ()))' > unixtime.ml
ocamlfind -toolchain rumprun ocamlopt -package unix -linkpkg unixtime.ml -o unixtime
rumprun-bake hw_virtio unixtime.bin unixtime
Run it using (for example) KVM (root may be required):
rumprun kvm -i ./unixtime.bin
The following examples require that you install the MirageOS package.
Please note: The MirageOS package is currently on version 2.5.0+rumprun as
the rumprun-specific changes have not yet been upstreamed. You will need to pin
your installation of Mirage to this specific version. Using a separate OPAM
switch is recommended.
opam pin add mirage 2.5.0+rumprun
opam install mirage
(...)
∗ installed mirage.2.5.0+rumprun
Done.
Verify that version 2.5.0+rumprun is installed.
You will also need to clone the mirage-skeleton repository and check out the mirage-dev branch.
cd mirage-skeleton/consolemirage configure --target rumprunmake depend && makerumprun-bake hw_virtio mir-console.bin mir-consolerumprun kvm -i ./mir-console.bincd mirage-skeleton/stackv4NET=socket mirage configure --target rumprunmake depend && makerumprun-bake hw_virtio mir-stackv4.bin mir-stackv4rumprun kvm -i [network configuration...] ./mir-stackv4.binFor the KVM network configuration, something like this will give you a host-only tap0 network interface which can talk to the mirage unikernel:
-I 'qnet0,vioif,-net tap,ifname=tap0' -W qnet0,inet,static,172.20.0.10/24
The exact syntax depends on your QEMU version, networking setup and the phase of the moon. YMWV.
cd mirage-skeleton/static_websiteNET=socket mirage configure --target rumprunmake depend && makerumprun-bake hw_virtio mir-www.bin mir-wwwrumprun kvm -i [network configuration...] ./mir-www.binmirage-seal is a tool that seals the contents of a directory into a static unikernel, serving its contents over HTTP(S).
To use mirage-seal on rumprun:
Add an OPAM pin for the version with rumprun target support:
opam pin add mirage-seal git://github.com/mato/mirage-seal#rumprun
Put some HTML files in files/, and run:
mirage-seal -d files/ --no-tls --sockets -t rumprun
This will build ./mir-seal which you can rumpbake and rumprun as appropriate.
Currently the following MirageOS components are working on rumprun:
Work in progress:
Shell
100.0%