Commit Graph

47 Commits

Author SHA1 Message Date
bjorn3 a93e4c5fcc init: Remove unnecessary derives for SwitchRoot 2026-04-05 17:32:59 +02:00
bjorn3 a4cb95bd61 init: Extract Unit::conditions_met method 2026-04-05 16:59:41 +02:00
bjorn3 e09f28f1b0 init: Pass reference to Unit to run 2026-04-05 16:59:41 +02:00
bjorn3 57d74e8e17 init: Turn default dependencies into regular dependencies at load time 2026-04-05 16:59:40 +02:00
auronandace 557a3d1954 consolidate several dependencies into the workspace 2026-03-22 15:11:33 +00:00
Ribbon 90ea974ce0 Add missing Cargo package description and update drivers README 2026-03-16 10:39:15 -06:00
Wildan M 2784c98ddd init: Allow skipping services, print service name in debug 2026-03-12 21:20:04 +07:00
bjorn3 a063db73a4 init: Support unit instancing
And use it for the logging ramfs by having a generic ramfs unit.
2026-03-05 19:42:17 +01:00
bjorn3 0869d8184c init: Nicer error handling 2026-03-05 19:41:30 +01:00
bjorn3 1424a470d3 init: Change from push to a pull for loading units
Rather than starting all services in the config dir, we only start those
which are a dependency of the target we want to reach. This is necessary
to handle unit templating, service start stop and an alternative target
for recovery or graceful shutdown.
2026-03-04 21:55:11 +01:00
bjorn3 7cea939540 init: Switch root upon reaching initfs.target 2026-03-04 21:53:48 +01:00
bjorn3 6d243d666c init: Convert rootfs to a service
With this the entire initfs now uses service definitions.
2026-02-28 17:03:25 +01:00
bjorn3 e86dbfa17e Init: Introduce support for conditionally spawning services
depending on the architecture and selected board. With this the
migration of initfs daemons to service definitions is almost done.
2026-02-28 16:55:26 +01:00
auronandace 7849aa23b3 make serde and toml workspace dependencies 2026-02-27 08:39:29 +00:00
bjorn3 124f11bde1 init: Convert all service definitions to toml 2026-02-26 17:41:39 +01:00
bjorn3 3d2951a23d init: Convert vesad, fbbootlogd and fbcond to services 2026-02-26 16:38:56 +01:00
bjorn3 fb051cd486 init: Special case logd
Logd is a special case. Every other service effectively has an implicit
dependency on it for sending log messages to it and even init itself
depends on it for it's own log messages.
2026-02-26 15:18:19 +01:00
Jeremy Soller 75b9f07a92 Merge branch 'init_rework3' into 'main'
Introduce dependency handling to init

See merge request redox-os/base!133
2026-02-25 15:02:54 -07:00
bjorn3 bb2a00114f init: Introduce dependency handling 2026-02-25 22:43:11 +01:00
bjorn3 6fcb07e7dd init: Introduce UnitStore
This will be necessary to store persistent information about units like
if they are currently started and which process is associated with them.
2026-02-25 22:06:25 +01:00
bjorn3 73cc0b0a07 init: Begin introducing units
Dependencies are not yet functional.
2026-02-25 20:57:47 +01:00
bjorn3 f364bf1f60 init: Introduce a json format for services
While I would have like to use toml, something inside the toml crate
seems to be using randomness, which is not yet available when init
starts.
2026-02-25 20:18:42 +01:00
auronandace 5ffce47607 add clippy precedence lint 2026-02-20 13:43:48 +00:00
bjorn3 4e772728ad init: Introduce Service type
A future commit will use it to define services in toml format.
2026-02-19 22:18:29 +01:00
bjorn3 c9d691fa29 init: Remove export and unset commands
They manipulate global state and none of the init scripts use them anymore.
2026-02-19 21:57:45 +01:00
bjorn3 87abd3fb70 init: Maintain default service env vars separate from init env vars
With this only the env vars set using export or explicitly specify for a
service are passed to services (in addition to RUST_BACKTRACE, PATH and
LD_LIBRARY_PATH). As such we no longer need to manually unset bootloader
env vars to keep the environment clean. And finally this means that env
var substitutions in shell scripts always use the bootloader provided
env vars rather than locally specified ones.

