2
0
Fork 0

nixos-module: graphical and fs log

This commit is contained in:
Ehmry - 2020-06-10 15:22:00 +05:30
parent 78cf596db3
commit e203c4b57b
6 changed files with 225 additions and 85 deletions

View File

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

View File

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

View File

@ -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" ]
}

View File

@ -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")
]
}
}
}

View File

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

View File

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