如何将MirageOS示例部署到AWS

时间:2016-03-10 22:12:01

标签: mirage

注意:我认为这是一个悬而未决的问题:http://lists.xenproject.org/archives/html/mirageos-devel/2016-02/msg00076.htmlhttps://github.com/mirage/mirage-bootvar-xen/issues/17

我试图获得"你好"例如,在AWS中运行的海市蜃楼骨架。我正在使用" ec2.sh"来自海市蜃楼存储库的脚本,我在运行时遇到错误。

我配置,构建,然后部署和运行这样的示例:

> cd ../mirage-skeleton/hello/
> mirage configure --xen
> gmake
> ec2.sh -k mir-console.xen
> ec2-run-instances --region us-west-1 ami-dc96e5bc

在EC2控制台的系统日志中,在引导消息之后,我收到此错误:

Xen Minimal OS!
Initialising timer interface
Initialising console ... done.
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(PATH) -> null
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(TMPDIR) -> null
getenv(TEMP) -> null
Fatal error: exception Failure("Malformed boot parameter \"ro\"")
Raised at file "src/core/lwt.ml", line 789, characters 22-23
Called from file "lib/main.ml", line 58, characters 10-20
Called from file "main.ml", line 52, characters 5-10
Mirage exiting with status 2
Do_exit called!

这些是我安装的海市蜃楼库的版本:

mirage                         2.7.0  The MirageOS library operating system
mirage-bootvar-xen             0.3.1  Library for reading MirageOS unikernel boo
mirage-clock-xen                 1.1  A Mirage-compatible Clock library for Xen
mirage-conduit                 2.2.0  Virtual package for the MirageOS Conduit t
mirage-console                 2.1.3  A Mirage-compatible Console library for Xe
mirage-dns                     2.5.0  Virtual package for the MirageOS DNS trans
mirage-entropy-xen             0.3.0  MirageOS entropy device
mirage-http                    2.5.1  MirageOS HTTP client and server driver
mirage-net-xen                 1.5.0  Ethernet network device driver for MirageO
mirage-profile                 0.6.1  Collect profiling information
mirage-types                   2.6.0  Module type definitions for Mirage-compati
mirage-types-lwt               2.6.0  Lwt module type definitions for Mirage-com
mirage-vnetif                  0.1.0  Virtual network interface and software swi
mirage-xen                     2.3.3  MirageOS library for Xen
mirage-xen-minios              0.8.0  Xen MiniOS guest operating system library
mirage-xen-ocaml               2.3.4  MirageOS headers for the OCaml runtime
mirage-xen-posix               2.3.4  MirageOS library for posix headers

供参考,对于"你好"例如,config.ml文件是:

open Mirage

let key =
let doc = Key.Arg.info ~doc:"How to say hello." ["hello"] in
Key.(create "hello" Arg.(opt string "Hello World!" doc))

let main =
foreign
    ~keys:[Key.abstract key]
    "Unikernel.Main" (console @-> job)

let () =
register "console" [main $ default_console]

和unikernel.ml是

open Lwt

module Main (C: V1_LWT.CONSOLE) = struct

let start c =
    for_lwt i = 0 to 4 do
    C.log c (Key_gen.hello ()) ;
    lwt () = OS.Time.sleep 1.0 in
    return ()
    done

end

我在最新版本的MirageOS中读到了一些关于启动/内核参数的新功能。我需要在config.ml中更改一下来解决这个问题吗?

我应该补充一点,这个示例 在Xen中本地工作:

> sudo xl create -c console.xl
Xen Minimal OS!
Initialising timer interface
Initialising console ... done.
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(PATH) -> null
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(TMPDIR) -> null
getenv(TEMP) -> null
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Parsing config from console.xl

1 个答案:

答案 0 :(得分:0)

正如我所提到的,这似乎是一个悬而未决的问题。对我有用的是遵循页面底部的建议https://github.com/mirage/mirage/issues/493,这是将opam-bootvar-xen的分支命名为https://github.com/talex5/mirage-bootvar-xen/tree/qubes

我有一些问题只是试图克隆和检查qubes分支,所以我最终下载了zip并使用它。

> opam pin add mirage-bootvar-xen <location of unzipped repository>