2
0
Fork 0

nixos: move ExecStart to end of systemd children list

This commit is contained in:
Emery Hemingway 2020-12-21 00:53:54 +01:00
parent 8a8f67bdda
commit 5d4fee3bf2
1 changed files with 129 additions and 121 deletions

View File

@ -40,131 +40,139 @@ in λ ( params
Init::{ Init::{
, routes = , routes =
parentRoutes [ "File_system", "Rtc", "Terminal", "Timer" ] parentRoutes [ "File_system", "Rtc", "Terminal", "Timer" ]
, children = toMap , children =
{ vfs = toMap
Child.flat { vfs =
Child.Attributes::{ Child.flat
, binary = "vfs" Child.Attributes::{
, exitPropagate = True , binary = "vfs"
, resources = Genode.Init.Resources::{ , exitPropagate = True
, caps = 256 , resources = Genode.Init.Resources::{
, ram = Genode.units.MiB 8 , caps = 256
} , ram = Genode.units.MiB 8
, config = Init.Config::{ }
, content = , config = Init.Config::{
[ VFS.vfs , content =
( [ VFS.dir [ VFS.vfs
"dev" ( [ VFS.dir
( [ VFS.dir "pipes" [ VFS.leaf "pipe" ] "dev"
, VFS.leaf "log" ( [ VFS.dir
, VFS.leaf "null" "pipes"
, VFS.leafAttrs [ VFS.leaf "pipe" ]
"terminal" , VFS.leaf "log"
( toMap , VFS.leaf "null"
{ name = "entropy" , VFS.leafAttrs
, label = "entropy" "terminal"
( toMap
{ name = "entropy"
, label = "entropy"
}
)
, VFS.leaf "rtc"
, VFS.leaf "zero"
]
# socketsVfs
)
, VFS.dir
"usr"
[ VFS.dir
"bin"
[ VFS.symlink
"env"
"${params.coreutils}/bin/env"
]
]
, VFS.dir "tmp" [ VFS.leaf "ram" ]
, VFS.dir
"nix"
[ VFS.dir
"store"
[ VFS.fs
VFS.FS::{
, label = "nix-store"
} }
) ]
, VFS.leaf "rtc"
, VFS.leaf "zero"
]
# socketsVfs
)
, VFS.dir
"usr"
[ VFS.dir
"bin"
[ VFS.symlink
"env"
"${params.coreutils}/bin/env"
] ]
] ]
, VFS.dir "tmp" [ VFS.leaf "ram" ] # params.extraVfs
, VFS.dir )
"nix" ]
[ VFS.dir , policies =
"store" [ Init.Config.Policy::{
[ VFS.fs , service = "File_system"
VFS.FS::{ label = "nix-store" } , label = Init.LabelSelector.prefix "ExecStart"
] , attributes = toMap
] { root = "/", writeable = "yes" }
] }
# params.extraVfs , Init.Config.Policy::{
, service = "File_system"
, label = Init.LabelSelector.prefix "vfs_rom"
, attributes = toMap
{ root = "/", writeable = "no" }
}
]
}
}
, vfs_rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, resources = Genode.Init.Resources::{
, ram = Genode.units.MiB 32
}
, config = Init.Config::{
, policies =
[ Init.Config.Policy::{
, service = "ROM"
, label = Init.LabelSelector.prefix "ExecStart"
}
]
}
}
}
# [ { mapKey = "ExecStart"
, mapValue =
Child.flat
Child.Attributes::{
, binary = params.binary
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB params.ramQuotaMiB
}
, config =
( Libc.toConfig
Libc::{
, stdin = Some "/dev/null"
, stdout = Some "/dev/log"
, stderr = Some "/dev/log"
, pipe = Some "/dev/pipes"
, rng = Some "/dev/entropy"
, rtc = Some "/dev/rtc"
, socket = Some "/dev/sockets"
, vfs = [ VFS.leaf "fs" ]
, args = [ params.binary ] # params.args
}
) )
] with attributes = toMap { ld_verbose = "yes" }
, policies = , routes =
[ Init.Config.Policy::{ Prelude.List.map
, service = "File_system" Text
, label = Init.LabelSelector.prefix "ExecStart" Init.ServiceRoute.Type
, attributes = toMap ( λ(label : Text) →
{ root = "/", writeable = "yes" } Init.ServiceRoute.parentLabel
} "ROM"
, Init.Config.Policy::{ (Some label)
, service = "File_system" (Some label)
, label = Init.LabelSelector.prefix "vfs_rom" )
, attributes = toMap [ "libc.lib.so"
{ root = "/", writeable = "no" } , "libm.lib.so"
} , "posix.lib.so"
] , "vfs.lib.so"
} ]
} }
, vfs_rom = }
Child.flat ]
Child.Attributes::{
, binary = "cached_fs_rom"
, resources = Genode.Init.Resources::{
, ram = Genode.units.MiB 32
}
, config = Init.Config::{
, policies =
[ Init.Config.Policy::{
, service = "ROM"
, label = Init.LabelSelector.prefix "ExecStart"
}
]
}
}
, ExecStart =
Child.flat
Child.Attributes::{
, binary = params.binary
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB params.ramQuotaMiB
}
, config =
( Libc.toConfig
Libc::{
, stdin = Some "/dev/null"
, stdout = Some "/dev/log"
, stderr = Some "/dev/log"
, pipe = Some "/dev/pipes"
, rng = Some "/dev/entropy"
, rtc = Some "/dev/rtc"
, socket = Some "/dev/sockets"
, vfs = [ VFS.leaf "fs" ]
, args = [ params.binary ] # params.args
}
)
with attributes = toMap { ld_verbose = "yes" }
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
( λ(label : Text) →
Init.ServiceRoute.parentLabel
"ROM"
(Some label)
(Some label)
)
[ "libc.lib.so"
, "libm.lib.so"
, "posix.lib.so"
, "vfs.lib.so"
]
}
}
} }
in Init.toChild init Init.Attributes::{=} in Init.toChild init Init.Attributes::{=}