From b625441f039417fc8a9ce13c03c7959e204026a5 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 4 Sep 2024 06:29:04 +0000 Subject: [PATCH] xtensa-build-zephyr.py: cosmetic: rename "overlays" variable The Zephyr documentation uses the term "overlay" for Device Tree, not for Kconfig. This commit does not change the wrongly named --overlay option not to break anything but it stops that wrong name from leaking all over the code. Also tweak the --help text. Signed-off-by: Marc Herbert --- app/configs/fuzz_features.conf | 2 ++ scripts/xtensa-build-zephyr.py | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/configs/fuzz_features.conf b/app/configs/fuzz_features.conf index c815b42a4cb1..0a2efca0a1b8 100644 --- a/app/configs/fuzz_features.conf +++ b/app/configs/fuzz_features.conf @@ -14,6 +14,8 @@ # generations. Something like config fragments including each other? Not something as # complicated as Yocto fragments but something more flexible than # https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf +# Or maybe use "snippets"? +# https://docs.zephyrproject.org/latest/build/snippets/writing.html # # Discuss in https://github.com/thesofproject/sof/issues/9386 diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 531cb58655a0..9cffe4a0cb82 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -260,10 +260,13 @@ def parse_args(): # https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf # https://docs.zephyrproject.org/latest/develop/application/index.html#important-build-system-variables + # TODO, support "snippets"? + # https://docs.zephyrproject.org/latest/build/snippets/writing.html parser.add_argument("-o", "--overlay", type=pathlib.Path, required=False, action='append', default=[], help= """All '-o arg1 -o arg2 ...' arguments are combined into a single -DEXTRA_CONF_FILE='arg1;arg2;...' -list. Files latter in the list seem to have precedence. Direct -C=-DCONFIG_xxx=.. options seem to +list. This tweaks the build CONFIGuration like Device Tree "overlays" do. +Files latter in the list seem to have precedence. Direct -C=-DCONFIG_xxx=.. options seem to have precedence over -DEXTRA_CONF_FILE=... Rely on precedence as little as possible.""") parser.add_argument("-p", "--pristine", required=False, action="store_true", @@ -827,21 +830,21 @@ def build_platforms(): if args.cmake_args: build_cmd += args.cmake_args - overlays = [str(item.resolve(True)) for item in args.overlay] + extra_conf_files = [str(item.resolve(True)) for item in args.overlay] # The '-d' option is a shortcut for '-o path_to_debug_overlay', we are good # if both are provided, because it's no harm to merge the same overlay twice. if args.debug: - overlays.append(str(pathlib.Path(SOF_TOP, "app", "debug_overlay.conf"))) + extra_conf_files.append(str(pathlib.Path(SOF_TOP, "app", "debug_overlay.conf"))) # The xt-cland Cadence toolchain currently cannot link shared # libraries for Xtensa. Therefore when it's used we switch to # building relocatable ELF objects. if platf_build_environ.get("ZEPHYR_TOOLCHAIN_VARIANT") == 'xt-clang': - overlays.append(str(pathlib.Path(SOF_TOP, "app", "llext_relocatable.conf"))) + extra_conf_files.append(str(pathlib.Path(SOF_TOP, "app", "llext_relocatable.conf"))) - if overlays: - overlays = ";".join(overlays) - build_cmd.append(f"-DEXTRA_CONF_FILE={overlays}") + if extra_conf_files: + extra_conf_files = ";".join(extra_conf_files) + build_cmd.append(f"-DEXTRA_CONF_FILE={extra_conf_files}") abs_build_dir = pathlib.Path(west_top, platform_build_dir_name) @@ -850,9 +853,9 @@ def build_platforms(): pathlib.Path(abs_build_dir, "build.ninja").is_file() or pathlib.Path(abs_build_dir, "Makefile").is_file() ): - if args.cmake_args or overlays: + if args.cmake_args or extra_conf_files: warnings.warn("""CMake args slow down incremental builds. - Passing CMake parameters and overlays on the command line slows down incremental builds + Passing CMake parameters and -o conf files on the command line slows down incremental builds see https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments Try "west config build.cmake-args -- ..." instead.""")