Currently the build process for flashing U-Boot as the first-stage bootloader on Qualcomm platforms requires a manual step of test-signing the emitted ELF binary with the appropriate settings for it to be properly accepted by the pre-loader.
To address this, let's introduce a new tool "mkmbn.py", this is based on the existing qtestsign[1] tool but introduces lookup table that maps from a boards DT compatible property to the load address it needs. A new config option (QCOM_GENERATE_MBN) is added so that BUILD_TARGET can be set automatically and avoid the need to manually specify the target on the cmdline. The make target is added in board/qualcomm/config.mk with a minor adjustment to the toplevel config.mk to properly check this path. The various platforms which currently rely on manual post-processing with qtestsign are adapted to leverage mkmbn instead. New platforms can be supported just by adding an entry to mkmbn.py with the same data that would otherwise be encoded in the qtestsign cmdline args. The Qualcomm documentation is also cleaned up, a new "signing" page is added to briefly cover the what and why of MBN signing, and board specific pages are updated to explain the new build process. [1]: https://github.com/msm8916-mainline/qtestsign --- Changes in v6: - Drop binman in favour of introducing a make target and associated kconfig infra, this drastically simplifies the tooling. - Various minor fixes/improvements to mkmbn.py - Link to v5: https://lore.kernel.org/r/20250722-b4-qcom-tooling-improvements-v5-0-df143f124...@linaro.org Changes in v5: - Rebase on master (dropped trogdor chromebook series) - Directly import the MBN signing code from qtestsign and then adjust it in a separate commit so it can be updated in the future. - Disable BINMAN_FDT when ARCH_SNAPDRAGON is enabled - Set default value for BINMAN_DTB in mach-snapdragon/Kconfig rather than having to set it in all defconfigs. - Add a comment to the top of mkmbn.py explaining it's purpose. - Link to v4: https://lore.kernel.org/r/20250613-b4-qcom-tooling-improvements-v4-0-7ea1c6877...@linaro.org Changes in v4: - Rework how qtestsign code is imported to make it easier to sync with upstream in the future. - Actually raise an exception when mkmbn fails in an unexpected way. - Link to v3: https://lore.kernel.org/r/20250612-b4-qcom-tooling-improvements-v3-0-76f34cf21...@linaro.org Changes in v3: - Fixup Makefiles and add missing qcom-binman.dts - Adjust wording to reflect changes to build process - Link to v2: https://lore.kernel.org/r/20250602-b4-qcom-tooling-improvements-v2-0-c7d19c0d4...@linaro.org Changes in v2: - Reworked to use binman with a plugin to build the u-boot.mbn file - Added some fixes for binman to work with OF_UPSTREAM and with tools in the srctree toolpath rather than objtree for out of tree builds. - Link to v1: https://lore.kernel.org/r/20250522-b4-qcom-tooling-improvements-v1-0-8141b8955...@linaro.org To: [email protected] To: Sumit Garg <[email protected]> To: [email protected] Cc: Tom Rini <[email protected]> Cc: Casey Connolly <[email protected]> Cc: Neil Armstrong <[email protected]> Cc: Balaji Selvanathan <[email protected]> Cc: Varadarajan Narayanan <[email protected]> Cc: Quentin Schulz <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Peng Fan <[email protected]> Cc: Jaehoon Chung <[email protected]> Cc: Aswin Murugan <[email protected]> Cc: Ilias Apalodimas <[email protected]> Cc: Michal Simek <[email protected]> Cc: David Lechner <[email protected]> --- Casey Connolly (6): config.mk: support vendor generic includes tools: qcom: introduce mkmbn library tools: qcom: add mkmbn.py doc: board/qualcomm: update docs for new u-boot.mbn target mach-snapdragon: add kconfig infra for building MBN files configs: qcom: use mkmbn and stop building ELF files Kconfig | 1 + arch/arm/mach-snapdragon/Kconfig | 11 ++ board/qualcomm/config.mk | 14 ++ config.mk | 6 +- configs/qcm6490_defconfig | 2 +- configs/qcom_ipq9574_mmc_defconfig | 2 +- configs/qcom_qcs615_defconfig | 2 +- configs/qcom_qcs8300_defconfig | 2 +- configs/qcom_qcs9100_defconfig | 2 +- doc/board/qualcomm/dragonwing.rst | 14 +- doc/board/qualcomm/index.rst | 1 + doc/board/qualcomm/rb3gen2.rst | 30 ++-- doc/board/qualcomm/rdp.rst | 5 +- doc/board/qualcomm/signing.rst | 29 +++ tools/mkmbn | 1 + tools/qcom/mkmbn/cert.py | 127 +++++++++++++ tools/qcom/mkmbn/elf.py | 241 +++++++++++++++++++++++++ tools/qcom/mkmbn/hashseg.py | 356 +++++++++++++++++++++++++++++++++++++ tools/qcom/mkmbn/mkmbn.py | 165 +++++++++++++++++ 19 files changed, 977 insertions(+), 34 deletions(-) --- base-commit: bb0f3eebb3c196d9b6efbbd1e5aa9b16abbb9ad6 // Casey (she/they)

