From 5b4d08230b180fccc911026212af09f9fd360e96 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 6 Dec 2022 20:37:01 +0000 Subject: [PATCH 1/2] xtensa-build-zephyr.py: do not CMake-reconfigure rimage every time It's pointless and hardcodes the CMake generator. Also remove wrong comment added in commit 6cba64d2cbe3 ("xtensa-build-zephyr.py: fix a few minor pylint warnings") The rimage part of the comment was flat out wrong. The smex part of the comment is correct but in the wrong place. Signed-off-by: Marc Herbert --- scripts/xtensa-build-zephyr.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 1abb64d7d20f..694aa2467621 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -586,8 +586,6 @@ def build_platforms(): else: # unknown failure raise cpe - # Building smex and rimage once per platform is a small waste of time - # but it saves a lot of code in this script. smex_executable = pathlib.Path(west_top, platform_build_dir_name, "zephyr", "smex_ep", "build", "smex") fw_ldc_file = pathlib.Path(sof_platform_output_dir, f"sof-{platform}.ldc") @@ -614,10 +612,11 @@ def build_platforms(): Move non-west {nested_rimage} out of west workspace {west_top}. See output of 'west list'.""" ) - - execute_command(["cmake", "-B", rimage_dir_name, "-S", str(rimage_source_dir)], - cwd=west_top) # CMake build rimage module + if not (pathlib.Path(west_top) / rimage_dir_name / "CMakeCache.txt").is_file(): + execute_command(["cmake", "-B", rimage_dir_name, + "-S", str(rimage_source_dir)], + cwd=west_top) rimage_build_cmd = ["cmake", "--build", rimage_dir_name] if args.jobs is not None: rimage_build_cmd.append(f"-j{args.jobs}") From 2a2de8c7becbd9831e5f780905e1743e87edfaee Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 6 Dec 2022 20:47:20 +0000 Subject: [PATCH 2/2] xtensa-build-zephyr.py: build rimage with -GNinja by default This saves a couple seconds when building from scratch on Linux. On Linux the default CMake generator is "Makefiles" which is _not_ parallel by default. Thanks to the previous commit it's still possible to manually switch to "Makefiles" if desired. Signed-off-by: Marc Herbert --- scripts/xtensa-build-zephyr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 694aa2467621..c193dbd794c3 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -614,7 +614,7 @@ def build_platforms(): ) # CMake build rimage module if not (pathlib.Path(west_top) / rimage_dir_name / "CMakeCache.txt").is_file(): - execute_command(["cmake", "-B", rimage_dir_name, + execute_command(["cmake", "-B", rimage_dir_name, "-G", "Ninja", "-S", str(rimage_source_dir)], cwd=west_top) rimage_build_cmd = ["cmake", "--build", rimage_dir_name]