- Add ipq5210 entry to the 'boards' table
- Add an argument to specify the SPL load address
- ipq5210's boot rom expects the SPL image size to be 4-byte aligned. To
  support this add an argument to specify the image size alignment to
  enable the mkmbn script to pad the image accordingly.

Signed-off-by: Varadarajan Narayanan <[email protected]>
---
 tools/qcom/mkmbn/mkmbn.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/qcom/mkmbn/mkmbn.py b/tools/qcom/mkmbn/mkmbn.py
index 8d2078acc30..46edbcafb32 100755
--- a/tools/qcom/mkmbn/mkmbn.py
+++ b/tools/qcom/mkmbn/mkmbn.py
@@ -85,6 +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,ipq5210\0": MbnData(0x87980000, 7, SwId.aboot),
     b"qcom,ipq5424\0": MbnData(0x8a380000, 7, SwId.aboot),
     b"qcom,ipq9574\0": MbnData(0x4A240000, 6, SwId.aboot),
 
@@ -100,9 +101,15 @@ parser = argparse.ArgumentParser(
 """
 )
 parser.register("type", "hex", lambda s: int(s, 16))
+parser.add_argument(
+    "-l", "--load", type=lambda x: int(x, 0), default=0, help="Load address"
+)
 parser.add_argument(
     "-o", "--output", type=Path, default="u-boot.mbn", help="Output file"
 )
+parser.add_argument(
+    "-s", "--szalign", type=int, default=0, help="Size alignment"
+)
 parser.add_argument(
     "-v", dest="verbose", action="store_true", default=False, help="Verbose"
 )
@@ -149,8 +156,15 @@ if not mbn:
     args.output.unlink(missing_ok=True)
     exit(1)
 
+if args.load != 0:
+       print("Using load address from command line: %s" % hex(args.load))
+       mbn.loadaddr = args.load
+
 log(f"Detected board {match.decode('UTF-8')} with load address 
{mbn.loadaddr:#x}")
 
+if args.szalign != 0:
+       data += b'\x00' * (-len(data) % args.szalign)
+
 elf.phdrs.append(Phdr.from_bin(data, mbn.loadaddr))
 elf.ehdr.e_entry = mbn.loadaddr
 elf.update()

-- 
2.34.1

Reply via email to