Skip to content

Conversation

@KarlK90
Copy link
Member

@KarlK90 KarlK90 commented Dec 4, 2025

This is a quick demonstrator on how to implement the functionality of #21 as callbacks. More work needs to be done to truly separate the custom logic from the main rsinit crate, but the idea should be clear :-).

This is the output of this rsinit implementation run inside qemu:

Running /init...
[    2.576598]  rsinit: Custom option provided: wowowowowow
[    2.578203]  rsinit: Beep, beep! Post setup callback running... I'll just print the options: CmdlineOptions {
[    2.578203]     root: Some(
[    2.578203]         "/dev/vdb",
[    2.578203]     ),
[    2.578203]     rootfstype: Some(
[    2.578203]         "ext4",
[    2.578203]     ),
[    2.578203]     rootflags: None,
[    2.578203]     rootfsflags: MsFlags(
[    2.578203]         0x0,
[    2.578203]     ),
[    2.578203]     nfsroot: None,
[    2.578203]     init: "/sbin/init",
[    2.578203]     cleanup: true,
[    2.578203]     callbacks: CmdlineOptionsCallbacks {
[    2.578203]         callbacks_count: 0,
[    2.578203]     },
[    2.578203] }
[    2.624939] EXT4-fs (vdb): recovery complete
[    2.626477] EXT4-fs (vdb): mounted filesystem 59e66880-dd9c-430a-af55-52986ed24ac7 r/w with ordered data mode. Quota mode: none.
[    2.627301]  rsinit: I'm lucky, I was the first callback to be added!
[    2.627569]  rsinit: Let me show you the bind mounts collected so far: ["/lib/modules"]
[    2.628059]  rsinit: Bind mounting /lib/modules to /root/lib/modules

Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
@KarlK90 KarlK90 force-pushed the feature/callback-experiment branch from 161bedc to 8614c2c Compare December 12, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant