Browse Source

nixos-module: graphical and fs log

remotes/praha/master
Emery Hemingway 1 year ago
parent
commit
e203c4b57b
  1. 10
      nixos-modules/default.nix
  2. 1
      nixos-modules/dhall/console.dhall
  3. 58
      nixos-modules/dhall/fs-log.dhall
  4. 107
      nixos-modules/dhall/graphical-log.dhall
  5. 116
      nixos-modules/dhall/root.dhall
  6. 18
      nixos-modules/dhall/vbox-guest.dhall

10
nixos-modules/default.nix

@ -88,8 +88,11 @@
./dhall/root.dhall
} { fbDriver = ${fbDriverConfig}, guests = toMap { console = ${console} } # ${guestChildren}, inputFilterChargens = ${genodeConfig.inputFilter.extraChargen}, partitionType = ${
./dhall/partition-type
}, wm = ${./dhall/wm.dhall}
}'';
}, wm = ${./dhall/wm.dhall}, graphical-log = ${
./dhall/graphical-log.dhall
}, fs-log = ${
./dhall/fs-log.dhall
}, systemLabel = "${config.system.nixos.label}" }'';
buildBootDescription = self.legacyPackages.x86_64-linux.callPackage
./buildBootDescription.nix { lib = lib'; };
@ -103,6 +106,7 @@
"cached_fs_rom"
"chroot"
"decorator"
"fs_log"
"init"
"input_filter"
"ipxe_nic_drv"
@ -117,7 +121,7 @@
"posix"
"ps2_drv"
"report_rom"
"rom_logger"
"rom_to_file"
"rtc_drv"
"rump"
"stdcxx"

1
nixos-modules/dhall/console.dhall

@ -38,6 +38,7 @@ in λ(params : { bash : Text, coreutils : Text, path : Text })
, initial_height = "600"
}
}
, exitPropagate = True
, provides = [ "Framebuffer", "Input" ]
, resources = Resources::{ ram = Genode.units.MiB 8 }
}

58
nixos-modules/dhall/fs-log.dhall

@ -0,0 +1,58 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Init = Genode.Init
let Child = Init.Child
let ServiceRoute = Init.ServiceRoute
let routeLogRom =
λ(label : Text) → ServiceRoute.parentLabel "ROM" (Some "log") (Some label)
in Init::{
, verbose = True
, children = toMap
{ fs_log =
Child.flat
Child.Attributes::{
, binary = "fs_log"
, config = Init.Config::{
, defaultPolicy = Some Init.Config.DefaultPolicy::{
, attributes = toMap { merge = "yes", truncate = "yes" }
}
}
, exitPropagate = True
, provides = [ "LOG" ]
, routes = [ ServiceRoute.parent "File_system" ]
}
, log_core =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "core_log"
, ServiceRoute.childLabel
"LOG"
"fs_log"
(Some "log")
(Some "core")
]
}
, log_kernel =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "kernel_log"
, ServiceRoute.childLabel
"LOG"
"fs_log"
(Some "log")
(Some "kernel")
]
}
}
, routes = [ ServiceRoute.parent "Timer" ]
}

107
nixos-modules/dhall/graphical-log.dhall

@ -0,0 +1,107 @@
-- SPDX-License-Identifier: CC0-1.0
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 routeLogRom =
λ(label : Text) → ServiceRoute.parentLabel "ROM" (Some "log") (Some label)
in Init::{
, verbose = True
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
Init.ServiceRoute.parent
[ "Nitpicker", "Rtc", "Timer" ]
, children = toMap
{ nit_fb =
Child.flat
Child.Attributes::{
, binary = "nit_fb"
, config = Init.Config::{
, attributes = toMap
{ initial_width = "600", 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" "nit_fb"
, ServiceRoute.child "Input" "nit_fb"
, ServiceRoute.parent "File_system"
]
}
, terminal_log =
Child.flat
Child.Attributes::{
, binary = "terminal_log"
, provides = [ "LOG" ]
, routes = [ ServiceRoute.child "Terminal" "terminal" ]
}
, log_core =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "core_log"
, ServiceRoute.childLabel
"LOG"
"terminal_log"
(Some "log")
(Some "core")
]
}
, log_kernel =
Child.flat
Child.Attributes::{
, binary = "log_core"
, routes =
[ routeLogRom "kernel_log"
, ServiceRoute.childLabel
"LOG"
"terminal_log"
(Some "log")
(Some "kernel")
]
}
}
}

