[PATCH 1/2] startup: point out that /env/bin/init is legacy
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon May 18 01:51:31 PDT 2026
It's 7 years ago that commit 90df2a955e3c ("defaultenv: Convert init script
to C") changed the default to having the init in C instead of
/env/bin/init.
The latter is still supported, but not a good idea for new platforms, so
make it clearer by calling it "legacy" in barebox console output and in
the docs.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
Documentation/user/defaultenv-2.rst | 13 +++++++++++--
common/startup.c | 2 +-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Documentation/user/defaultenv-2.rst b/Documentation/user/defaultenv-2.rst
index 2564eb959fcc..2b903afc14db 100644
--- a/Documentation/user/defaultenv-2.rst
+++ b/Documentation/user/defaultenv-2.rst
@@ -51,8 +51,8 @@ and their respective included directories in ``defaultenv/Makefile``:
-------------
The default init script is now written in C. However, you can still define
-your own ``/env/bin/init`` script and it will take precedence over the
-built-in C implementation.
+a legacy ``/env/bin/init`` script yourself and it will take precedence over
+the built-in C implementation.
Example for simple init script:
.. code-block:: sh
@@ -66,6 +66,15 @@ This script is also responsible for defining the boot timeout value
Be careful making changes to this script: since it is executed before any user
intervention, it might lock the system.
+.. note::
+
+ The built-in init does not only source init scripts, but also does
+ extra work like sourcing the relevant scripts under ``/env/bmode/``
+ according to the active reboot mode or creating ``/cmdline`` and
+ ``/external-devicetree`` files as appropriate.
+ If you define your own legacy init, these features and more will
+ not be available, unless explicitly provided by the custom init.
+
/env/init/
----------
diff --git a/common/startup.c b/common/startup.c
index e630033e3505..98da24873e07 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -350,7 +350,7 @@ static int run_init(void)
/* Run legacy /env/bin/init if it exists */
env_bin_init_exists = stat(INITFILE, &s) == 0;
if (env_bin_init_exists) {
- pr_info("running %s...\n", INITFILE);
+ pr_info("running legacy %s...\n", INITFILE);
run_command("source " INITFILE);
return 0;
}
--
2.47.3
More information about the barebox
mailing list