[PATCH 08/25] fastboot: Avoid depending on CMDLINE
Tom Rini
trini at konsulko.com
Mon Sep 25 00:59:37 CEST 2023
On Sun, Sep 24, 2023 at 02:39:26PM -0600, Simon Glass wrote:
> When CMDLINE is not enabled, this code fails to build. Correct this by
> adding conditions.
>
> Note that this should not happen in normal use, since the use of
> 'select CMDLINE' will cause a visible warning. But it is needed for the
> sandbox build to pass without CMDLINE.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> drivers/fastboot/fb_command.c | 3 ++-
> drivers/fastboot/fb_common.c | 15 +++++++++++++--
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
> index 71cfaec6e9dc..4e52e6f0f8bf 100644
> --- a/drivers/fastboot/fb_command.c
> +++ b/drivers/fastboot/fb_command.c
> @@ -346,7 +346,8 @@ static char g_a_cmd_buff[64];
>
> void fastboot_acmd_complete(void)
> {
> - run_command(g_a_cmd_buff, 0);
> + if (IS_ENABLED(CONFIG_CMDLINE))
> + run_command(g_a_cmd_buff, 0);
> }
>
> /**
> diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
> index 4e9d9b719c6f..35b7aafe5af3 100644
> --- a/drivers/fastboot/fb_common.c
> +++ b/drivers/fastboot/fb_common.c
> @@ -132,6 +132,13 @@ void fastboot_boot(void)
> {
> char *s;
>
> + /*
> + * Avoid a build error; this will always have generated a Kconfig
> + * warning about CMDLINE not being enabled
> + */
> + if (!IS_ENABLED(CONFIG_CMDLINE))
> + return;
> +
> s = env_get("fastboot_bootcmd");
> if (s) {
> run_command(s, CMD_FLAG_ENV);
> @@ -170,8 +177,12 @@ void fastboot_handle_boot(int command, bool success)
>
> switch (command) {
> case FASTBOOT_COMMAND_BOOT:
> - fastboot_boot();
> - net_set_state(NETLOOP_SUCCESS);
> + if (IS_ENABLED(CONFIG_CMDLINE)) {
> + fastboot_boot();
> + net_set_state(NETLOOP_SUCCESS);
> + } else {
> + net_set_state(NETLOOP_FAIL);
> + }
> break;
>
> case FASTBOOT_COMMAND_CONTINUE:
All of this just means it now fails to work, yes?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230924/f3c401e8/attachment.sig>
More information about the U-Boot
mailing list