116
nixos-modules/dhall/root.dhall

@ -24,9 +24,6 @@ let label =
λ(label : Text)
→ { local = label, route = label } : Child.Attributes.Label
let routeLogRom =
λ(label : Text) → ServiceRoute.parentLabel "ROM" (Some "log") (Some label)
let rootInit =
λ ( params
: { fbDriver : Init.Child.Type
@ -34,6 +31,9 @@ let rootInit =
, inputFilterChargens : List XML.Type
, partitionType : Text
, wm : Init.Type
, graphical-log : Init.Type
, fs-log : Init.Type
, systemLabel : Text
}
)
→ Init::{
@ -404,89 +404,44 @@ let rootInit =
}
, routes = [ ServiceRoute.child "Block" "block_router" ]
}
, nit_fb =
Child.flat
Child.Attributes::{
, binary = "nit_fb"
, config = Init.Config::{
, attributes = toMap { initial_width = "600" }
}
, provides = [ "Framebuffer", "Input" ]
, resources = Resources::{ ram = Genode.units.MiB 8 }
, routes =
[ ServiceRoute.childLabel
"Nitpicker"
"wm"
(None Text)
(Some "log")
]
}
, 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
}
, graphical-log =
Init.toChild
params.graphical-log
Init.Attributes::{
, routes =
[ ServiceRoute.child "Framebuffer" "nit_fb"
, ServiceRoute.child "Input" "nit_fb"
[ ServiceRoute.child "Nitpicker" "wm"
, ServiceRoute.child "File_system" "fonts_fs"
]
}
, terminal_log =
Child.flat
Child.Attributes::{
, binary = "terminal_log"
, provides = [ "LOG" ]
, routes = [ ServiceRoute.child "Terminal" "terminal" ]
}
, log_core =
Child.flat
Child.Attributes::{
, binary = "log_core"
, fs-log =
Init.toChild
params.fs-log
Init.Attributes::{
, routes =
[ routeLogRom "core_log"
, ServiceRoute.childLabel
"LOG"
"terminal_log"
(Some "log")
(Some "core")
[ ServiceRoute.childLabel
"File_system"
"chroot"
(None Text)
(Some "dump")
]
}
, log_kernel =
, rom_to_file =
Child.flat
Child.Attributes::{
, binary = "log_core"
, binary = "rom_to_file"
, config = Init.Config::{
, attributes = toMap { rom = "init.config" }
}
, routes =
[ routeLogRom "kernel_log"
, ServiceRoute.childLabel
"LOG"
"terminal_log"
(Some "log")
(Some "kernel")
[ ServiceRoute.childLabel
"File_system"
"chroot"
(None Text)
(Some "dump")
, ServiceRoute.parentLabel
"ROM"
(Some "init.config")
(Some "config")
]
}
, block =
@ -616,7 +571,7 @@ let rootInit =
, Policy::{
, label = LabelSelector.prefix "chroot"
, attributes = toMap
{ root = "/ext2", writeable = "yes" }
{ root = "/ext2", writeable = "yes", path = "/" }
}
, Policy::{
, label = LabelSelector.prefix "init -> console"
@ -636,6 +591,13 @@ let rootInit =
Child.Attributes::{
, binary = "chroot"
, config = Init.Config::{
, policies =
[ Policy::{
, label = LabelSelector.label "dump"
, attributes = toMap
{ path = params.systemLabel, writeable = "yes" }
}
]
, defaultPolicy = Some DefaultPolicy::{
, attributes = toMap { writeable = "yes" }
}

18
nixos-modules/dhall/vbox-guest.dhall

@ -171,10 +171,6 @@ let toVbox =
let mutableVfs =
let fsNode =
[ XML.leaf
{ name = "ram"
, attributes = XML.emptyAttributes
}
, XML.leaf
{ name = "fs"
, attributes = toMap
{ label = "nix/store"
@ -184,7 +180,19 @@ let toVbox =
]
in merge
{ ISO = fsNode
{ ISO =
[ XML.leaf
{ name = "fs"
, attributes = toMap
{ writeable = "yes" }
}
, XML.element
{ name = "import"
, attributes = toMap
{ overwrite = "no" }
, content = fsNode
}
]
, VDI =
[ XML.leaf
{ name = "fs"

Loading…
Cancel
Save