From 9c23c59044d4829a0e2d7cf4904f208f1a4eb9bd Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 1 Feb 2021 15:36:29 +0100 Subject: [PATCH] nixos: rename store_fs to fs, cleanup The file-system containing the nix store also acts as the main file-system. --- nixos-modules/genode-core.nix | 42 ++++----- tests/test-wrapper.dhall | 168 ---------------------------------- 2 files changed, 20 insertions(+), 190 deletions(-) delete mode 100644 tests/test-wrapper.dhall diff --git a/nixos-modules/genode-core.nix b/nixos-modules/genode-core.nix index 2545adc..b76bd68 100644 --- a/nixos-modules/genode-core.nix +++ b/nixos-modules/genode-core.nix @@ -190,7 +190,7 @@ in { pkgs.genodePackages.part_block; genode.core.children = - # Component to steer the store_fs to a specific partition + # Component to steer the main fs to a specific partition (if config.genode.boot.storeBackend != "memory" then { part_block.configFile = builtins.toFile "part_block.dhall" '' let Genode = env:DHALL_GENODE @@ -206,7 +206,7 @@ in { , policies = [ Init.Config.Policy::{ , service = "Block" - , label = Init.LabelSelector.prefix "store_fs" + , label = Init.LabelSelector.prefix "fs" , attributes = toMap { partition = "${ toString config.fileSystems."/".block.partition @@ -221,20 +221,18 @@ in { ''; } else { }) // { - store_fs.configFile = let - - storeVfsConfig = - if config.genode.boot.storeBackend == "memory" then '' - VFS.vfs [ VFS.leafAttrs "tar" (toMap { name = "${config.system.build.tarball.fileName}.tar" }) ] - '' else - let - rumpExt2 = '' - VFS.vfs [ VFS.leafAttrs "rump" (toMap { fs = "ext2fs", ram="12M" }) ] - ''; - in { - ahci = rumpExt2; - usb = rumpExt2; - }.${config.fileSystems."/".block.driver}; + fs.configFile = let + vfsConfig = if config.genode.boot.storeBackend == "memory" then '' + VFS.vfs [ VFS.leafAttrs "tar" (toMap { name = "${config.system.build.tarball.fileName}.tar" }) ] + '' else + let + rumpExt2 = '' + VFS.vfs [ VFS.leafAttrs "rump" (toMap { fs = "ext2fs", ram="12M" }) ] + ''; + in { + ahci = rumpExt2; + usb = rumpExt2; + }.${config.fileSystems."/".block.driver}; storeResources = let rumpExt2 = @@ -254,7 +252,7 @@ in { '') (filterAttrs (_: child: child.fsPersistence) config.genode.init.children); - storePolicies = map (name: '' + fsPolicies = map (name: '' , Init.Config.Policy::{ , service = "File_system" , label = @@ -264,7 +262,7 @@ in { } '') (builtins.attrNames config.genode.init.children); - in builtins.toFile "store_fs.dhall" '' + in builtins.toFile "fs.dhall" '' let Genode = env:DHALL_GENODE let Init = Genode.Init @@ -275,8 +273,8 @@ in { toString persistencePolicies } ] : List Init.Config.Policy.Type - let storePolicies = [ ${ - toString storePolicies + let fsPolicies = [ ${ + toString fsPolicies } ] : List Init.Config.Policy.Type in Init.Child.flat @@ -285,14 +283,14 @@ in { , resources = ${storeResources} , provides = [ "File_system" ] , config = Init.Config::{ - , content = [ ${storeVfsConfig} ] + , content = [ ${vfsConfig} ] , policies = [ Init.Config.Policy::{ , service = "File_system" , label = Init.LabelSelector.prefix "store_rom" , attributes = toMap { root = "/" } } - ] # persistencePolicies # storePolicies + ] # persistencePolicies # fsPolicies } } ''; diff --git a/tests/test-wrapper.dhall b/tests/test-wrapper.dhall deleted file mode 100644 index f464f8c..0000000 --- a/tests/test-wrapper.dhall +++ /dev/null @@ -1,168 +0,0 @@ -let Test = ./test.dhall ? env:DHALL_GENODE_TEST - -let Genode = Test.Genode - -let Prelude = Genode.Prelude - -let XML = Prelude.XML - -let Init = Genode.Init - -let Child = Init.Child - -let TextMapType = Prelude.Map.Type Text - -let Children = TextMapType Child.Type - -let Manifest/Type = TextMapType (TextMapType Text) - -let Manifest/toRoutes = - λ(manifest : Manifest/Type) → - Prelude.List.map - (Prelude.Map.Entry Text Text) - Init.ServiceRoute.Type - ( λ(entry : Prelude.Map.Entry Text Text) → - { service = - { name = "ROM" - , label = Init.LabelSelector.Type.Last entry.mapKey - } - , route = - Init.Route.Type.Child - { name = "store_rom" - , label = Some entry.mapValue - , diag = None Bool - } - } - ) - ( Prelude.List.concat - (Prelude.Map.Entry Text Text) - (Prelude.Map.values Text (Prelude.Map.Type Text Text) manifest) - ) - -let parentROMs = - Prelude.List.map - Text - Init.ServiceRoute.Type - ( λ(label : Text) → - { service = - { name = "ROM", label = Init.LabelSelector.Type.Last label } - , route = - Init.Route.Type.Parent { label = Some label, diag = None Bool } - } - ) - -let wrapHarness - : Children → Manifest/Type → Child.Type - = λ(children : Children) → - λ(manifest : Manifest/Type) → - Child.nested - children - Child.Attributes::{ - , binary = "sotest-harness" - , exitPropagate = True - , resources = Init.Resources::{ ram = Genode.units.MiB 4 } - , routes = - [ Init.ServiceRoute.parentLabel - "LOG" - (Some "SOTEST") - (Some "unlabeled") - , Init.ServiceRoute.parent "IO_MEM" - , Init.ServiceRoute.parent "IO_PORT" - , Init.ServiceRoute.parent "IRQ" - , Init.ServiceRoute.parent "VM" - , Init.ServiceRoute.child "Timer" "timer" - , Init.ServiceRoute.child "Rtc" "rtc" - , Init.ServiceRoute.child "File_system" "store_fs" - ] - # parentROMs - [ "ld.lib.so" - , "init" - , "platform_info" - , "core_log" - , "kernel_log" - , "vfs" - , "libvfs.so" - , "cached_fs_rom" - ] - # Manifest/toRoutes manifest - } - -in λ(test : Test.Type) → - λ(storeSize : Natural) → - λ(storeManifest : Manifest/Type) → - λ(bootManifest : Manifest/Type) → - Genode.Boot::{ - , config = Init::{ - , children = - [ { mapKey = "timer" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "timer_drv" - , provides = [ "Timer" ] - } - } - , { mapKey = "rtc" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "rtc_drv" - , provides = [ "Rtc" ] - , routes = [ Init.ServiceRoute.parent "IO_PORT" ] - } - } - , { mapKey = "store_fs" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "vfs" - , config = Init.Config::{ - , content = - [ XML.element - { name = "vfs" - , attributes = XML.emptyAttributes - , content = - [ XML.leaf - { name = "tar" - , attributes = toMap { name = "store.tar" } - } - ] - } - ] - , defaultPolicy = Some Init.Config.DefaultPolicy::{ - , attributes = toMap { root = "/", writeable = "no" } - } - } - , provides = [ "File_system" ] - } - } - , { mapKey = "store_rom" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "cached_fs_rom" - , provides = [ "ROM" ] - , resources = Init.Resources::{ - , ram = storeSize + Genode.units.MiB 1 - } - , routes = - [ Init.ServiceRoute.child "File_system" "store_fs" ] - } - } - , { mapKey = "harness" - , mapValue = wrapHarness test.children storeManifest - } - ] - } - , rom = - test.rom - # Genode.BootModules.toRomPaths - ( Prelude.List.concat - (Prelude.Map.Entry Text Text) - ( Prelude.Map.values - Text - (Prelude.Map.Type Text Text) - bootManifest - ) - ) - }