From 2bb5b01273a36455cf2965edac1255c0c9d101f8 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Mon, 12 Aug 2024 17:05:38 +0300 Subject: [PATCH] xtensa-build-zephyr.py: create /lib/firmware tarball With addition of loadable modules, SOF firmware installation depends much more on symbolic links. Add a step to build script to create a tarball of the installed firmware binaries in the build-staging-sof tree. The created tarball (build-sof-staging/sof/sof.tar.gz) provides a ready structure that can be unpacked to e.g. /lib/firmware on Linux target machines. Signed-off-by: Kai Vehmanen --- scripts/xtensa-build-zephyr.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 531cb58655a0..922efa904364 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -25,6 +25,7 @@ import argparse import shlex +import shutil import subprocess import pathlib import errno @@ -1169,6 +1170,27 @@ def reproducible_checksum(platform, ri_file): chk256 = sof_ri_info.EraseVariables(ri_file, parsed_ri, west_top / repro_output) print('sha256sum {0}\n{1} {0}'.format(repro_output, chk256)) +def create_firmware_bundle(): + if shutil.which('tar') is None: + print("tar tool not found, not creating firmware tarball") + return + + # vendor directories (typically under /lib/firmware) to include + # in the tarball + vendor_dirs = [ 'intel'] + + build_top = pathlib.Path(west_top, 'build-sof-staging', 'sof') + tarball_name = 'sof.tar.gz' + + if args.pristine: + tarball = build_top / tarball_name + tarball.unlink(missing_ok = True) + + for vendor_dir in vendor_dirs: + vendor_dir_path = build_top / vendor_dir + if not vendor_dir_path.exists(): + continue + execute_command(['tar', 'zc', '--exclude=sof.tar.gz', '-f', tarball_name, vendor_dir], cwd=build_top, sof_log_env=True) def main(): parse_args() @@ -1190,7 +1212,9 @@ def main(): build_rimage() build_platforms() + create_firmware_bundle() show_installed_files() + if __name__ == "__main__": main()