On 9/9/26 4:23 PM, Carlo Caione wrote:
> On Wed, Sep 09, 2026 at 16:16:16 +0100, David Lechner wrote:
>> On 9/6/26 3:02 PM, Carlo Caione wrote:
>>> Some recovery and initial-provisioning flows run before usable firmware
>>> is available in persistent storage. In these flows the SoC ROM loads a
>>> small first stage, but that stage must still provide a standard protocol
>>> with which the host can provision the device.
>>>
>>
>> ...
>>
>>> diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
>>> index 111516fd1b3..a2a89fc04f8 100644
>>> --- a/drivers/fastboot/fb_command.c
>>> +++ b/drivers/fastboot/fb_command.c
>>> @@ -48,10 +48,59 @@ static void oem_board(char *, char *);
>>>  static void run_ucmd(char *, char *);
>>>  static void run_acmd(char *, char *);
>>>  
>>> -static const struct {
>>> +struct fastboot_command {
>>>     const char *command;
>>>     void (*dispatch)(char *cmd_parameter, char *response);
>>> -} commands[FASTBOOT_COMMAND_COUNT] = {
>>> +};
>>> +
>>> +#ifdef CONFIG_XPL_BUILD
>>> +static const struct fastboot_command commands[FASTBOOT_COMMAND_COUNT] = {
>>> +   [FASTBOOT_COMMAND_GETVAR] = {
>>> +           .command = "getvar",
>>> +           .dispatch = getvar
>>> +   },
>>> +   [FASTBOOT_COMMAND_DOWNLOAD] = {
>>> +           .command = "download",
>>> +           .dispatch = download
>>> +   },
>>> +   [FASTBOOT_COMMAND_FLASH] =  {
>>> +           .command = "flash",
>>> +           .dispatch = CONFIG_IS_ENABLED(FASTBOOT_FLASH, (flash), (NULL))
>>> +   },
>>> +   [FASTBOOT_COMMAND_ERASE] =  {
>>> +           .command = "erase",
>>> +           .dispatch = CONFIG_IS_ENABLED(FASTBOOT_FLASH, (erase), (NULL))
>>> +   },
>>> +   [FASTBOOT_COMMAND_CONTINUE] =  {
>>> +           .command = "continue",
>>> +           .dispatch = okay
>>> +   },
>>> +   [FASTBOOT_COMMAND_REBOOT] =  {
>>> +           .command = "reboot",
>>> +           .dispatch = CONFIG_IS_ENABLED(FASTBOOT_REBOOT, (okay), (NULL))
>>> +   },
>>> +   [FASTBOOT_COMMAND_REBOOT_BOOTLOADER] =  {
>>> +           .command = "reboot-bootloader",
>>> +           .dispatch = CONFIG_IS_ENABLED(FASTBOOT_REBOOT,
>>> +                                        (reboot_bootloader), (NULL))
>>> +   },
>>> +   [FASTBOOT_COMMAND_REBOOT_FASTBOOTD] =  {
>>> +           .command = "reboot-fastboot",
>>> +           .dispatch = CONFIG_IS_ENABLED(FASTBOOT_REBOOT,
>>> +                                        (reboot_fastbootd), (NULL))
>>> +   },
>>> +   [FASTBOOT_COMMAND_REBOOT_RECOVERY] =  {
>>> +           .command = "reboot-recovery",
>>> +           .dispatch = CONFIG_IS_ENABLED(FASTBOOT_REBOOT,
>>> +                                        (reboot_recovery), (NULL))
>>> +   },
>>> +   [FASTBOOT_COMMAND_SET_ACTIVE] =  {
>>> +           .command = "set_active",
>>> +           .dispatch = okay
>>> +   },
>>> +};
>>
>> Do we really need to make a complete second table or can we just #ifndef
>> the indivdual commands in the existing table?
> 
> That was actually suggested by Mattijs here
> https://lore.kernel.org/all/[email protected]/

ok

Reply via email to