Re: [PATCH 3/3] tools: qcom: mkmbn: Add support to create multi-elf

Casey Connolly <[email protected]> Mon, 20 Jul 2026 14:27:59 +0100
Newsgroups de.denx.lists.u-boot
Message-ID <[email protected]>

On 7/14/26 10:52, Varadarajan Narayanan wrote:
> Add a command line argument to take a list of files to be combined to create a
> multi-elf expected by the boot rom.
> 
> Signed-off-by: Varadarajan Narayanan <[email protected]>
> ---
>   tools/qcom/mkmbn/mkmbn.py | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/tools/qcom/mkmbn/mkmbn.py b/tools/qcom/mkmbn/mkmbn.py
> index 46edbcafb32..a2df1433129 100755
> --- a/tools/qcom/mkmbn/mkmbn.py
> +++ b/tools/qcom/mkmbn/mkmbn.py
> @@ -104,6 +104,9 @@ 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(
> +    "-m", "--melfs", nargs='+', default=[], help="List of ELFs to include in multi-elf"
> +)

Let's just make this positional after "bin", I don't think there's 
anything else we could expect to go here.

Thanks,
Casey

>   parser.add_argument(
>       "-o", "--output", type=Path, default="u-boot.mbn", help="Output file"
>   )
> @@ -119,6 +122,18 @@ parser.add_argument(
>   args = parser.parse_args()
>   verbose = args.verbose
>   
> +if (len(args.melfs)):
> +    try:
> +        with open(args.output, "wb") as f:
> +            for path in args.melfs:
> +                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()
>