202 lines
7.8 KiB
Plaintext
202 lines
7.8 KiB
Plaintext
let Genode = env:DHALL_GENODE
|
|
|
|
let Prelude = Genode.Prelude
|
|
|
|
let XML = Prelude.XML
|
|
|
|
let Init = Genode.Init
|
|
|
|
let Child = Init.Child
|
|
|
|
let Resources = Init.Resources
|
|
|
|
let ServiceRoute = Init.ServiceRoute
|
|
|
|
let Libc = Genode.Libc
|
|
|
|
let VFS = Genode.VFS
|
|
|
|
in λ(params : { bash : Text, coreutils : Text, path : Text }) →
|
|
let init =
|
|
Init::{
|
|
, verbose = True
|
|
, routes =
|
|
Prelude.List.map
|
|
Text
|
|
Init.ServiceRoute.Type
|
|
Init.ServiceRoute.parent
|
|
[ "Gui", "Rtc", "Timer" ]
|
|
, children = toMap
|
|
{ gui_fb =
|
|
Child.flat
|
|
Child.Attributes::{
|
|
, binary = "gui_fb"
|
|
, config = Init.Config::{
|
|
, attributes = toMap
|
|
{ xpos = "10"
|
|
, ypos = "10"
|
|
, initial_width = "800"
|
|
, initial_height = "600"
|
|
}
|
|
}
|
|
, exitPropagate = True
|
|
, provides = [ "Framebuffer", "Input" ]
|
|
, resources = Resources::{ ram = Genode.units.MiB 8 }
|
|
}
|
|
, terminal =
|
|
Child.flat
|
|
Child.Attributes::{
|
|
, binary = "terminal"
|
|
, config = Init.Config::{
|
|
, content =
|
|
[ XML.element
|
|
{ name = "vfs"
|
|
, attributes = XML.emptyAttributes
|
|
, content =
|
|
[ XML.element
|
|
{ name = "dir"
|
|
, attributes = toMap { name = "fonts" }
|
|
, content =
|
|
[ XML.leaf
|
|
{ name = "fs"
|
|
, attributes = toMap
|
|
{ label = "fonts" }
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
, provides = [ "Terminal" ]
|
|
, resources = Resources::{
|
|
, caps = 256
|
|
, ram = Genode.units.MiB 4
|
|
}
|
|
, routes =
|
|
[ ServiceRoute.child "Framebuffer" "gui_fb"
|
|
, ServiceRoute.child "Input" "gui_fb"
|
|
, ServiceRoute.parent "File_system"
|
|
]
|
|
}
|
|
, vfs =
|
|
Child.flat
|
|
Child.Attributes::{
|
|
, binary = "vfs"
|
|
, config = Init.Config::{
|
|
, content =
|
|
[ VFS.vfs
|
|
[ VFS.dir
|
|
"dev"
|
|
[ VFS.leaf "log"
|
|
, VFS.leaf "null"
|
|
, VFS.dir "pipe" [ VFS.leaf "pipe" ]
|
|
, VFS.leaf "rtc"
|
|
, VFS.leaf "terminal"
|
|
, VFS.leaf "zero"
|
|
]
|
|
, VFS.dir
|
|
"usr"
|
|
[ VFS.dir
|
|
"bin"
|
|
[ VFS.symlink
|
|
"${params.coreutils}/bin/env"
|
|
"env"
|
|
]
|
|
]
|
|
, VFS.dir "tmp" [ VFS.leaf "ram" ]
|
|
, VFS.dir
|
|
"nix"
|
|
[ VFS.dir
|
|
"store"
|
|
[ VFS.fs VFS.FS::{ label = "nix-store" } ]
|
|
]
|
|
]
|
|
]
|
|
, policies =
|
|
[ Init.Config.Policy::{
|
|
, service = "File_system"
|
|
, attributes = toMap
|
|
{ root = "/", writeable = "yes" }
|
|
}
|
|
]
|
|
}
|
|
, provides = [ "File_system" ]
|
|
, resources = Resources::{
|
|
, caps = 256
|
|
, ram = Genode.units.MiB 8
|
|
}
|
|
, routes =
|
|
[ Init.ServiceRoute.parent "File_system"
|
|
, Init.ServiceRoute.child "Terminal" "terminal"
|
|
]
|
|
}
|
|
, store_rom =
|
|
Child.flat
|
|
Child.Attributes::{
|
|
, binary = "cached_fs_rom"
|
|
, provides = [ "ROM" ]
|
|
, resources = Resources::{
|
|
, caps = 256
|
|
, ram = Genode.units.MiB 4
|
|
}
|
|
, routes = [ Init.ServiceRoute.child "File_system" "vfs" ]
|
|
}
|
|
, shell =
|
|
Child.flat
|
|
Child.Attributes::{
|
|
, binary = "bash"
|
|
, config =
|
|
Libc.toConfig
|
|
Libc::{
|
|
, stdin = Some "/dev/terminal"
|
|
, stdout = Some "/dev/terminal"
|
|
, stderr = Some "/dev/terminal"
|
|
, pipe = Some "/dev/pipe"
|
|
, rtc = Some "/dev/rtc"
|
|
, vfs = [ VFS.leaf "fs" ]
|
|
, env = toMap
|
|
{ TERM = "screen"
|
|
, PATH = "${params.path}"
|
|
, PS1 = "system:\$PWD"
|
|
}
|
|
, args = [ "bash" ]
|
|
}
|
|
, exitPropagate = True
|
|
, resources = Resources::{
|
|
, caps = 256
|
|
, ram = Genode.units.MiB 8
|
|
}
|
|
, routes =
|
|
[ Init.ServiceRoute.child "File_system" "vfs"
|
|
, { service =
|
|
{ name = "ROM"
|
|
, label =
|
|
Init.LabelSelector.Type.Partial
|
|
{ prefix = Some "/nix/store/"
|
|
, suffix = None Text
|
|
}
|
|
}
|
|
, route =
|
|
Init.Route.Type.Child
|
|
{ name = "store_rom"
|
|
, label = None Text
|
|
, diag = None Bool
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
in Init.toChild
|
|
init
|
|
Init.Attributes::{
|
|
, routes =
|
|
[ ServiceRoute.parent "File_system"
|
|
, ServiceRoute.parent "Gui"
|
|
, ServiceRoute.parent "Rtc"
|
|
, ServiceRoute.parent "Timer"
|
|
]
|
|
}
|