2
0
Fork 0
genodepkgs/tests/posix.dhall

142 lines
5.6 KiB
Plaintext

let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let VFS = Genode.VFS
let Init = Genode.Init
let Child = Init.Child
in λ(params : { bash : Text, coreutils : Text, script : Text }) →
let init =
Init::{
, verbose = True
, routes =
[ Init.ServiceRoute.parent "Timer"
, Init.ServiceRoute.parent "Rtc"
]
, children = toMap
{ vfs =
Child.flat
Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ VFS.vfs
[ VFS.dir
"dev"
[ VFS.dir "pipes" [ VFS.leaf "pipe" ]
, VFS.leaf "log"
, VFS.leaf "null"
, VFS.leaf "rtc"
, VFS.leaf "zero"
]
, VFS.dir
"usr"
[ VFS.dir
"bin"
[ VFS.symlink
"env"
"${params.coreutils}/bin/env"
]
]
, VFS.dir "ram" [ VFS.leaf "ram" ]
, VFS.dir
"nix"
[ VFS.dir
"store"
[ VFS.fs VFS.FS::{ label = "nix-store" } ]
]
]
]
, policies =
[ Init.Config.Policy::{
, service = "File_system"
, label =
Init.LabelSelector.Type.Partial
{ prefix = Some "shell", suffix = None Text }
, attributes = toMap
{ root = "/", writeable = "yes" }
}
, Init.Config.Policy::{
, service = "File_system"
, label = Init.LabelSelector.prefix "vfs_rom"
, attributes = toMap { root = "/" }
}
]
}
, provides = [ "File_system" ]
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
Init.ServiceRoute.parent
[ "File_system", "Rtc" ]
}
, vfs_rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, provides = [ "ROM" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 4
}
, config = Init.Config::{
, policies =
[ Init.Config.Policy::{
, service = "ROM"
, diag = Some True
, label = Init.LabelSelector.prefix "shell"
}
]
}
}
, shell =
Child.flat
Child.Attributes::{
, binary = "bash"
, config = Genode.Init.Config::{
, attributes = toMap { ld_verbose = "true" }
, content =
[ Prelude.XML.text
''
<libc stdin="/dev/null" stdout="/dev/stdout" stderr="/dev/stderr" pipe="/dev/pipe" rtc="/dev/rtc"/>
<vfs> <fs/> </vfs>
''
]
# Prelude.List.map
Text
XML.Type
( λ(x : Text) →
XML.leaf
{ name = "arg"
, attributes = toMap { value = x }
}
)
[ "bash", params.script ]
}
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, routes =
[ Init.ServiceRoute.parentLabel
"ROM"
(Some "vfs.lib.so")
(Some "vfs.lib.so")
]
}
}
}
in Init.toChild init Init.Attributes::{=}