On 3/11/25 1:31 PM, Caleb Connolly wrote:
Improve support for running U-Boot on [Qualcomm] smartphones, with:

* A boot menu which can be entered by holding power during boot
* Hang on panic (so errors can be read on the display)
* Serial gadget which can be enabled by holding volume down or via
   boot menu

In its current form, U-Boot's boot menu is perfectly adequate, however
once an option is picked U-Boot will never return to the menu, always to
the CLI.

On a phone (with no keyboard), dropping to the CLI effectively makes the
device unusable until manually rebooted, since there is no way to run
any commands...

To rectify this, let's revive CONFIG_BOOT_RETRY for the hush parser and
add an option CONFIG_RETRY_BOOTCMD to run the contents of "bootcmd".
This provides for a flexible menu system which we can enter and exit.
See qcom-phone.env in patch 1 for more details.

Finally, provide some rough-ish documentation to describe how Qualcomm
phone support works and outline some debugging steps for when UART and
the framebuffer are unavailable.

---
Changes in v3:
- Minor wording/clarification improvements in docs
- Introduce CONFIG_RETRY_BOOTCMD rather than changing the default
   behaviour.
- Enable some more gadgets in the phone config fragment.
- Link to v2: 
https://lore.kernel.org/u-boot/[email protected]

Changes in v2:
- Fix CONFIG_BUTTON_REMAP_PHONE_KEYS name in qcom-phone.config
- Add Tom and Simon to CC
- Link to v1: 
https://lore.kernel.org/r/[email protected]

---
Caleb Connolly (4):
       board/qualcomm: introduce phone config
       cli_hush: support running bootcmd on boot retry
       bootretry: check for bootretry variable changes
       doc: board/qualcomm: describe phone support and bringup

  board/qualcomm/qcom-phone.config |  17 ++++++
  board/qualcomm/qcom-phone.env    |  49 ++++++++++++++++
  boot/Kconfig                     |   7 +++
  boot/bootretry.c                 |   2 +
  common/cli_hush.c                |   6 +-
  common/cli_hush_upstream.c       |   6 +-
  doc/board/qualcomm/board.rst     |   5 ++
  doc/board/qualcomm/index.rst     |   1 +
  doc/board/qualcomm/phones.rst    | 122 +++++++++++++++++++++++++++++++++++++++
  9 files changed, 211 insertions(+), 4 deletions(-)
---
base-commit: 78f8c8c58f7d3f7c3a26af4afbd08aba21c14c90

Caleb Connolly <[email protected]>


I've tested this on a Xiaomi Mi 9T / Redmi K20 (xiaomi-davinci, Qualcomm SM7150) with a handful of patches on top for SM7150 support.

I had to manually enable the following configs for USB serial gadget to work, so I suggest enabling them like others already pointed out:
CONFIG_DM_USB_GADGET=y
CONFIG_USB_FUNCTION_ACM=y

Also, for EFI boot to work I added the following configs, not sure which ones were actually making the difference:
CONFIG_EFI_RT_VOLATILE_STORE=y
CONFIG_EFI_SET_TIME=y
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_IGNORE_OSINDICATIONS=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y

With those enabled, everything works as expected and is comfortable to navigate. Thanks for your work!

Tested-by: Jens Reidel <[email protected]> # xiaomi-davinci

Best regards,
Jens

Reply via email to