Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtensa-build-zephyr.py: add flexibility to generate tools/ only #8916

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1104,10 +1107,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()
Loading