nixos: add genode.init.coreROMs option
Explicitly specify ROMs that must route past the nix-store.
This commit is contained in:
parent
cd5f6f84f8
commit
f8df320507
|
@ -90,11 +90,15 @@ in {
|
||||||
in (foldl' f "[" inputs) + "]";
|
in (foldl' f "[" inputs) + "]";
|
||||||
};
|
};
|
||||||
|
|
||||||
romDirectories = mapAttrs (name: value:
|
romDirectories = filterAttrs (_: value: value != null) (mapAttrs
|
||||||
pkgs.symlinkJoin {
|
(name: value:
|
||||||
name = "${name}-rom";
|
if value.inputs == [ ] then
|
||||||
paths = value.inputs;
|
null
|
||||||
}) config.genode.init.children;
|
else
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "${name}-rom";
|
||||||
|
paths = value.inputs;
|
||||||
|
}) config.genode.init.children);
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
@ -115,18 +119,33 @@ in {
|
||||||
report_rom
|
report_rom
|
||||||
vfs
|
vfs
|
||||||
])));
|
])));
|
||||||
storeRomPolicies = let
|
|
||||||
policies = mapAttrsToList
|
storeRomPolicies = mapAttrsToList
|
||||||
(name: value: '', { mapKey = "${name}", mapValue = "${value}" }'')
|
(name: value: '', { mapKey = "${name}", mapValue = "${value}" }'')
|
||||||
romDirectories;
|
romDirectories;
|
||||||
in "[${toString policies}]";
|
|
||||||
|
extraRoutes = lib.concatStringsSep ", " (lib.lists.flatten
|
||||||
|
(lib.mapAttrsToList (name: value:
|
||||||
|
map (suffix: ''
|
||||||
|
{ service =
|
||||||
|
{ name = "ROM"
|
||||||
|
, label =
|
||||||
|
Genode.Init.LabelSelector.Type.Partial
|
||||||
|
{ prefix = Some "nixos -> ${name}", suffix = Some "${suffix}" }
|
||||||
|
}
|
||||||
|
, route = Genode.Init.Route.parent (Some "${suffix}")
|
||||||
|
}
|
||||||
|
'') value.coreROMs) config.genode.init.children));
|
||||||
|
|
||||||
in localPackages.runCommand "boot.dhall" { } ''
|
in localPackages.runCommand "boot.dhall" { } ''
|
||||||
cat > $out << EOF
|
cat > $out << EOF
|
||||||
|
let Genode = env:DHALL_GENODE in
|
||||||
${./store-wrapper.dhall}
|
${./store-wrapper.dhall}
|
||||||
(${config.genode.init.configFile})
|
(${config.genode.init.configFile})
|
||||||
"${config.system.build.tarball.fileName}.tar"
|
"${config.system.build.tarball.fileName}.tar"
|
||||||
$(stat --format '%s' ${tarball})
|
$(stat --format '%s' ${tarball})
|
||||||
${storeRomPolicies}
|
([${toString storeRomPolicies} ] : Genode.Prelude.Map.Type Text Text)
|
||||||
|
([${extraRoutes} ] : List Genode.Init.ServiceRoute.Type)
|
||||||
${manifest}
|
${manifest}
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -4,6 +4,15 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.genode.init;
|
cfg = config.genode.init;
|
||||||
|
coreROMs = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
|
List of label suffixes that when matched against
|
||||||
|
ROM requests shall be forwared to the core.
|
||||||
|
'';
|
||||||
|
example = [ "platform_info" ];
|
||||||
|
};
|
||||||
inputs = mkOption {
|
inputs = mkOption {
|
||||||
description = "List of packages to build a ROM store with.";
|
description = "List of packages to build a ROM store with.";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
@ -47,7 +56,7 @@ in {
|
||||||
type = with types;
|
type = with types;
|
||||||
attrsOf (submodule {
|
attrsOf (submodule {
|
||||||
options = {
|
options = {
|
||||||
inherit inputs;
|
inherit coreROMs inputs;
|
||||||
configFile = mkOption {
|
configFile = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -67,7 +76,7 @@ in {
|
||||||
type = with types;
|
type = with types;
|
||||||
attrsOf (submodule {
|
attrsOf (submodule {
|
||||||
options = {
|
options = {
|
||||||
inherit inputs;
|
inherit coreROMs inputs;
|
||||||
configFile = mkOption {
|
configFile = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
description = ''
|
description = ''
|
||||||
|
|
|
@ -16,9 +16,11 @@ in λ(subinit : Init.Type) →
|
||||||
λ(storeName : Text) →
|
λ(storeName : Text) →
|
||||||
λ(storeSize : Natural) →
|
λ(storeSize : Natural) →
|
||||||
λ(storeRomPolicies : Prelude.Map.Type Text Text) →
|
λ(storeRomPolicies : Prelude.Map.Type Text Text) →
|
||||||
|
λ(routes : List Init.ServiceRoute.Type) →
|
||||||
λ(bootManifest : Manifest/Type) →
|
λ(bootManifest : Manifest/Type) →
|
||||||
Genode.Boot::{
|
Genode.Boot::{
|
||||||
, config = Init::{
|
, config = Init::{
|
||||||
|
, routes
|
||||||
, children =
|
, children =
|
||||||
let child = Prelude.Map.keyValue Child.Type
|
let child = Prelude.Map.keyValue Child.Type
|
||||||
|
|
||||||
|
@ -164,13 +166,7 @@ in λ(subinit : Init.Type) →
|
||||||
)
|
)
|
||||||
|
|
||||||
in parentROMs
|
in parentROMs
|
||||||
[ "ld.lib.so"
|
[ "ld.lib.so", "vfs.lib.so", "init" ]
|
||||||
, "vfs.lib.so"
|
|
||||||
, "init"
|
|
||||||
, "platform_info"
|
|
||||||
, "core_log"
|
|
||||||
, "kernel_log"
|
|
||||||
]
|
|
||||||
# [ Init.ServiceRoute.parent "IO_MEM"
|
# [ Init.ServiceRoute.parent "IO_MEM"
|
||||||
, Init.ServiceRoute.parent "IO_PORT"
|
, Init.ServiceRoute.parent "IO_PORT"
|
||||||
, Init.ServiceRoute.parent "IRQ"
|
, Init.ServiceRoute.parent "IRQ"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
machine = { pkgs, ... }: {
|
machine = { pkgs, ... }: {
|
||||||
genode.init.subinits.test = {
|
genode.init.subinits.test = {
|
||||||
configFile = ./x86.dhall;
|
configFile = ./x86.dhall;
|
||||||
|
coreROMs = [ "platform_info" ];
|
||||||
inputs = with pkgs.genodePackages; [
|
inputs = with pkgs.genodePackages; [
|
||||||
acpi_drv
|
acpi_drv
|
||||||
platform_drv
|
platform_drv
|
||||||
|
|
Loading…
Reference in New Issue