Repository navigation
feat(init): Start a program built into urunit - #1
Merged
Merged
Conversation
- make EMBED=<path> builds a static program into urunit; the early init starts it from a memfd before the root is mounted, output to kmsg. - EMBED_NAME, EMBED_WHEN (a path that must exist) and EMBED_READY (a ready-fd flag, waited on for up to 3 s) fix when and how it runs. Signed-off-by: Anastassios Nanos <ananos@nofire.ai>
ananos
force-pushed
the
feat/init-embedded-telem-capture
branch
from
December 1, 2026 00:55
4e97444 to
7ace25a
Compare
ananos
marked this pull request as ready for review
December 1, 2026 01:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make static EMBED=<path>builds a static program intourunit. The early init starts it before the root is mounted, from amemfd, so the root mount and the workload run after it and the initrd stays one file. It suits a tracing or monitoring helper that has to be in place first.How
.rodatabetween two weak symbols (urunit_embed_blob,urunit_embed_blob_end), through an.incbinthe Makefile writes. A build withoutEMBEDleaves them null and starts nothing.fexecvefrom amemfd, as a child of PID 1 that the reaping loop collects, with stdout and stderr on/dev/kmsg. tracefs is mounted at/sys/kernel/tracingfirst.EMBED_NAME: itsargv[0](defaultembedded)EMBED_WHEN: a path that must exist for it to start, such as a device the kernel offers only when the feature is there (default: always)EMBED_READY: a flag that takes a file descriptor, such as--ready-fd; the program gets the write end of a pipe through it and the init waits up to 3 s for one byte. A program that exits first or stalls is logged and the boot goes on (default: no wait).Verification
make checkwith glibc (Ubuntu) and musl (Alpine 3.21): PASS.test_embed_wait_readycovers the byte, end of file and the timeout.make static EMBED=<37 KB static dummy> EMBED_NAME=probe-helper EMBED_WHEN=/dev/probe EMBED_READY=--ready-fdin Alpine: the binary grows by 40,960 bytes and carries the three configured strings; a plainmake staticis unchanged.Base
Rebased onto
nofire, the default branch, which carries the stack (up to the host name change) on top of upstreammain.