Add block_router package
This commit is contained in:
parent
918c74a111
commit
6558f3c232
|
@ -85,6 +85,20 @@ in rec {
|
|||
|
||||
bender = legacyPackages.buildPackages.callPackage ./bender { };
|
||||
|
||||
block_router = let
|
||||
src = legacyPackages.fetchgit {
|
||||
url = "https://git.sr.ht/~ehmry/block_router";
|
||||
rev = "dd78a4824bbc28c5760fda55e9d5dd23cbee8ecf";
|
||||
sha256 = "1444nfgbgqggmyhjh81aac3mwixh7h6m1qmk8ikinf8gnl9mbngx";
|
||||
};
|
||||
in buildUpstream {
|
||||
name = "block_router";
|
||||
targets = [ "block_router" ];
|
||||
postConfigure = ''
|
||||
echo REPOSITORIES += ${src} >> $BUILD_DIR/etc/build.conf
|
||||
'';
|
||||
};
|
||||
|
||||
dhallGenode = dhallPackages.genode;
|
||||
|
||||
NOVA = legacyPackages.callPackage ./NOVA { };
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
-- 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
|
||||
|
||||
in Genode.Boot::{
|
||||
, config = Init::{
|
||||
, verbose = True
|
||||
, children =
|
||||
let blockTest =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "test-block-client"
|
||||
, resources = Resources::{ ram = Genode.units.MiB 5 }
|
||||
, routes =
|
||||
[ ServiceRoute.parent "Timer"
|
||||
, ServiceRoute.child "Block" "block_router"
|
||||
]
|
||||
}
|
||||
|
||||
in toMap
|
||||
{ block_device =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "ram_block"
|
||||
, config = Init.Config::{
|
||||
, attributes = toMap
|
||||
{ file = "gpt.rom", block_size = "512" }
|
||||
}
|
||||
, provides = [ "Block" ]
|
||||
, resources = Resources::{ ram = Genode.units.MiB 8 }
|
||||
}
|
||||
, part_block =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "part_block"
|
||||
, config = Init.Config::{
|
||||
, attributes = toMap { use_gpt = "yes" }
|
||||
, content =
|
||||
Prelude.List.map
|
||||
Natural
|
||||
XML.Type
|
||||
( λ(i : Natural)
|
||||
→ XML.leaf
|
||||
{ name = "policy"
|
||||
, attributes =
|
||||
let partition =
|
||||
Prelude.Natural.show (i + 1)
|
||||
|
||||
in toMap
|
||||
{ label_suffix = " ${partition}"
|
||||
, partition = partition
|
||||
, writeable = "yes"
|
||||
}
|
||||
}
|
||||
)
|
||||
(Prelude.Natural.enumerate 128)
|
||||
# [ XML.leaf
|
||||
{ name = "report"
|
||||
, attributes = toMap { partitions = "yes" }
|
||||
}
|
||||
]
|
||||
}
|
||||
, resources = Resources::{ ram = Genode.units.MiB 10 }
|
||||
, provides = [ "Block" ]
|
||||
, routes =
|
||||
[ ServiceRoute.child "Block" "block_device"
|
||||
, ServiceRoute.child "Report" "block_router"
|
||||
]
|
||||
}
|
||||
, block_router =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "block_router"
|
||||
, config = Init.Config::{
|
||||
, content =
|
||||
[ XML.element
|
||||
{ name = "policy"
|
||||
, attributes = toMap
|
||||
{ label_prefix = "test-part1" }
|
||||
, content =
|
||||
[ XML.leaf
|
||||
{ name = "partition"
|
||||
, attributes = toMap
|
||||
{ name = "best partition ever" }
|
||||
}
|
||||
, XML.leaf
|
||||
{ name = "partition"
|
||||
, attributes = toMap
|
||||
{ name = "first-test-partition"
|
||||
, timeout = "2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
, XML.element
|
||||
{ name = "policy"
|
||||
, attributes = toMap
|
||||
{ label_prefix = "test-part2" }
|
||||
, content =
|
||||
[ XML.leaf
|
||||
{ name = "partition"
|
||||
, attributes = toMap
|
||||
{ name = "second-test-partition" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, resources = Resources::{ ram = Genode.units.MiB 10 }
|
||||
, provides = [ "Block", "Report" ]
|
||||
, routes =
|
||||
[ ServiceRoute.parent "Timer"
|
||||
, ServiceRoute.child "Block" "part_block"
|
||||
]
|
||||
}
|
||||
, test-part1 = blockTest
|
||||
, test-part2 = blockTest
|
||||
}
|
||||
}
|
||||
, rom =
|
||||
Genode.BootModules.toRomPaths
|
||||
[ { mapKey = "gpt.rom", mapValue = "./gpt.raw" } ]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
{ testEnv, pkgs, hostPkgs, ... }:
|
||||
with pkgs;
|
||||
|
||||
testEnv.mkTest {
|
||||
name = "block_router";
|
||||
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
|
||||
|
||||
testConfig = ./block_router.dhall;
|
||||
testInputs = map pkgs.genodeSources.make [
|
||||
"server/part_block"
|
||||
"server/ram_block"
|
||||
"test/block/client"
|
||||
] ++ [ pkgs.block_router ];
|
||||
testScript = ''
|
||||
catch { exec dd if=/dev/zero of=gpt.raw bs=512 count=7168 }
|
||||
exec ${hostPkgs.gptfdisk}/bin/sgdisk -o -n 3:2048:4095 -c 3:first-test-partition -n 31:4096:6143 -c 31:second-test-partition gpt.raw
|
||||
|
||||
run_genode_until {Tests finished successfully.*\n.*Tests finished successfully.*\n} 120
|
||||
'';
|
||||
}
|
|
@ -15,9 +15,11 @@ let
|
|||
depot = genode-depot.packages.${system};
|
||||
testPkgs = genodepkgs;
|
||||
|
||||
linux = tests (import ./driver-linux.nix {
|
||||
inherit apps testPkgs hostPkgs lib depot;
|
||||
}).callTest;
|
||||
linux =
|
||||
(call: ((tests call) // { block_router = call ./block_router.nix { }; }))
|
||||
(import ./driver-linux.nix {
|
||||
inherit apps testPkgs hostPkgs lib depot;
|
||||
}).callTest;
|
||||
|
||||
nova = (call:
|
||||
((tests call) // {
|
||||
|
|
|
@ -121,6 +121,6 @@ in {
|
|||
isNova = false;
|
||||
};
|
||||
pkgs = testPkgs;
|
||||
inherit depot;
|
||||
inherit depot hostPkgs;
|
||||
} // args));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue