Hi Alexey,

On 4/10/24 12:58, Alexey Romanov wrote:
Currently, fastboot protocol in U-Boot has no opportunity
to execute vendor custom code with verifed boot. This patch
introduce new fastboot subcommand fastboot oem board:<cmd>,
which allow to run custom oem_board function.

Default implementation is __weak. Vendor must redefine it in
board/ folder with his own logic.

For example, some vendors have their custom nand/emmc partition
flashing or erasing. Here some typical command for such use cases:

- flashing:

   $ fastboot stage bootloader.img
   $ fastboot oem board:write_bootloader

- erasing:

   $ fastboot oem board:erase_env

Signed-off-by: Alexey Romanov <avroma...@salutedevices.com>
Reviewed-by: Mattijs Korpershoek <mkorpersh...@baylibre.com>
---
  doc/android/fastboot.rst      | 18 ++++++++++++++++++
  drivers/fastboot/Kconfig      |  7 +++++++
  drivers/fastboot/fb_command.c | 30 ++++++++++++++++++++++++++++++
  include/fastboot.h            |  1 +
  4 files changed, 56 insertions(+)

diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst
index 1ad8a897c8..2a627f9890 100644
--- a/doc/android/fastboot.rst
+++ b/doc/android/fastboot.rst
@@ -29,6 +29,7 @@ The following OEM commands are supported (if enabled):
    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
+- ``oem board`` - this executes a custom board function which is defined by 
the vendor
Support for both eMMC and NAND devices is included. @@ -245,6 +246,23 @@ including multiple commands (using e.g. ``;`` or ``&&``) and control structures
  (``if``, ``while``, etc.). The exit code of ``fastboot`` will reflect the exit
  code of the command you ran.
+Running Custom Vendor Code
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+U-Boot allows you to execute custom fastboot logic, which can be defined
+in board/ files. It can still be used for production devices with verified
+boot, because the vendor define logic at compile time by implementing

I think it should be "defines" here?

Reviewed-by: Quentin Schulz <quentin.sch...@theobroma-systems.com>

Thanks,
Quentin

Reply via email to