On 2026-08-06T13:37:22, Mehmet Fide <[email protected]> wrote:
> cmd: allow bootd without bootm
>
> do_bootd() runs the "bootcmd" environment variable through run_command()
> and does nothing else. It uses no bootm functionality, and neither does
> the "bootd" recursion guard in cmd_process(). doc/usage/cmd/bootd.rst
> documents it that way, with an example that sets bootcmd to
> "echo Hello World".
>
> Commit 1fd04cf46baf ("cmd: Correct dependencies for CMD_BOOTD") made
> CMD_BOOTD depend on CMD_BOOTM because the build fails otherwise:
> common/command.c is compiled unconditionally and references do_bootd(),
> whose definition sits in cmd/bootm.c, which is only compiled when
> CMD_BOOTM=y. The dependency therefore describes where the code lives
> rather than what it needs, and the boards that disable CMD_BOOTM
> (colibri_vf, iot_devkit, mx6memcal and r8a78000_ironhide_cm33) cannot
> offer "boot" or "bootd" at all, although the implementation would work
> there.
>
> Move do_bootd() and its two command registrations into cmd/bootd.c,
> compiled from CMD_BOOTD, and drop the artificial dependency. To leave
> every board in tree unchanged, CMD_BOOTD now defaults to y only when
> CMD_BOOTM is enabled, which is precisely the set of boards that have it
> today. Boards without bootm can enable it deliberately.
>
> Tested on sandbox: bootd, the "boot" alias, the return value taken from
> a failing bootcmd and the recursion guard all behave as before. Also
> tested on a Colibri VF50 (vf610) board built with CMD_BOOTM=n and
> CMD_BOOTD=y, a combination that could not be selected before: "boot" and
> "bootd" run bootcmd and bring up the OS, and a bootcmd of "false"
> returns 1. A colibri_vf_defconfig build with CMD_BOOTD left off is byte
> identical to the previous one apart from the version string; enabling
> CMD_BOOTD costs 272 bytes.
>
> Signed-off-by: Mehmet Fide <[email protected]>
> Reviewed-by: Tom Rini <[email protected]>
>
> cmd/Kconfig  |  3 +--
>  cmd/Makefile |  1 +
>  cmd/bootd.c  | 30 ++++++++++++++++++++++++++++++
>  cmd/bootm.c  | 24 ------------------------
>  4 files changed, 32 insertions(+), 26 deletions(-)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to