{"id":16164899,"url":"https://github.com/mato/opam-rumprun","last_synced_at":"2025-03-18T23:30:38.589Z","repository":{"id":32245347,"uuid":"35819626","full_name":"mato/opam-rumprun","owner":"mato","description":"OCaml 4.02 cross compiler for the rumprun unikernel stack","archived":false,"fork":false,"pushed_at":"2015-12-08T11:11:29.000Z","size":90,"stargazers_count":50,"open_issues_count":1,"forks_count":6,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-02-28T12:55:43.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-18T13:31:07.000Z","updated_at":"2019-08-18T16:44:51.000Z","dependencies_parsed_at":"2022-09-08T14:00:31.500Z","dependency_job_id":null,"html_url":"https://github.com/mato/opam-rumprun","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mato%2Fopam-rumprun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mato%2Fopam-rumprun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mato%2Fopam-rumprun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mato%2Fopam-rumprun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mato","download_url":"https://codeload.github.com/mato/opam-rumprun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244325087,"owners_count":20435035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T02:48:18.965Z","updated_at":"2025-03-18T23:30:38.208Z","avatar_url":"https://github.com/mato.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opam-rumprun\n\nThis OPAM repository contains:\n\n1. _ocaml-rumprun_, an OCaml 4.02 cross compiler for the\n   [rumprun](http://repo.rumpkernel.org/rumprun) unikernel stack.\n2. _mirage_, a [MirageOS](http://openmirage.org) package which supports rumprun\n   as a target.\n3. ~25 and counting packages with their build systems fixed to support\n   cross-compliation. These packages are required by MirageOS, but can of\n   course be used to build standalone OCaml applications running on top of\n   rumprun.\n\n*Experimental work in progress*, may eat your data or at least wreak havoc with\nyour OPAM instrallation! Using a separate OPAM switch is recommended.\n\nFor detailed technical documentation of this work, and current status of\nupstreaming the Mirage/Rumprun port, please see\n[mirage/mirage#479](https://github.com/mirage/mirage/issues/479).\n\n# Building the ocaml-rumprun cross compiler\n\n## Prerequisites\n\n* A Linux/x86 or Linux/x86\\_64 machine to build on.\n* QEMU (and optionally KVM) installed to run the built unikernels.\n* OCaml and [OPAM](https://opam.ocaml.org) installed.\n\n*If you are using an x86_64 machine* to build: ensure that you are using a\n32-bit OCaml compiler matching the version of `ocaml-rumprun`. `opam switch\n4.02.1+32bit` should do the trick.\n\nAdd this repository to your OPAM installation:\n````\n    opam repository add rumprun git://github.com/mato/opam-rumprun\n\n````\n\n## Build steps\n\n1. Build the [rumprun](http://repo.rumpkernel.org/rumprun) toolchain for the _hw_\nplatform:\n\n  *On an x86_64 machine*:\n\n  ````\n  ./build-rr.sh hw -- -F ACFLAGS=-m32 -F ACLFLAGS=-march=i686\n  ````\n\n  Depending on your Linux distribution, you may need the _gcc-multilib_ package\n  installed.\n\n  *On an x86 machine*:\n\n  ````\n  ./build-rr.sh hw\n  ````\n\n2. Add the `rumprun/bin` directory added to your `$PATH`.\n\n3. Install the `ocaml-rumprun` package, specifying a `RUMPRUN_PLATFORM` matching the rumprun toolchain you just built (look in the `rumprun/bin` directory):\n  \n  ````\n      RUMPRUN_PLATFORM=i486-rumprun-netbsdelf opam install ocaml-rumprun\n  ````\n\n# Example: Standalone OCaml\n\n## \"Hello, World\"\n\nBuild a native \"Hello, World!\":\n````\n    echo 'let () = print_endline \"Hello, World!\"' \u003e hello.ml\n    ocamlfind -toolchain rumprun ocamlopt hello.ml -o hello\n    rumprun-bake hw_virtio hello.bin hello\n````\n\nRun it using (for example) KVM (root may be required):\n````\n    rumprun kvm -i ./hello.bin\n````\n\n## Using the Unix module for POSIX calls\n\nRumprun provides a POSIX-like environment, so you can use the normal OCaml Unix\nmodule and pthreads. A simple example:\n\n````\n    echo 'open Unix;; let () = print_endline (string_of_float (Unix.gettimeofday ()))' \u003e unixtime.ml\n    ocamlfind -toolchain rumprun ocamlopt -package unix -linkpkg unixtime.ml -o unixtime\n    rumprun-bake hw_virtio unixtime.bin unixtime\n````\n\nRun it using (for example) KVM (root may be required):\n````\n    rumprun kvm -i ./unixtime.bin\n````\n\n# Example: MirageOS on bare metal\n\nThe following examples require that you install the MirageOS package.\n\n*Please note:* The MirageOS package is currently on version `2.5.0+rumprun` as\nthe rumprun-specific changes have not yet been upstreamed. You will need to pin\nyour installation of Mirage to this specific version. *Using a separate OPAM\nswitch is recommended.*\n\n\n````\n    opam pin add mirage 2.5.0+rumprun\n    opam install mirage\n    (...)\n    ∗  installed mirage.2.5.0+rumprun\n    Done.\n\n````\nVerify that version _2.5.0+rumprun_ is installed.\n\nYou will also need to clone the\n[mirage-skeleton](https://github.com/mirage/mirage-skeleton) repository and\ncheck out the _mirage-dev_ branch.\n\n## \"Hello, World\"\n\n1. `cd mirage-skeleton/console`\n2. `mirage configure --target rumprun`\n3. `make depend \u0026\u0026 make`\n4. `rumprun-bake hw_virtio mir-console.bin mir-console`\n5. `rumprun kvm -i ./mir-console.bin`\n\n## MirageOS network stack example\n\n1. `cd mirage-skeleton/stackv4`\n2. `NET=socket mirage configure --target rumprun`\n3. `make depend \u0026\u0026 make`\n4. `rumprun-bake hw_virtio mir-stackv4.bin mir-stackv4`\n5. `rumprun kvm -i [network configuration...] ./mir-stackv4.bin`\n\nFor the KVM network configuration, something like this will give you a\nhost-only tap0 network interface which can talk to the mirage unikernel:\n\n`-I 'qnet0,vioif,-net tap,ifname=tap0' -W qnet0,inet,static,172.20.0.10/24`\n\nThe exact syntax depends on your QEMU version, networking setup and the phase\nof the moon. YMWV.\n\n## MirageOS static website example\n\n1. `cd mirage-skeleton/static_website`\n2. `NET=socket mirage configure --target rumprun`\n3. `make depend \u0026\u0026 make`\n4. `rumprun-bake hw_virtio mir-www.bin mir-www`\n5. `rumprun kvm -i [network configuration...] ./mir-www.bin`\n\n# Example: mirage-seal\n\n[mirage-seal](https://github.com/mirage/mirage-seal) is a tool that seals the\ncontents of a directory into a static unikernel, serving its contents over\nHTTP(S).\n\nTo use mirage-seal on rumprun:\n\nAdd an OPAM pin for the version with rumprun target support:\n\n````\nopam pin add mirage-seal git://github.com/mato/mirage-seal#rumprun\n\n````\n\nPut some HTML files in `files/`, and run:\n````\nmirage-seal -d files/ --no-tls --sockets -t rumprun\n\n````\n\nThis will build `./mir-seal` which you can rumpbake and rumprun as appropriate.\n\n\n# MirageOS status on rumprun\n\nCurrently the following MirageOS components are working on rumprun:\n\n* Block\n* Clock (However rumprun on KVM/QEMU has no wall time at present)\n* Conduit\n* Console\n* STACKV4\\_socket (The socket-based network stack)\n\nWork in progress:\n\n* TLS (Builds and links, but not operational yet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmato%2Fopam-rumprun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmato%2Fopam-rumprun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmato%2Fopam-rumprun/lists"}