U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
To: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>,
	Sumit Garg <sumit.garg@kernel.org>,
	u-boot-qcom@groups.io, u-boot@lists.u-boot-project.org
Cc: Casey Connolly <casey.connolly@linaro.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2 3/4] tools: qcom: mkmbn: Add support for ipq5210
Date: Fri, 11 Sep 2026 10:29:47 +0530	[thread overview]
Message-ID: <feceed65-1ad2-41a8-b533-235d372ce99f@oss.qualcomm.com> (raw)
In-Reply-To: <20260910-ipq5210-v2-3-d209f7dc0fc5@oss.qualcomm.com>

Hi Varadarajan,

On 9/10/2026 3:59 PM, Varadarajan Narayanan wrote:
> - 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 <varadarajan.narayanan@oss.qualcomm.com>
> ---
>   board/qualcomm/config.mk  |  2 +-
>   tools/qcom/mkmbn/mkmbn.py | 34 ++++++++++++++++++++++++----------
>   2 files changed, 25 insertions(+), 11 deletions(-)
>
> diff --git a/board/qualcomm/config.mk b/board/qualcomm/config.mk
> index 769e4a51ca0..dd61ffd98e8 100644
> --- a/board/qualcomm/config.mk
> +++ b/board/qualcomm/config.mk
> @@ -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)
> diff --git a/tools/qcom/mkmbn/mkmbn.py b/tools/qcom/mkmbn/mkmbn.py
> index 8d2078acc30..6fe66fc4e55 100755
> --- a/tools/qcom/mkmbn/mkmbn.py
> +++ b/tools/qcom/mkmbn/mkmbn.py
> @@ -18,6 +18,8 @@ import sys
>   from enum import Enum
>   import struct
>   
> +MBN_ALIGN_SIZE = 4096
> +
>   verbose = False
>   
>   def log(*args, **kwargs):
> @@ -63,19 +65,17 @@ class MbnData:
>   
>   
>   """
> -This dictionary is used to map a board or platform to the appropriate load address and
> -other MBN metadata. When adding support for a new platform to U-Boot, the appropriate
> -data should be filled out here. The load address can typically be determined by looking
> -at the uefi.elf or xbl.elf for the platform. For the uefi.elf it is the load address, and
> -for xbl.elf it is typically the RWX section in the middle, just BEFORE the section loaded
> -at 0x1495xxxx or similar. Looking at similar platforms in the table below may help.
> +This dictionary is used to map a board or platform to the appropriate MBN
> +metadata. When adding support for a new platform to U-Boot, the appropriate data
> +should be filled out here. Looking at similar platforms in the table below may
> +help.
>   """
>   boards: dict[bytes, MbnData] = {
>       # Exact matches for boards, these are preferred
> -    b"qcom,qcs6490-rb3gen2\0": MbnData(0x9FC00000, 6, SwId.uefi),
> -    b"qcom,qcs9100-ride-r3\0": MbnData(0xAF000000, 6, SwId.uefi),  # Dragonwing IQ9
> -    b"qcom,qcs8300-ride\0": MbnData(0xAF000000, 6, SwId.uefi),  # Dragonwing IQ8
> -    b"qcom,qcs615-ride\0": MbnData(0x9FC00000, 6, SwId.uefi),  # Dragonwing IQ6
> +    b"qcom,qcs6490-rb3gen2\0": MbnData(6, SwId.uefi),
> +    b"qcom,qcs9100-ride-r3\0": MbnData(6, SwId.uefi),  # Dragonwing IQ9
> +    b"qcom,qcs8300-ride\0": MbnData(6, SwId.uefi),  # Dragonwing IQ8
> +    b"qcom,qcs615-ride\0": MbnData(6, SwId.uefi),  # Dragonwing IQ6
>       # Fallback/generic matches since most boards for a platform will
>       # use the same load address
>       b"qcom,qcm6490\0": MbnData(0x9FC00000, 6, SwId.uefi),  # rb3gen2, rubikpi3
> @@ -85,6 +85,7 @@ boards: dict[bytes, MbnData] = {
>       b"qcom,sm8550\0": MbnData(0xA7000000, 7, SwId.uefi),  # C8550

Can't we remove the load address from MbnData for non-IQ targets also? 
Pls tell if i miss anything.

Regards,

Balaji

>       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,6 +101,9 @@ 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"
>   )
> @@ -149,8 +153,18 @@ if not mbn:
>       args.output.unlink(missing_ok=True)
>       exit(1)
>   
> +if args.load == 0:
> +    error(
> +        "Cannot proceed without load address.\n"
> +        "Ensure CONFIG_TEXT_BASE/CONFIG_SPL_TEXT_BASE is set\n")
> +    exit(1)
> +else:
> +    mbn.loadaddr = args.load
> +
>   log(f"Detected board {match.decode('UTF-8')} with load address {mbn.loadaddr:#x}")
>   
> +data += b'\x00' * (-len(data) % MBN_ALIGN_SIZE)
> +
>   elf.phdrs.append(Phdr.from_bin(data, mbn.loadaddr))
>   elf.ehdr.e_entry = mbn.loadaddr
>   elf.update()
>

  reply	other threads:[~2026-09-11  5:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 10:29 [PATCH v2 0/4] tools: qcom: mkmbn: Updates to support ipq5210 Varadarajan Narayanan
2026-09-10 10:29 ` [PATCH v2 1/4] tools: qcom: mkmbn: Fix ipq5424 MBN version Varadarajan Narayanan
2026-09-10 10:29 ` [PATCH v2 2/4] configs: add qcom_sm8550_defconfig and debug fragment Varadarajan Narayanan
2026-09-10 13:17   ` Casey Connolly
2026-09-10 10:29 ` [PATCH v2 3/4] tools: qcom: mkmbn: Add support for ipq5210 Varadarajan Narayanan
2026-09-11  4:59   ` Balaji Selvanathan [this message]
2026-09-10 10:29 ` [PATCH v2 4/4] tools: qcom: mkmbn: Add support to create multi-elf Varadarajan Narayanan
2026-09-11  5:37   ` Balaji Selvanathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=feceed65-1ad2-41a8-b533-235d372ce99f@oss.qualcomm.com \
    --to=balaji.selvanathan@oss.qualcomm.com \
    --cc=casey.connolly@linaro.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sumit.garg@kernel.org \
    --cc=trini@konsulko.com \
    --cc=u-boot-qcom@groups.io \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=varadarajan.narayanan@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox