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 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. let Genode =
  2. env:DHALL_GENODE sha256:e90438be23b5100003cf018b783986df67bc6d0e3d35e800677d0d9109ff6aa9
  3. let Prelude = Genode.Prelude
  4. let XML = Prelude.XML
  5. let Init = Genode.Init
  6. let Child = Init.Child
  7. let TextMapType = Prelude.Map.Type Text
  8. let Manifest/Type = TextMapType (TextMapType Text)
  9. let Manifest/toRoutes =
  10. λ(manifest : Manifest/Type) →
  11. Prelude.List.map
  12. (Prelude.Map.Entry Text Text)
  13. Init.ServiceRoute.Type
  14. ( λ(entry : Prelude.Map.Entry Text Text) →
  15. { service =
  16. { name = "ROM"
  17. , label = Init.LabelSelector.Type.Last entry.mapKey
  18. }
  19. , route =
  20. Init.Route.Type.Child
  21. { name = "store_rom"
  22. , label = Some entry.mapValue
  23. , diag = Some True
  24. }
  25. }
  26. )
  27. ( Prelude.List.concat
  28. (Prelude.Map.Entry Text Text)
  29. (Prelude.Map.values Text (Prelude.Map.Type Text Text) manifest)
  30. )
  31. let parentROMs =
  32. Prelude.List.map
  33. Text
  34. Init.ServiceRoute.Type
  35. ( λ(label : Text) →
  36. { service = { name = "ROM", label = Init.LabelSelector.last label }
  37. , route =
  38. Init.Route.Type.Parent { label = Some label, diag = None Bool }
  39. }
  40. )
  41. let wrapStore
  42. : Init.Type → Manifest/Type → Child.Type
  43. = λ(init : Init.Type) →
  44. λ(manifest : Manifest/Type) →
  45. Init.toChild
  46. init
  47. Init.Attributes::{
  48. , exitPropagate = True
  49. , resources = Init.Resources::{ ram = Genode.units.MiB 4 }
  50. , routes =
  51. [ Init.ServiceRoute.parent "IO_MEM"
  52. , Init.ServiceRoute.parent "IO_PORT"
  53. , Init.ServiceRoute.parent "IRQ"
  54. , Init.ServiceRoute.parent "VM"
  55. , Init.ServiceRoute.child "Timer" "timer"
  56. , Init.ServiceRoute.child "Rtc" "rtc"
  57. ]
  58. # parentROMs
  59. [ "ld.lib.so"
  60. , "init"
  61. , "platform_info"
  62. , "core_log"
  63. , "kernel_log"
  64. , "vfs"
  65. , "vfs.lib.so"
  66. , "cached_fs_rom"
  67. ]
  68. # Manifest/toRoutes manifest
  69. # [ Init.ServiceRoute.child "ROM" "store_rom" ]
  70. }
  71. in λ(subinit : Init.Type) →
  72. λ(storeName : Text) →
  73. λ(storeSize : Natural) →
  74. λ(storeManifest : Manifest/Type) →
  75. λ(bootManifest : Manifest/Type) →
  76. Genode.Boot::{
  77. , config = Init::{
  78. , children =
  79. let child = Prelude.Map.keyValue Child.Type
  80. in [ child
  81. "timer"
  82. ( Child.flat
  83. Child.Attributes::{
  84. , binary = "timer_drv"
  85. , provides = [ "Timer" ]
  86. }
  87. )
  88. , child
  89. "rtc"
  90. ( Child.flat
  91. Child.Attributes::{
  92. , binary = "rtc_drv"
  93. , provides = [ "Rtc" ]
  94. , routes = [ Init.ServiceRoute.parent "IO_PORT" ]
  95. }
  96. )
  97. , child
  98. "store_fs"
  99. ( Child.flat
  100. Child.Attributes::{
  101. , binary = "vfs"
  102. , config = Init.Config::{
  103. , content =
  104. [ XML.element
  105. { name = "vfs"
  106. , attributes = XML.emptyAttributes
  107. , content =
  108. [ XML.leaf
  109. { name = "tar"
  110. , attributes = toMap { name = storeName }
  111. }
  112. ]
  113. }
  114. ]
  115. , policies =
  116. [ Init.Config.Policy::{
  117. , service = "File_system"
  118. , label = Init.LabelSelector.suffix "nix-store"
  119. , attributes = toMap { root = "/nix/store" }
  120. }
  121. , Init.Config.Policy::{
  122. , service = "File_system"
  123. , label = Init.LabelSelector.prefix "store_rom"
  124. , attributes = toMap { root = "/" }
  125. }
  126. ]
  127. }
  128. , provides = [ "File_system" ]
  129. }
  130. )
  131. , child
  132. "store_rom"
  133. ( Child.flat
  134. Child.Attributes::{
  135. , binary = "cached_fs_rom"
  136. , provides = [ "ROM" ]
  137. , resources = Init.Resources::{
  138. , ram = storeSize + Genode.units.MiB 1
  139. }
  140. }
  141. )
  142. , child "init" (wrapStore subinit storeManifest)
  143. ]
  144. }
  145. , rom =
  146. Genode.BootModules.toRomPaths
  147. ( Prelude.List.concat
  148. (Prelude.Map.Entry Text Text)
  149. ( Prelude.Map.values
  150. Text
  151. (Prelude.Map.Type Text Text)
  152. bootManifest
  153. )
  154. )
  155. }