Skip to content

Commit 82c5f54

Browse files
andyrosskartben
authored andcommitted
scripts/west/sign: Auto-detect rimage ELF files
This code had a growing "enumerate all the platforms" wart. In point of fact only intel_adsp is special here. Other rimage platforms don't have a bootloader and use zephyr.elf directly. Don't hard code platform names (especially since they aren't the same as board/soc names!). Just autodetect which scheme we have at runtime. Signed-off-by: Andy Ross <[email protected]>
1 parent b07a097 commit 82c5f54

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

scripts/west_commands/sign.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -469,19 +469,19 @@ def sign(self, command, build_dir, build_conf, formats):
469469

470470
kernel_name = build_conf.get('CONFIG_KERNEL_BIN_NAME', 'zephyr')
471471

472-
# TODO: make this a new sign.py --bootloader option.
473-
if target in ('imx8', 'imx8m', 'imx8ulp', 'imx95', 'rmb'):
474-
bootloader = None
475-
kernel = str(b / 'zephyr' / f'{kernel_name}.elf')
476-
out_bin = str(b / 'zephyr' / f'{kernel_name}.ri')
477-
out_xman = str(b / 'zephyr' / f'{kernel_name}.ri.xman')
478-
out_tmp = str(b / 'zephyr' / f'{kernel_name}.rix')
479-
else:
472+
bootloader = None
473+
kernel = str(b / 'zephyr' / f'{kernel_name}.elf')
474+
out_bin = str(b / 'zephyr' / f'{kernel_name}.ri')
475+
out_xman = str(b / 'zephyr' / f'{kernel_name}.ri.xman')
476+
out_tmp = str(b / 'zephyr' / f'{kernel_name}.rix')
477+
478+
# Intel platforms generate a "boot.mod" and "main.mod" as
479+
# separate intermediates to use. Other platforms just use
480+
# zephyr.elf directly.
481+
if os.path.exists(str(b / 'zephyr' / 'boot.mod')):
480482
bootloader = str(b / 'zephyr' / 'boot.mod')
483+
if os.path.exists(str(b / 'zephyr' / 'main.mod')):
481484
kernel = str(b / 'zephyr' / 'main.mod')
482-
out_bin = str(b / 'zephyr' / f'{kernel_name}.ri')
483-
out_xman = str(b / 'zephyr' / f'{kernel_name}.ri.xman')
484-
out_tmp = str(b / 'zephyr' / f'{kernel_name}.rix')
485485

486486
# Clean any stale output. This is especially important when using --if-tool-available
487487
# (but not just)

0 commit comments

Comments
 (0)