Skip to content

Commit

Permalink
xtensa-build-zephyr.py: add flexibility to generate tools/ only
Browse files Browse the repository at this point in the history
Installing most of the tools/ directory does not technically require
building any platform, so add that possibility.

This is useful because the Jenkins-based CI builds the (userspace) tools
separately. So far it has been picking hardcoded source paths but of
course the HWMv2 transition just broke that:
#8913

While it's too late this time (we want to keep CI able to test stable
branches for some time), this commit prepares a future where all CIs can
stop hardcoding Zephyr source paths and pick the output of the
xtensa-build-zephyr.py installer and indirection layer instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb authored and kv2019i committed Apr 22, 2024
1 parent 06869cb commit 665817f
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def parse_args():
parser.add_argument("-a", "--all", required=False, action="store_true",
help="Build all currently supported platforms")
parser.add_argument("platforms", nargs="*", action=validate_platforms_arguments,
help="List of platforms to build")
help="List of platforms to build. Zero platform + any flag (-p) still creates 'tools/'")
parser.add_argument("-d", "--debug", required=False, action="store_true",
help="Shortcut for: -o sof/app/debug_overlay.conf")
# NO SOF release will ever user the option --fw-naming.
Expand Down Expand Up @@ -727,6 +727,8 @@ def build_platforms():
# smex does not use 'install -D'
sof_output_dir = pathlib.Path(STAGING_DIR, "sof")
sof_output_dir.mkdir(parents=True, exist_ok=True)

platform_build_dir_name = None
for platform in args.platforms:
platf_build_environ = os.environ.copy()

Expand Down Expand Up @@ -870,19 +872,20 @@ def build_platforms():
install_platform(platform, sof_platform_output_dir, platf_build_environ)

src_dest_list = []

# Install sof-logger
sof_logger_dir = pathlib.Path(west_top, platform_build_dir_name, "zephyr",
"sof-logger_ep", "build", "logger")
sof_logger_executable_to_copy = pathlib.Path(shutil.which("sof-logger", path=sof_logger_dir))
tools_output_dir = pathlib.Path(STAGING_DIR, "tools")
sof_logger_installed_file = pathlib.Path(tools_output_dir, sof_logger_executable_to_copy.name).resolve()

src_dest_list += [(sof_logger_executable_to_copy, sof_logger_installed_file)]
# Install sof-logger from the last platform built (requires building at least one platform).
if platform_build_dir_name:
sof_logger_dir = pathlib.Path(west_top, platform_build_dir_name, "zephyr",
"sof-logger_ep", "build", "logger")
sof_logger_executable_to_copy = pathlib.Path(shutil.which("sof-logger", path=sof_logger_dir))
sof_logger_installed_file = pathlib.Path(tools_output_dir, sof_logger_executable_to_copy.name).resolve()

src_dest_list += [(sof_logger_executable_to_copy, sof_logger_installed_file)]

src_dest_list += [(pathlib.Path(SOF_TOP) /
"tools" / "mtrace"/ "mtrace-reader.py",
tools_output_dir)]
tools_output_dir / "mtrace-reader.py")]

# Append future files to `src_dest_list` here (but prefer
# copying entire directories; more flexible)
Expand Down Expand Up @@ -1109,10 +1112,9 @@ def main():
west_update()
create_zephyr_sof_symlink()

if args.platforms:
build_rimage()
build_platforms()
show_installed_files()
build_rimage()
build_platforms()
show_installed_files()

if __name__ == "__main__":
main()

0 comments on commit 665817f

Please sign in to comment.