nixos: add graphical log
This commit is contained in:
parent
02d744c76a
commit
888d808032
|
@ -0,0 +1,162 @@
|
||||||
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
|
let Prelude = Genode.Prelude
|
||||||
|
|
||||||
|
let VFS = Genode.VFS
|
||||||
|
|
||||||
|
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 λ(params : { fontFile : Text }) →
|
||||||
|
Init.toChild
|
||||||
|
Init::{
|
||||||
|
, verbose = True
|
||||||
|
, routes =
|
||||||
|
[ Init.ServiceRoute.parent "Gui", Init.ServiceRoute.parent "Timer" ]
|
||||||
|
, children = toMap
|
||||||
|
{ gui_fb =
|
||||||
|
Child.flat
|
||||||
|
Child.Attributes::{
|
||||||
|
, binary = "gui_fb"
|
||||||
|
, exitPropagate = True
|
||||||
|
, resources = Resources::{ ram = Genode.units.MiB 8 }
|
||||||
|
, config = Init.Config::{
|
||||||
|
, attributes = toMap
|
||||||
|
{ origin = "top_right"
|
||||||
|
, xpos = "0"
|
||||||
|
, ypos = "0"
|
||||||
|
, initial_width = "1024"
|
||||||
|
, initial_height = "768"
|
||||||
|
}
|
||||||
|
, policies =
|
||||||
|
[ Init.Config.Policy::{
|
||||||
|
, service = "Framebuffer"
|
||||||
|
, label = Init.LabelSelector.prefix "terminal"
|
||||||
|
}
|
||||||
|
, Init.Config.Policy::{
|
||||||
|
, service = "Input"
|
||||||
|
, label = Init.LabelSelector.prefix "terminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, terminal =
|
||||||
|
Child.flat
|
||||||
|
Child.Attributes::{
|
||||||
|
, binary = "terminal"
|
||||||
|
, exitPropagate = True
|
||||||
|
, resources = Resources::{
|
||||||
|
, caps = 256
|
||||||
|
, ram = Genode.units.MiB 4
|
||||||
|
}
|
||||||
|
, routes =
|
||||||
|
[ ServiceRoute.child "Framebuffer" "gui_fb"
|
||||||
|
, ServiceRoute.child "Input" "gui_fb"
|
||||||
|
, ServiceRoute.parent "File_system"
|
||||||
|
]
|
||||||
|
, config = Init.Config::{
|
||||||
|
, content =
|
||||||
|
[ XML.element
|
||||||
|
{ name = "palette"
|
||||||
|
, attributes = toMap
|
||||||
|
{ uri = "https://pippin.gimp.org/ametameric/" }
|
||||||
|
, content =
|
||||||
|
let color =
|
||||||
|
λ(index : Natural) →
|
||||||
|
λ(value : Text) →
|
||||||
|
XML.leaf
|
||||||
|
{ name = "color"
|
||||||
|
, attributes = toMap
|
||||||
|
{ index = Natural/show index
|
||||||
|
, value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
in [ color 0 "#000000"
|
||||||
|
, color 1 "#a02929"
|
||||||
|
, color 2 "#4aa08b"
|
||||||
|
, color 3 "#878453"
|
||||||
|
, color 4 "#2424ed"
|
||||||
|
, color 5 "#ab4adf"
|
||||||
|
, color 6 "#3b6bb1"
|
||||||
|
, color 7 "#c3c3c3"
|
||||||
|
, color 8 "#6f6f6f"
|
||||||
|
, color 9 "#edac82"
|
||||||
|
, color 10 "#99edba"
|
||||||
|
, color 11 "#e9d808"
|
||||||
|
, color 12 "#82b4ed"
|
||||||
|
, color 13 "#d66fed"
|
||||||
|
, color 14 "#1de1ed"
|
||||||
|
, color 15 "#ffffff"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
, VFS.vfs
|
||||||
|
[ VFS.leafAttrs
|
||||||
|
"rom"
|
||||||
|
(toMap { name = params.fontFile })
|
||||||
|
, VFS.dir
|
||||||
|
"fonts"
|
||||||
|
[ VFS.dir
|
||||||
|
"monospace"
|
||||||
|
[ VFS.leafAttrs
|
||||||
|
"ttf"
|
||||||
|
( toMap
|
||||||
|
{ name = "regular"
|
||||||
|
, path = params.fontFile
|
||||||
|
, size_px = "10"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
, policies =
|
||||||
|
[ Init.Config.Policy::{
|
||||||
|
, service = "Terminal"
|
||||||
|
, label = Init.LabelSelector.prefix "terminal_log"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, terminal_log =
|
||||||
|
Child.flat
|
||||||
|
Child.Attributes::{
|
||||||
|
, binary = "terminal_log"
|
||||||
|
, config = Init.Config::{
|
||||||
|
, policies =
|
||||||
|
[ Init.Config.Policy::{
|
||||||
|
, service = "LOG"
|
||||||
|
, label = Init.LabelSelector.prefix "core"
|
||||||
|
}
|
||||||
|
, Init.Config.Policy::{
|
||||||
|
, service = "LOG"
|
||||||
|
, label = Init.LabelSelector.prefix "kernel"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, core =
|
||||||
|
Child.flat
|
||||||
|
Child.Attributes::{
|
||||||
|
, binary = "log_core"
|
||||||
|
, routes = [ routeLogRom "core_log" ]
|
||||||
|
}
|
||||||
|
, kernel =
|
||||||
|
Child.flat
|
||||||
|
Child.Attributes::{
|
||||||
|
, binary = "log_core"
|
||||||
|
, routes = [ routeLogRom "kernel_log" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Init.Attributes.default
|
|
@ -0,0 +1,56 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let cfg = config.genode.gui;
|
||||||
|
in {
|
||||||
|
options.genode.gui = {
|
||||||
|
enable = mkEnableOption "Genode Gui service";
|
||||||
|
consoleLog = { enable = mkEnableOption "console log"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
genode.gui.enable = cfg.consoleLog.enable;
|
||||||
|
|
||||||
|
hardware.genode.framebuffer.enable = cfg.enable;
|
||||||
|
|
||||||
|
genode.core.children.nitpicker = mkIf cfg.enable {
|
||||||
|
inputs = [ pkgs.genodePackages.nitpicker ];
|
||||||
|
configFile = pkgs.writeText "nitpicker.dhall" ''
|
||||||
|
let Init = (env:DHALL_GENODE).Init
|
||||||
|
|
||||||
|
in ${./nitpicker.dhall}
|
||||||
|
{ policies =
|
||||||
|
[ Init.Config.Policy::{
|
||||||
|
, service = "Gui"
|
||||||
|
, label = Init.LabelSelector.prefix "consoleLog"
|
||||||
|
, attributes = toMap { domain = "default" }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
genode.boot.romModules = mkIf cfg.consoleLog.enable {
|
||||||
|
"TerminusTTF.ttf" = pkgs.buildPackages.terminus_font_ttf
|
||||||
|
+ "/share/fonts/truetype/TerminusTTF.ttf";
|
||||||
|
};
|
||||||
|
|
||||||
|
genode.core.children.consoleLog = mkIf cfg.consoleLog.enable {
|
||||||
|
inputs = with pkgs.genodePackages; [
|
||||||
|
gui_fb
|
||||||
|
log_core
|
||||||
|
libc
|
||||||
|
terminal
|
||||||
|
terminal_log
|
||||||
|
vfs_ttf
|
||||||
|
];
|
||||||
|
coreROMs = [ "core_log" "kernel_log" ];
|
||||||
|
configFile = pkgs.writeText "consoleLog.dhall" ''
|
||||||
|
${./consoleLog.dhall} { fontFile = "TerminusTTF.ttf" }
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
|
let XML = Genode.Prelude.XML
|
||||||
|
|
||||||
|
let Init = Genode.Init
|
||||||
|
|
||||||
|
in λ(params : { policies : List Init.Config.Policy.Type }) →
|
||||||
|
Init.Child.flat
|
||||||
|
Init.Child.Attributes::{
|
||||||
|
, binary = "nitpicker"
|
||||||
|
, resources = Init.Resources::{ ram = Genode.units.MiB 4 }
|
||||||
|
, config = Init.Config::{
|
||||||
|
, attributes = toMap
|
||||||
|
{ note = "Nitpicker config is extremely fragile!" }
|
||||||
|
, content =
|
||||||
|
[ XML.leaf { name = "capture", attributes = XML.emptyAttributes }
|
||||||
|
, XML.leaf
|
||||||
|
{ name = "domain"
|
||||||
|
, attributes = toMap
|
||||||
|
{ name = "default"
|
||||||
|
, layer = "1"
|
||||||
|
, content = "client"
|
||||||
|
, label = "no"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, XML.leaf
|
||||||
|
{ name = "background"
|
||||||
|
, attributes = toMap { color = "#000000" }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
, policies =
|
||||||
|
params.policies
|
||||||
|
# [ Init.Config.Policy::{
|
||||||
|
, service = "Capture"
|
||||||
|
, label = Init.LabelSelector.prefix "fb_drv"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
, defaultPolicy = Some Init.Config.DefaultPolicy::{
|
||||||
|
, attributes = toMap { domain = "default" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./nic.nix ./usb.nix ];
|
imports = [ ./framebuffer.nix ./nic.nix ./usb.nix ];
|
||||||
|
|
||||||
options.hardware.genode.platform.policies = lib.mkOption {
|
options.hardware.genode.platform.policies = lib.mkOption {
|
||||||
type = with types; listOf path;
|
type = with types; listOf path;
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
options.hardware.genode.framebuffer = {
|
||||||
|
enable = lib.mkEnableOption "framebuffer driver";
|
||||||
|
driver = mkOption {
|
||||||
|
type = types.enum [ "boot" "vesa" ];
|
||||||
|
default = "vesa";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
genode.core.children.fb_drv =
|
||||||
|
mkIf config.hardware.genode.framebuffer.enable {
|
||||||
|
inputs = with pkgs.genodePackages;
|
||||||
|
{
|
||||||
|
"boot" = [ boot_fb_drv ];
|
||||||
|
"vesa" = [ vesa_drv ];
|
||||||
|
}.${config.hardware.genode.framebuffer.driver};
|
||||||
|
configFile = let
|
||||||
|
binary = with pkgs.genodePackages;
|
||||||
|
{
|
||||||
|
"boot" = "boot_fb_drv";
|
||||||
|
"vesa" = "vesa_fb_drv";
|
||||||
|
}.${config.hardware.genode.framebuffer.driver};
|
||||||
|
in builtins.toFile "fb_drv.dhall" ''
|
||||||
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
|
let XML = Genode.Prelude.XML
|
||||||
|
|
||||||
|
let Init = Genode.Init
|
||||||
|
|
||||||
|
in Init.Child.flat
|
||||||
|
Init.Child.Attributes::{
|
||||||
|
, binary = "${binary}"
|
||||||
|
, resources = Init.Resources::{ caps = 256, ram = Genode.units.MiB 32 }
|
||||||
|
, routes =
|
||||||
|
[ Init.ServiceRoute.parent "IO_MEM"
|
||||||
|
, Init.ServiceRoute.parent "IO_PORT"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue