[PATCH] fastboot: Add OEM run command
Sean Anderson
sean.anderson at seco.com
Fri Dec 2 21:51:58 CET 2022
On 12/2/22 15:50, Marek Vasut wrote:
> On 12/2/22 18:11, Sean Anderson wrote:
>> This adds the UUU UCmd functionality as an OEM command. While the
>> fastboot tool allows sending arbitrary commands as long as they are
>> prefixed with "oem". This allows running generic U-Boot commands over
>> fastboot without UUU, which is especially useful when not using USB.
>> This is really the route we should have gone in the first place when
>> adding these commands.
>
> Example how to make use of this, or even documentation entry, would be really nice.
OK
>> While we're here, clean up the Kconfig a bit.
>>
>> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
>> ---
>>
>> doc/android/fastboot.rst | 1 +
>> drivers/fastboot/Kconfig | 10 +++++-----
>> drivers/fastboot/fb_command.c | 4 ++++
>> include/fastboot.h | 1 +
>> 4 files changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst
>> index 7611f07038..b2d2e68cf5 100644
>> --- a/doc/android/fastboot.rst
>> +++ b/doc/android/fastboot.rst
>> @@ -28,6 +28,7 @@ The following OEM commands are supported (if enabled):
>> - ``oem partconf`` - this executes ``mmc partconf %x <arg> 0`` to configure eMMC
>> with <arg> = boot_ack boot_partition
>> - ``oem bootbus`` - this executes ``mmc bootbus %x %s`` to configure eMMC
>> +- ``oem run`` - this executes an arbitrary U-Boot command
>> Support for both eMMC and NAND devices is included.
>> diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
>> index b97c67bf60..8f2d52cb8a 100644
>> --- a/drivers/fastboot/Kconfig
>> +++ b/drivers/fastboot/Kconfig
>> @@ -80,12 +80,12 @@ config FASTBOOT_FLASH
>> this to enable the "fastboot flash" command.
>> config FASTBOOT_UUU_SUPPORT
>> - bool "Enable FASTBOOT i.MX UUU special command"
>> + bool "Enable running arbitrary commands from FASTBOOT"
>> help
>> - The fastboot protocol includes "UCmd" and "ACmd" command.
>> - Be aware that you provide full access to any U-Boot command,
>> - including working with memory and may open a huge backdoor,
>> - when enabling this option.
>> + This extends the fastboot protocol with the "UCmd" and "ACmd"
>> + commands, as well as the "oem run" command. These commands provide
>> + full access to any U-Boot command, including working with memory.
>> + This may open a huge backdoor if you are using verified boot.
>> choice
>> prompt "Flash provider for FASTBOOT"
>> diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
>> index 98eccc3455..1732406c18 100644
>> --- a/drivers/fastboot/fb_command.c
>> +++ b/drivers/fastboot/fb_command.c
>> @@ -123,6 +123,10 @@ static const struct {
>> },
>> #endif
>> #if CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT)
>> + [FASTBOOT_COMMAND_OEM_RUN] = {
>> + .command = "oem run",
>> + .dispatch = run_ucmd,
>> + },
>> [FASTBOOT_COMMAND_UCMD] = {
>> .command = "UCmd",
>> .dispatch = run_ucmd,
>> diff --git a/include/fastboot.h b/include/fastboot.h
>> index 57daaf1298..8b6b4b934a 100644
>> --- a/include/fastboot.h
>> +++ b/include/fastboot.h
>> @@ -45,6 +45,7 @@ enum {
>> FASTBOOT_COMMAND_OEM_BOOTBUS,
>> #endif
>> #if CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT)
>> + FASTBOOT_COMMAND_OEM_RUN,
>
> Keep the list sorted.
Didn't realize it was sorted.
--Sean
>> FASTBOOT_COMMAND_ACMD,
>> FASTBOOT_COMMAND_UCMD,
>> #endif
>
> [...]
More information about the U-Boot
mailing list