Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

posix.dhall 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. let Test = ./test.dhall ? env:DHALL_GENODE_TEST
  2. let Genode = Test.Genode
  3. let Prelude = Genode.Prelude
  4. let XML = Prelude.XML
  5. let Init = Genode.Init
  6. let Child = Init.Child
  7. in λ(params : { bash : Text, coreutils : Text, script : Text }) →
  8. let init =
  9. Init::{
  10. , verbose = True
  11. , routes =
  12. [ Init.ServiceRoute.parent "Timer"
  13. , Init.ServiceRoute.parent "Rtc"
  14. ]
  15. , children = toMap
  16. { vfs =
  17. Child.flat
  18. Child.Attributes::{
  19. , binary = "vfs"
  20. , config = Init.Config::{
  21. , content =
  22. [ Prelude.XML.text
  23. ''
  24. <vfs>
  25. <dir name="dev"> <log name="stdout" label="stdout"/> <log name="stderr" label="stderr"/> <null/> <pipe/> <rtc/> <zero/> </dir>
  26. <dir name="usr"><dir name="bin"><symlink name="env" target="${params.coreutils}/bin/env"/></dir></dir>
  27. <dir name="tmp"><ram/></dir>
  28. <dir name="nix"><fs label="nix" root="nix"/></dir>
  29. </vfs>
  30. ''
  31. ]
  32. , defaultPolicy = Some Init.Config.DefaultPolicy::{
  33. , attributes = toMap { root = "/", writeable = "yes" }
  34. }
  35. }
  36. , provides = [ "File_system" ]
  37. , resources = Genode.Init.Resources::{
  38. , caps = 256
  39. , ram = Genode.units.MiB 8
  40. }
  41. , routes =
  42. Prelude.List.map
  43. Text
  44. Init.ServiceRoute.Type
  45. Init.ServiceRoute.parent
  46. [ "File_system", "Rtc" ]
  47. }
  48. , store_rom =
  49. Child.flat
  50. Child.Attributes::{
  51. , binary = "cached_fs_rom"
  52. , provides = [ "ROM" ]
  53. , resources = Init.Resources::{
  54. , caps = 256
  55. , ram = Genode.units.MiB 4
  56. }
  57. , routes =
  58. [ Init.ServiceRoute.parentLabel
  59. "File_system"
  60. (None Text)
  61. (Some "nix")
  62. ]
  63. }
  64. , shell =
  65. Child.flat
  66. Child.Attributes::{
  67. , binary = "bash"
  68. , config = Genode.Init.Config::{
  69. , content =
  70. [ Prelude.XML.text
  71. ''
  72. <libc stdin="/dev/null" stdout="/dev/stdout" stderr="/dev/stderr" pipe="/dev/pipe" rtc="/dev/rtc"/>
  73. <vfs> <fs/> </vfs>
  74. ''
  75. ]
  76. # Prelude.List.map
  77. Text
  78. XML.Type
  79. ( λ(x : Text) →
  80. XML.leaf
  81. { name = "arg"
  82. , attributes = toMap { value = x }
  83. }
  84. )
  85. [ "bash", params.script ]
  86. }
  87. , exitPropagate = True
  88. , resources = Genode.Init.Resources::{
  89. , caps = 256
  90. , ram = Genode.units.MiB 8
  91. }
  92. , routes =
  93. [ Init.ServiceRoute.child "File_system" "vfs"
  94. , { service =
  95. { name = "ROM"
  96. , label =
  97. Init.LabelSelector.Type.Partial
  98. { prefix = Some "/nix/store/"
  99. , suffix = None Text
  100. }
  101. }
  102. , route =
  103. Init.Route.Type.Child
  104. { name = "store_rom"
  105. , label = None Text
  106. , diag = None Bool
  107. }
  108. }
  109. ]
  110. }
  111. }
  112. }
  113. in Test::{ children = Test.initToChildren init }