Skip to content

Commit adce544

Browse files
marc-hbkv2019i
authored andcommitted
xtensa-build-zephyr.py: simplify installation, prepare for more files
Simplify the final installation code to prepare for installing more files. Zero functional change. Notably perform the cavs naming trick inside the build directory first which allows using a destination directory instead of a destination file. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent ab7c1a2 commit adce544

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

‎scripts/xtensa-build-zephyr.py‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -591,21 +591,27 @@ def build_platforms():
591591

592592
execute_command(sign_cmd, cwd=west_top)
593593

594-
# Install by copy
594+
595+
# Install to STAGING_DIR
596+
abs_build_dir = pathlib.Path(west_top) / platform_build_dir_name / "zephyr"
597+
595598
if args.fw_naming == "AVS":
599+
# Disguise ourselves for local testing purposes
596600
output_fwname="dsp_basefw.bin"
597601
else:
602+
# Regular name
598603
output_fwname="".join(["sof-", platform, ".ri"])
599-
fw_file_to_copy = pathlib.Path(west_top, platform_build_dir_name, "zephyr", "zephyr.ri")
600-
if args.key_type_subdir == "none":
601-
fw_file_installed = pathlib.Path(sof_platform_output_dir,
602-
f"{output_fwname}")
603-
else:
604-
fw_file_installed = pathlib.Path(sof_platform_output_dir, args.key_type_subdir,
605-
f"{output_fwname}")
606-
os.makedirs(os.path.dirname(fw_file_installed), exist_ok=True)
604+
605+
shutil.copy2(abs_build_dir / "zephyr.ri", abs_build_dir / output_fwname)
606+
fw_file_to_copy = abs_build_dir / output_fwname
607+
608+
install_key_dir = sof_platform_output_dir
609+
if args.key_type_subdir != "none":
610+
install_key_dir = install_key_dir / args.key_type_subdir
611+
612+
os.makedirs(install_key_dir, exist_ok=True)
607613
# looses file owner and group - file is commonly accessible
608-
shutil.copy2(str(fw_file_to_copy), str(fw_file_installed))
614+
shutil.copy2(fw_file_to_copy, install_key_dir)
609615

610616
src_dest_list = []
611617

0 commit comments

Comments
 (0)