Skip to content

Conversation

@ya-mouse
Copy link
Contributor

@ya-mouse ya-mouse commented Jan 20, 2026

Add the ability to change the fastboot flash target device at runtime without recompiling. This is useful for:

  • Platforms with multiple storage options (eMMC + UFS + NVMe)
  • Development and testing scenarios
  • Recovery situations where the default device is unavailable

New command syntax:
fastboot device - set flash interface and device
fastboot device - show current interface and device

Implementation details:

  • Add fastboot_block_set_interface() and fastboot_block_set_device() functions to set runtime values
  • Add fastboot_block_get_interface() and fastboot_block_get_device() getters that return runtime value if set, otherwise fall back to Kconfig defaults
  • Update fb_block.c to use the new getter functions
  • Add command handler gated by CONFIG_FASTBOOT_FLASH_BLOCK

Example usage:
=> fastboot device scsi 0 Set fastboot block interface to 'scsi', device to 0 => fastboot usb 0 (now flashing targets SCSI device 0 instead of default)

Change-Id: 7b54f839-5659-4aaf-b58f-d6107e08a24d

@ya-mouse ya-mouse requested a review from alchark January 20, 2026 08:07
@ya-mouse ya-mouse changed the title fastboot: Add "fastboot device" command for runtime block device sele… fastboot: Add "fastboot device" command for runtime block device selection Jan 20, 2026
Comment on lines +18 to +20
#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_BLOCK)
#include <fb_block.h>
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No conditionals around headers usually

Comment on lines +226 to +231
#if IS_ENABLED(CONFIG_TCP_FUNCTION_FASTBOOT)
" | tcp"
#endif
#if IS_ENABLED(CONFIG_UDP_FUNCTION_FASTBOOT)
" | udp"
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does checkpatch.pl think about all this beauty? :)

Comment on lines +15 to +23
/**
* fastboot_block_interface - runtime block interface name
*/
static char fastboot_block_interface[16];

/**
* fastboot_block_device - runtime block device ID
*/
static int fastboot_block_device = -1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way to achieve this without global variables?

{
if (*fastboot_block_interface)
return fastboot_block_interface;
return config_opt_enabled(CONFIG_FASTBOOT_FLASH_BLOCK,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line between an if statement and the following code

{
if (fastboot_block_device >= 0)
return fastboot_block_device;
return config_opt_enabled(CONFIG_FASTBOOT_FLASH_BLOCK,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@ya-mouse ya-mouse force-pushed the splram-f75e21fc branch 2 times, most recently from cb1565d to 9cc3c2d Compare January 22, 2026 14:41
…ction

Add the ability to change the fastboot flash target device at runtime
without recompiling. This is useful for:

- Platforms with multiple storage options (eMMC + UFS + NVMe)
- Development and testing scenarios
- Recovery situations where the default device is unavailable

New command syntax:
  fastboot device <interface> <dev> - set flash interface and device
  fastboot device                   - show current interface and device

Implementation details:
- Add fastboot_block_set_interface() and fastboot_block_set_device()
  functions to set runtime values
- Add fastboot_block_get_interface() and fastboot_block_get_device()
  getters that return runtime value if set, otherwise fall back to
  Kconfig defaults
- Update fb_block.c to use the new getter functions
- Add command handler gated by CONFIG_FASTBOOT_FLASH_BLOCK

Example usage:
  => fastboot device scsi 0
  Set fastboot block interface to 'scsi', device to 0
  => fastboot usb 0
  (now flashing targets SCSI device 0 instead of default)

Change-Id: 7b54f839-5659-4aaf-b58f-d6107e08a24d
Signed-off-by: Anton Burticica <mouse@ya.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants