[PATCH 08/25] fastboot: Avoid depending on CMDLINE
Simon Glass
sjg at chromium.org
Sun Oct 8 01:10:10 CEST 2023
Hi Tom,
On Sun, 24 Sept 2023 at 16:59, Tom Rini <trini at konsulko.com> wrote:
>
> 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?
It actually fails to build, since there is a Kconfig conflict, as
mentioned in the commit message. The use of 'select FASTBOOT' when
CMDLINE is not enabled produces an error.
I will see if I can do this another way.
Regards,
Simon
More information about the U-Boot
mailing list