Hi,

On 12/6/22 11:23, Patrick DELAUNAY wrote:
Hi,

On 12/5/22 20:15, Sean Anderson wrote:
On 12/5/22 14:04, Patrick DELAUNAY wrote:
Hi,

On 12/2/22 22:03, 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.

While we're here, clean up the Kconfig a bit.

Signed-off-by: Sean Anderson <sean.ander...@seco.com>
---

Changes in v2:
- Document usage
- Keep enum in order

   doc/android/fastboot.rst      | 15 +++++++++++++++
   drivers/fastboot/Kconfig      | 10 +++++-----
   drivers/fastboot/fb_command.c |  4 ++++
   include/fastboot.h            |  1 +
   4 files changed, 25 insertions(+), 5 deletions(-)

....


PS: we have many #if CONFIG is the fastboot source code

       they can be replaced by CONFIG_IS_ENABLED macro and __maybe_unused in .h and .c  ?

       and that avoids the compilation issue => let the linker remove the used functions

for example

enum {

     FASTBOOT_COMMAND_GETVAR = 0,
     FASTBOOT_COMMAND_DOWNLOAD,
     CONFIG_IS_ENABLED(FASTBOOT_FLASH, (FASTBOOT_COMMAND_FLASH,))
     CONFIG_IS_ENABLED(FASTBOOT_FLASH, (FASTBOOT_COMMAND_ERASE,))
     FASTBOOT_COMMAND_BOOT,
     FASTBOOT_COMMAND_CONTINUE,
     FASTBOOT_COMMAND_REBOOT,
     FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
     FASTBOOT_COMMAND_REBOOT_FASTBOOTD,
     FASTBOOT_COMMAND_REBOOT_RECOVERY,
     FASTBOOT_COMMAND_SET_ACTIVE,
     CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT, (FASTBOOT_COMMAND_OEM_FORMAT,))      CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF, (FASTBOOT_COMMAND_OEM_PARTCONF,))      CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS, (FASTBOOT_COMMAND_OEM_BOOTBUS,))
     CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (FASTBOOT_COMMAND_ACMD,))
     CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (FASTBOOT_COMMAND_UCMD,))
     FASTBOOT_COMMAND_COUNT
};

...

ommands[FASTBOOT_COMMAND_COUNT] = {
[FASTBOOT_COMMAND_GETVAR] = {
.command = "getvar",
.dispatch = getvar
},
[FASTBOOT_COMMAND_DOWNLOAD] = {
.command = "download",
.dispatch = download
},
CONFIG_IS_ENABLED(FASTBOOT_FLASH, (
[FASTBOOT_COMMAND_FLASH] = {
.command = "flash",
.dispatch = flash
},
[FASTBOOT_COMMAND_ERASE] = {
.command = "erase",
.dispatch = erase
},
))
....
staticvoid__maybe_unused erase(char*cmd_parameter, char*response)
{
if(CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC))
fastboot_mmc_erase(cmd_parameter, response);
if(CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND))
fastboot_nand_erase(cmd_parameter, response);
}

Yes, that would probably be a good cleanup idea. However, I'd like to
keep this patch's scope focused.


Ok, I will try to propose something in parallel:

https://source.denx.de/u-boot/custodians/u-boot-stm/-/tree/fastboot

the compilation in CI is started...


For information, patch sent:

http://patchwork.ozlabs.org/project/uboot/list/?series=332837

"fastboot: remove #ifdef CONFIG when it is possible"


and CI build is OK =>

https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/14377




--Sean


Patrick


regards

Patrick

Reply via email to