xtensa-build-zephyr.py: stop calling west sign, rely on west build

Stop invoking west sign manually. Configure rimage using `west config`
and a platform-specific WEST_CONFIG_LOCAL file instead, then rely on
west build to invoke rimage.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2023-05-12 01:17:04 +00:00 committed by Kai Vehmanen
parent 5a82b0ab53
commit a769d3941d
1 changed files with 10 additions and 23 deletions

View File

@ -577,21 +577,6 @@ def build_rimage():
execute_command(rimage_build_cmd, cwd=west_top) execute_command(rimage_build_cmd, cwd=west_top)
def rimage_configuration(platform_dict):
sign_cmd = []
rimage_executable = shutil.which("rimage", path=RIMAGE_BUILD_DIR)
sign_cmd += ["--tool-path", rimage_executable, "--"]
# Flatten the list of [ ( "-o", "value" ), ...] tuples
for t in rimage_options(platform_dict):
sign_cmd += t
return sign_cmd
def rimage_options(platform_dict): def rimage_options(platform_dict):
"""Return a list of default rimage options as a list of tuples, """Return a list of default rimage options as a list of tuples,
example: [ (-f, 2.5.0), (-b, 1), (-k, key.pem),... ] example: [ (-f, 2.5.0), (-b, 1), (-k, key.pem),... ]
@ -599,6 +584,9 @@ def rimage_options(platform_dict):
""" """
opts = [] opts = []
if args.verbose > 0:
opts.append(("-v",) * args.verbose)
signing_key = "" signing_key = ""
if args.key: if args.key:
signing_key = args.key signing_key = args.key
@ -744,13 +732,15 @@ def build_platforms():
see https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments see https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
Try "west config build.cmake-args -- ..." instead.""") Try "west config build.cmake-args -- ..." instead.""")
sign_cmd = ["west"] platf_build_environ['WEST_CONFIG_LOCAL'] = str(rimage_west_configuration(
sign_cmd += ["-v"] * args.verbose platform_dict,
sign_cmd += ["sign", "--build-dir", platform_build_dir_name, "--tool", "rimage"] STAGING_DIR / "sof-info" / platform
sign_cmd += rimage_configuration(platform_dict) ))
# Make sure the build logs don't leave anything hidden # Make sure the build logs don't leave anything hidden
execute_command(['west', 'config', '-l'], cwd=west_top) execute_command(['west', 'config', '-l'], cwd=west_top,
env=platf_build_environ, sof_log_env=True)
print()
# Build # Build
try: try:
@ -769,9 +759,6 @@ def build_platforms():
# Extract metadata # Extract metadata
execute_command([str(smex_executable), "-l", str(fw_ldc_file), str(input_elf_file)]) execute_command([str(smex_executable), "-l", str(fw_ldc_file), str(input_elf_file)])
# Sign firmware
execute_command(sign_cmd, cwd=west_top)
if platform not in RI_INFO_UNSUPPORTED: if platform not in RI_INFO_UNSUPPORTED:
reproducible_checksum(platform, west_top / platform_build_dir_name / "zephyr" / "zephyr.ri") reproducible_checksum(platform, west_top / platform_build_dir_name / "zephyr" / "zephyr.ri")