Skip to content

Commit

Permalink
xtensa-build-zephyr.py: create /lib/firmware tarball
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kv2019i committed Aug 13, 2024
1 parent 118cf46 commit 4b93dc4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import argparse
import shlex
import shutil
import subprocess
import pathlib
import errno
Expand Down Expand Up @@ -1169,6 +1170,32 @@ 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')
# special case when build script is called for a single
# target only
if len(args.platforms) == 1:
tarball_name = f'sof-%s.tar.gz' % args.platforms[0]
else:
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()
Expand All @@ -1190,7 +1217,9 @@ def main():

build_rimage()
build_platforms()
create_firmware_bundle()
show_installed_files()


if __name__ == "__main__":
main()

0 comments on commit 4b93dc4

Please sign in to comment.