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.

store-wrapper.dhall 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. let Genode = env:DHALL_GENODE
  2. let Prelude = Genode.Prelude
  3. let XML = Prelude.XML
  4. let Init = Genode.Init
  5. let Child = Init.Child
  6. let TextMapType = Prelude.Map.Type Text
  7. let ChildMapType = TextMapType Child.Type
  8. let Manifest/Type = TextMapType (TextMapType Text)
  9. in λ ( params
  10. : { extraCoreChildren : ChildMapType
  11. , subinit : Init.Type
  12. , storeSize : Natural
  13. , storeRomPolicies : Prelude.Map.Type Text Text
  14. , routes : List Init.ServiceRoute.Type
  15. , bootManifest : Manifest/Type
  16. }
  17. ) →
  18. Genode.Boot::{
  19. , config = Init::{
  20. , routes = params.routes
  21. , children =
  22. let child = Prelude.Map.keyValue Child.Type
  23. in [ child
  24. "timer"
  25. ( Child.flat
  26. Child.Attributes::{
  27. , binary = "timer_drv"
  28. , provides = [ "Timer" ]
  29. , config = Init.Config::{
  30. , policies =
  31. [ Init.Config.Policy::{
  32. , service = "Timer"
  33. , label = Init.LabelSelector.none
  34. }
  35. ]
  36. }
  37. }
  38. )
  39. , child
  40. "rtc"
  41. ( Child.flat
  42. Child.Attributes::{
  43. , binary = "rtc_drv"
  44. , provides = [ "Rtc" ]
  45. , routes = [ Init.ServiceRoute.parent "IO_PORT" ]
  46. }
  47. )
  48. , child
  49. "jitter_sponge"
  50. ( Child.flat
  51. Child.Attributes::{
  52. , binary = "jitter_sponge"
  53. , provides = [ "Terminal" ]
  54. , config = Init.Config::{
  55. , policies =
  56. [ Init.Config.Policy::{
  57. , service = "Terminal"
  58. , label = Init.LabelSelector.suffix "entropy"
  59. }
  60. ]
  61. }
  62. }
  63. )
  64. , child
  65. "store_rom"
  66. ( Child.flat
  67. Child.Attributes::{
  68. , binary = "cached_fs_rom"
  69. , provides = [ "ROM" ]
  70. , resources = Init.Resources::{
  71. , ram = params.storeSize + Genode.units.MiB 1
  72. }
  73. , config = Init.Config::{
  74. , policies =
  75. [ Init.Config.Policy::{
  76. , service = "ROM"
  77. , label =
  78. Init.LabelSelector.prefix
  79. "nixos -> /nix/store"
  80. , diag = Some True
  81. }
  82. ]
  83. # ( let Entry = Prelude.Map.Entry Text Text
  84. in Prelude.List.concatMap
  85. Entry
  86. Init.Config.Policy.Type
  87. ( λ(e : Entry) →
  88. [ Init.Config.Policy::{
  89. , service = "ROM"
  90. , diag = Some True
  91. , label =
  92. Init.LabelSelector.prefix
  93. "nixos -> ${e.mapKey}"
  94. , attributes = toMap
  95. { directory =
  96. "${e.mapValue}/bin"
  97. }
  98. }
  99. , Init.Config.Policy::{
  100. , service = "ROM"
  101. , diag = Some True
  102. , label =
  103. Init.LabelSelector.Type.Partial
  104. { prefix = Some
  105. "nixos -> ${e.mapKey}"
  106. , suffix = Some ".so"
  107. }
  108. , attributes = toMap
  109. { directory =
  110. "${e.mapValue}/lib"
  111. }
  112. }
  113. ]
  114. )
  115. params.storeRomPolicies
  116. )
  117. }
  118. }
  119. )
  120. ]
  121. # params.extraCoreChildren
  122. # [ child
  123. "nixos"
  124. ( Init.toChild
  125. params.subinit
  126. Init.Attributes::{
  127. , exitPropagate = True
  128. , resources = Init.Resources::{
  129. , ram = Genode.units.MiB 4
  130. }
  131. , routes =
  132. let parentROMs =
  133. Prelude.List.concatMap
  134. Text
  135. Init.ServiceRoute.Type
  136. ( λ(suffix : Text) →
  137. Prelude.List.map
  138. Text
  139. Init.ServiceRoute.Type
  140. ( λ(prefix : Text) →
  141. { service =
  142. { name = "ROM"
  143. , label =
  144. Init.LabelSelector.Type.Partial
  145. { prefix = Some prefix
  146. , suffix = Some suffix
  147. }
  148. }
  149. , route =
  150. Init.Route.parent
  151. (Some suffix)
  152. }
  153. )
  154. ( Prelude.Map.keys
  155. Text
  156. Init.Child.Type
  157. params.subinit.children
  158. )
  159. )
  160. in parentROMs
  161. [ "ld.lib.so", "vfs.lib.so", "init" ]
  162. # [ Init.ServiceRoute.parent "IO_MEM"
  163. , Init.ServiceRoute.parent "IO_PORT"
  164. , Init.ServiceRoute.parent "IRQ"
  165. , Init.ServiceRoute.parent "VM"
  166. , Init.ServiceRoute.child "Timer" "timer"
  167. , Init.ServiceRoute.child "Rtc" "rtc"
  168. ]
  169. }
  170. )
  171. ]
  172. }
  173. , rom =
  174. Genode.BootModules.toRomPaths
  175. ( Prelude.List.concat
  176. (Prelude.Map.Entry Text Text)
  177. ( Prelude.Map.values
  178. Text
  179. (Prelude.Map.Type Text Text)
  180. params.bootManifest
  181. )
  182. )
  183. }