Skip to contentSkip to conversation

tools: qcom: mkmbn: Updates to support ipq5210

PATCH RESEND Superseded Varadarajan Narayanan 1 participant 5 messages Oct 5

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover tools: qcom: mkmbn: Updates to support ipq5210

As part of adding Qualcomm ipq5210 SoC U-Boot SPL & U-Boot proper support, the mkmbn script has to be upgraded to create images that can be used in the ipq5210 SoC.

These changes are to address the feedback in the 'Qualcomm IPQ5210 SoC bringup' series [1] to use mkbn.

1 - https://lore.kernel.org/u-boot/[email protected]/

While at it, fix the MBN version number for ipq5424.

---
Changes in v3:
- Fix review comments
- Add CONFIG_QCOM_GENERATE_MBN to qcom_sm8550_defconfig
- Remove load address from MbnData and for all entries in boards table
- Remove '--melf' option and modify the 'bin' argument to take multiple files for combining into multi-elf.
- '--melf' was actually not removed in v2, but included in revision
history. Apologies for the mistake.
- Link to v2: https://lore.kernel.org/r/[email protected]

v2:
- Remove 'load address' from MbnData and get it from .config
- Add qcom_sm8550_defconfig
- Use 4K alignment for padding the MBN images
- Remove '--melfs' option and make them positional
Link for v1: https://lore.kernel.org/u-boot/[email protected]/

---
Varadarajan Narayanan (4):
tools: qcom: mkmbn: Fix ipq5424 MBN version
configs: add qcom_sm8550_defconfig and debug fragment
tools: qcom: mkmbn: Add support for ipq5210
tools: qcom: mkmbn: Add support to create multi-elf

 board/qualcomm/config.mk      |  2 +-
 configs/qcom_sm8550_defconfig | 16 ++++++++
 tools/qcom/mkmbn/mkmbn.py     | 85 +++++++++++++++++++++++++++++--------------
 3 files changed, 74 insertions(+), 29 deletions(-)

---
base-commit: 914dd2f5d18a3a89e4ddb6d1d97b2743618ae5ee
change-id: 20260714-ipq5210-52e1da5af9fc

Best regards,

Signature · 1 line
Varadarajan Narayanan <[email protected]>
#1 lore raw

PATCH RESEND v3 1/4 tools: qcom: mkmbn: Fix ipq5424 MBN version

Since ipq5424 uses MBN version 7, update the ipq5424 entry in the 'boards' table accordingly.

---
 tools/qcom/mkmbn/mkmbn.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/qcom/mkmbn/mkmbn.py +1 -1
index e4484b539b0..8d2078acc30 100755
@@ -85,7 +85,7 @@ boards: dict[bytes, MbnData] = {
     b"qcom,sm8550\0": MbnData(0xA7000000, 7, SwId.uefi),  # C8550
     b"qcom,sm8650\0": MbnData(0xA7000000, 7, SwId.uefi),  # SM8650
     b"qcom,qcs615\0": MbnData(0x9FC00000, 6, SwId.uefi),  # Dragonwing IQ6
-    b"qcom,ipq5424\0": MbnData(0x8a380000, 6, SwId.aboot),
+    b"qcom,ipq5424\0": MbnData(0x8a380000, 7, SwId.aboot),
     b"qcom,ipq9574\0": MbnData(0x4A240000, 6, SwId.aboot),
 
     # msm8916/apq8016 has an "aboot" partition but the process is the same
Signature · 1 line
2.34.1
#2 lore raw

PATCH RESEND v3 2/4 configs: add qcom_sm8550_defconfig and debug fragment

In reply to Varadarajan Narayanan

Add a defconfig for running on sm8550 as the first stage bootloader and associated debug config fragment.

---
 configs/qcom_sm8550_defconfig | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
configs/qcom_sm8550_defconfig new file +16 -0
new file mode 100644
index 00000000000..40f7c857007
@@ -0,0 +1,16 @@
+# Configuration for building U-Boot to be flashed
+# to the uefi partition of QCM6490 dev boards with
+# the "Linux Embedded" partition layout (which have
+# a dedicated "uefi" partition for edk2/U-Boot)
+
+#include "qcom_defconfig"
+
+# Otherwise buildman thinks this isn't an ARM platform
+CONFIG_ARM=y
+
+# Address where U-Boot will be loaded
+CONFIG_TEXT_BASE=0xa7000000
+CONFIG_REMAKE_ELF=y
+
+CONFIG_DEFAULT_DEVICE_TREE="qcom/sm8550-hdk"
+CONFIG_QCOM_GENERATE_MBN=y
Signature · 1 line
2.34.1
#3 lore raw

PATCH RESEND v3 3/4 tools: qcom: mkmbn: Add support for ipq5210

In reply to Varadarajan Narayanan

- Add ipq5210 entry to the 'boards' table
- Add an argument to specify the U-Boot Proper/SPL load address and drop it from MbnData
- ipq5210's boot rom expects the SPL image size to be 4-byte aligned. Enable the mkmbn script to pad the image to 4K.

---
 board/qualcomm/config.mk  |  2 +-
 tools/qcom/mkmbn/mkmbn.py | 63 ++++++++++++++++++++++++++++-------------------
 2 files changed, 38 insertions(+), 27 deletions(-)
board/qualcomm/config.mk +1 -1
index 769e4a51ca0..dd61ffd98e8 100644
@@ -8,7 +8,7 @@
 # Create Qualcomm signed elf images
 CMD_MKMBN = $(srctree)/tools/qcom/mkmbn/mkmbn.py
 quiet_cmd_mkmbn = MBN     $@
-      cmd_mkmbn = $(CMD_MKMBN) $<
+      cmd_mkmbn = $(CMD_MKMBN) -l $(CONFIG_TEXT_BASE) $<
 
 u-boot.mbn: u-boot.bin FORCE
 	$(call if_changed,mkmbn)
tools/qcom/mkmbn/mkmbn.py +37 -26

101 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

PATCH RESEND v3 4/4 tools: qcom: mkmbn: Add support to create multi-elf

In reply to Varadarajan Narayanan

Modify the 'bin' argument to take either a single file to convert to MBN, or a list of files to be combined to create a multi-elf expected by the boot rom.

---
 tools/qcom/mkmbn/mkmbn.py | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
tools/qcom/mkmbn/mkmbn.py +20 -2
index da4d45b600a..8af268a2d8a 100755
@@ -110,14 +110,32 @@ parser.add_argument(
     "-v", dest="verbose", action="store_true", default=False, help="Verbose"
 )
 parser.add_argument(
-    "bin", type=argparse.FileType("rb"), help="Binary to embed (e.g. u-boot.bin)"
+    "bin", nargs = '+', type=argparse.FileType("rb"),
+    help="One or more binaries to embed (e.g. u-boot.bin) or create multi-elf"
 )
 args = parser.parse_args()
 verbose = args.verbose
 
+if (len(args.bin) > 1):		# Create multi-elf
+    try:
+        with open(args.output, "wb") as f:
+            for path in args.bin:
+                with open(path, 'rb') as tmp:
+                    f.write(tmp.read())
+    except Exception as e:
+        print(f"Error: {e}")
+        sys.exit(1)
+
+    sys.exit(0)
+
 elf = Elf()
 
-data: bytes = args.bin.read()
+if args.bin:
+    data: bytes = args.bin[0].read()
+else:
+    print(f"Specify the binary to convert to MBN")
+    sys.exit(1)
+
 
 # dtb is at the end, so find the last match
 dtb_off = 0
Signature · 1 line
2.34.1