Skip to content

[kernel, build] Dynamically configure kernel when /bin/init not present#2431

Merged
ghaerr merged 3 commits intomasterfrom
noinit
Nov 2, 2025
Merged

[kernel, build] Dynamically configure kernel when /bin/init not present#2431
ghaerr merged 3 commits intomasterfrom
noinit

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Nov 2, 2025

The kernel startup for task 1 was enhanced to allow for dynamically handling the case when the first task is not /bin/init.
Previously, this required special kernel compilation using CONFIG_SYS_NO_BININIT. Now, the kernel handles this dynamically, which can occur when /bootopts uses init= or /bin/init is missing from the boot image. In addition, the meaning of CONFIG_SYS_NO_BININIT is changed when set in a config file to not copy /bin/init, /bin/getty and /bin/login, resulting in smaller systems, mostly useful for ROM systems.

Discussed in more detail in #2426. This PR also includes several enhancements originally written or conceived by @hexadec1mal in #2426. In particular, @hexadec1mal's ideas or code is used:

  • Using CONFIG_SYS_NO_BININIT for controlling image contents
  • Adding :init tag in Applications installation file
  • Better language in menuconfig when CONFIG_SYS_NO_BININIT used
  • Fixes in .gitignore and parallel makes

Thank you @hexadec1mal!

The previous mechanism for disabling auto-reaping of child processes on parent exit when /bin/init is not running was broken. sash now calls waitpid to remove zombie processes, which caused an out-of-tasks condition when /bin/sash was run as the init task.

Tested on PC builds and emu86 ROM images. Should work on all other images since CONFIG_SYS_NO_BININIT is not set by default for any supported port.

@ghaerr ghaerr merged commit 5c1c577 into master Nov 2, 2025
1 check passed
@ghaerr ghaerr deleted the noinit branch November 2, 2025 02:08
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