Hi Peter,

On 3/13/25 19:07, Peter Robinson wrote:
Hey Caleb,

    Improve support for running U-Boot on [Qualcomm] smartphones, with:


Is there anything in this that is QCom specific? Like should this also work on the Pinephone phones which have either a Allwinner or Rockchip SoC?

The ideas here could be adapted to other platforms, but unfortunately the implementation itself (e.g. the environment file) is Qualcomm specific. Every device will be slightly different here and - at least with the current approach - it can't be made very generic.


    * 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.


I wonder if it makes sense to make this a generic option selectable by Kconfig.

I couldn't really see a nice way to do this. The commands get run through the shell interpreter anyways.

    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".


Is there a way to do this without hush, a bit of thinking out loud by with this hush makes less sense, and compiling it out has the plus of it not being available from a security PoV.

I don't think so, since we rely on the shell to run the commands in the menu.

    This provides for a flexible menu system which we can enter and exit.
    See qcom-phone.env in patch 1 for more details.


This over all sounds like a good way forward.

    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.


Can we make that generic phone?

The techniques described in the doc may apply to non-Qualcomm hardware, but I have no experience with it, and I know that a lot of the things I describe are Qualcomm specific. For example under what situations a Qualcomm device is likely to hang and/or reset itself, as well the framebuffer.


I have both of the pinephones, I can likely try this id there's no specific qcom-isms, or if there's specific features I need to be aware of I can see what they're missing at least.

You could surely write a similar env file for the pinephone with a boot menu based on the same logic, I don't think that would be a lot of effort.

    ---
    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/20241004-qcom-phones-
    [email protected] <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/20240831-qcom-phones-
    [email protected] <https://lore.kernel.org/r/20240831-
    [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]
    <mailto:[email protected]>>


--
Caleb (they/them)

Reply via email to