From ce3264a50721b7133e00dc3c6c268df19b169479 Mon Sep 17 00:00:00 2001 From: Andrey Borisovich Date: Mon, 14 Mar 2022 00:29:56 +0100 Subject: [PATCH] platform: Move configuration from Zephyr to SOF Move software configuration from Zephyr samples directory to SOF platforms directory using Zephyr overlay mechanism. How it works: 1. Gets zephyr board defconfig values 2. Applies Zephyr samples prj.conf values on top of it 3. Then applies our new overlay.conf on top of it 4. Final "summary" of Kconfig settings is written to autoconf.h header Signed-off-by: Andrey Borisovich --- overlays/apl/overlay.conf | 7 +++++++ overlays/cnl/overlay.conf | 7 +++++++ overlays/icl/overlay.conf | 6 ++++++ overlays/imx8/overlay.conf | 4 ++++ overlays/imx8m/overlay.conf | 4 ++++ overlays/imx8x/overlay.conf | 4 ++++ overlays/jsl/overlay.conf | 5 +++++ overlays/tgl-h/overlay.conf | 7 +++++++ {platforms => overlays}/tgl/ipc4_overlay.conf | 0 overlays/tgl/overlay.conf | 7 +++++++ scripts/xtensa-build-zephyr.py | 12 ++++++++++-- scripts/xtensa-build-zephyr.sh | 18 +++++++++++++++++- 12 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 overlays/apl/overlay.conf create mode 100644 overlays/cnl/overlay.conf create mode 100644 overlays/icl/overlay.conf create mode 100644 overlays/imx8/overlay.conf create mode 100644 overlays/imx8m/overlay.conf create mode 100644 overlays/imx8x/overlay.conf create mode 100644 overlays/jsl/overlay.conf create mode 100644 overlays/tgl-h/overlay.conf rename {platforms => overlays}/tgl/ipc4_overlay.conf (100%) create mode 100644 overlays/tgl/overlay.conf diff --git a/overlays/apl/overlay.conf b/overlays/apl/overlay.conf new file mode 100644 index 000000000..0e0b12547 --- /dev/null +++ b/overlays/apl/overlay.conf @@ -0,0 +1,7 @@ +CONFIG_APOLLOLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_LP_MEMORY_BANKS=2 +CONFIG_HP_MEMORY_BANKS=8 +CONFIG_PERFORMANCE_COUNTERS=y +CONFIG_COMP_SRC_TINY=y diff --git a/overlays/cnl/overlay.conf b/overlays/cnl/overlay.conf new file mode 100644 index 000000000..a49f550c3 --- /dev/null +++ b/overlays/cnl/overlay.conf @@ -0,0 +1,7 @@ +CONFIG_CANNONLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=47 +CONFIG_PERFORMANCE_COUNTERS=y diff --git a/overlays/icl/overlay.conf b/overlays/icl/overlay.conf new file mode 100644 index 000000000..0f3a659cb --- /dev/null +++ b/overlays/icl/overlay.conf @@ -0,0 +1,6 @@ +CONFIG_ICELAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=47 diff --git a/overlays/imx8/overlay.conf b/overlays/imx8/overlay.conf new file mode 100644 index 000000000..a245738a5 --- /dev/null +++ b/overlays/imx8/overlay.conf @@ -0,0 +1,4 @@ +CONFIG_IMX8=y +CONFIG_HAVE_AGENT=n +CONFIG_FORMAT_CONVERT_HIFI3=n +CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n diff --git a/overlays/imx8m/overlay.conf b/overlays/imx8m/overlay.conf new file mode 100644 index 000000000..bb9d86024 --- /dev/null +++ b/overlays/imx8m/overlay.conf @@ -0,0 +1,4 @@ +CONFIG_IMX8M=y +CONFIG_HAVE_AGENT=n +CONFIG_FORMAT_CONVERT_HIFI3=n +CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n diff --git a/overlays/imx8x/overlay.conf b/overlays/imx8x/overlay.conf new file mode 100644 index 000000000..a7766c19b --- /dev/null +++ b/overlays/imx8x/overlay.conf @@ -0,0 +1,4 @@ +CONFIG_IMX8X=y +CONFIG_HAVE_AGENT=n +CONFIG_FORMAT_CONVERT_HIFI3=n +CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n diff --git a/overlays/jsl/overlay.conf b/overlays/jsl/overlay.conf new file mode 100644 index 000000000..46579f49d --- /dev/null +++ b/overlays/jsl/overlay.conf @@ -0,0 +1,5 @@ +CONFIG_ICELAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=16 diff --git a/overlays/tgl-h/overlay.conf b/overlays/tgl-h/overlay.conf new file mode 100644 index 000000000..7ec23d237 --- /dev/null +++ b/overlays/tgl-h/overlay.conf @@ -0,0 +1,7 @@ +CONFIG_TIGERLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=30 +CONFIG_RIMAGE_SIGNING_SCHEMA="tgl-h" diff --git a/platforms/tgl/ipc4_overlay.conf b/overlays/tgl/ipc4_overlay.conf similarity index 100% rename from platforms/tgl/ipc4_overlay.conf rename to overlays/tgl/ipc4_overlay.conf diff --git a/overlays/tgl/overlay.conf b/overlays/tgl/overlay.conf new file mode 100644 index 000000000..cf017a4bc --- /dev/null +++ b/overlays/tgl/overlay.conf @@ -0,0 +1,7 @@ +CONFIG_TIGERLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=30 +CONFIG_RIMAGE_SIGNING_SCHEMA="tgl" diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index c7edff3dc..4645e6142 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -371,9 +371,17 @@ def build_platforms(): if args.cmake_args: build_cmd += args.cmake_args + overlays = [] + # You may override default overlay.conf file name using CONFIG_OVERLAY in your platform + # dictionary + overlay_filename = platform_dict.get("CONFIG_OVERLAY", "overlay.conf") + overlays.append(str(pathlib.Path(SOF_TOP, "overlays", platform, overlay_filename))) + if args.ipc == "IPC4": - overlay = pathlib.Path(SOF_TOP, "platforms", platform, platform_dict["IPC4_CONFIG_OVERLAY"]) - build_cmd.append(f"-DOVERLAY_CONFIG={overlay}") + overlays.append(str(pathlib.Path(SOF_TOP, "overlays", platform, platform_dict["IPC4_CONFIG_OVERLAY"]))) + + overlays = ";".join(overlays) + build_cmd.append(f"-DOVERLAY_CONFIG={overlays}") # Build execute_command(build_cmd, check=True, cwd=west_top) diff --git a/scripts/xtensa-build-zephyr.sh b/scripts/xtensa-build-zephyr.sh index 5d5fd74e0..d5b1caba9 100755 --- a/scripts/xtensa-build-zephyr.sh +++ b/scripts/xtensa-build-zephyr.sh @@ -236,6 +236,22 @@ build_platforms() ;; esac + # default value if undefined + local config_overlay=${CONFIG_OVERLAY:-overlay.conf} + + # every platform that has CONFIG_OVERLAY file is expected to have it in: + # overlays/ directory + local CONFIG_DIR="$SOF_TOP"/overlays/"$platform" + local OVERLAY_FILE="$CONFIG_DIR"/"$config_overlay" + + test -d "$CONFIG_DIR" || + die 'Overlay configuration directory: %s does not exist, create one.' \ + "$CONFIG_DIR" + + test -f "$OVERLAY_FILE" || + die 'Platform overlay file: %s does not exist. Please create one.' \ + "$OVERLAY_FILE" + if [ -n "$XTENSA_TOOLS_ROOT" ] then # set variables expected by zephyr/cmake/toolchain/xcc/generic.cmake @@ -269,7 +285,7 @@ build_platforms() set -x west $verbose build --build-dir "$bdir" --board "$PLAT_CONFIG" \ zephyr/samples/subsys/audio/sof \ - -- "${CMAKE_ARGS[@]}" + -- "${CMAKE_ARGS[@]}" "-DOVERLAY_CONFIG=${OVERLAY_FILE}" # This should ideally be part of # sof/zephyr/CMakeLists.txt but due to the way