This does regress multi monitor support when there is no proper graphics
driver.
2026-02-19 21:06:53 +01:00
bjorn3 b7524c3a65 init: Allow passing env vars to individual services 2026-02-19 20:50:48 +01:00
bjorn3 029f56eebe init: Remove cd command
The working directory doesn't matter for services and login sessions
already cd to the user home directory. This removes one source of global
state manipulation.
2026-02-19 20:26:51 +01:00
bjorn3 0227c0677c init: Introduce switchroot command
This sets PATH, LD_LIBRARY_PATH and runs init scripts for the new root.
In the future this could replace the entire set of services that should
run, restarting any services for which a newer executable is available
in the new root and stopping any services which don't exist in the new
root. This behavior could also be useful for soft-reboots in the future
to handle updates without rebooting the entire system.
2026-02-19 20:18:07 +01:00
bjorn3 7ebeceb41d init: Allow init to register the scheme for a daemon
Unfortunately the scheme still has to be created by the daemon due to a
kernel bug, but once that is fixed, it would allow delayed spawning of
scheme daemons.
2026-02-18 22:40:09 +01:00
bjorn3 2d071a5b75 init: Separate init script parsing and executing
And remove the run command and eagerly apply env var subsitution before
execution.
2026-02-18 21:46:02 +01:00
bjorn3 0a17fef534 Introduce a shared config locator
And use it for init and pcid-spawner
2026-02-17 22:26:04 +01:00
bjorn3 6096fffe5d Let init handle daemonization
This way init can track the lifecycle of services in the future. It may
also help with parallel booting in the future.
2026-01-26 21:51:14 +01:00
Wildan M f24affc111 init: Add log and skip options 2026-01-23 02:25:07 +07:00
Jeremy Soller 5b675c3c9a init: print errors to stderr 2026-01-22 14:50:11 -07:00
Jeremy Soller f740b61774 Use workspace dependencies for many common crates 2026-01-20 10:12:08 -07:00
Ribbon 723364cb45 Improve, update and remove unnecessary READMEs 2025-12-16 21:34:36 -03:00
bjorn3 858ff9cea9 init: Refactor the run function to reduce indentation 2025-12-05 21:02:46 +01:00
bjorn3 1d834c2393 init: Read config files all at once
This is simpler than streaming and likely a bit faster. Config files are
expected to be tiny.
2025-12-05 20:52:50 +01:00
bjorn3 c7adb019b5 Use file as default scheme from the start
This removes one piece of state that init has to manage for the
processes it spawns. This also allows getting rid of the concept of a
default scheme from relibc if we want.
2025-12-05 20:52:50 +01:00
bjorn3 0c2341d53e Remove outdated Cargo.lock files 2025-12-03 21:00:13 +01:00
bjorn3 66ca17f899 init: Add a nowait command that immediately daemonizes
This is useful for daemons on which no other daemon has a dependency as
those would no longer need to use redox_daemon to daemonize themself.
2025-11-30 10:45:55 +01:00
Jeremy Soller 9972903dc4 init: do not log successful command completion 2025-11-01 19:29:52 -06:00
Ribbon 632459e5be Add a README and simplify the daemon READMEs 2025-05-15 23:29:52 -03:00
bjorn3 72d04da8a9 init: Improve command spawning
The stdout and stderr of the spawned processes are not captured by init,
so attempting to write captured input is useless. Also show the exit
code in case the child process returned an non-zero exit code.
2025-03-31 20:11:32 +02:00
bjorn3 8824229b9e Move a couple of files to the top level 2025-02-18 21:35:28 +01:00
bjorn3 38c917a56b Add 'init/' from commit '0e7a0d3ab46817915180adbbb775c76d67fee31c'
git-subtree-dir: init
git-subtree-mainline: 57f2dca267
git-subtree-split: 0e7a0d3ab4
2025-02-18 21:31:28 +01:00