Skip to content

Commit

Permalink
platform: Move configuration from Zephyr to SOF
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Andrey Borisovich committed Mar 17, 2022
1 parent 2e45906 commit 3f72788
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 3 deletions.
7 changes: 7 additions & 0 deletions overlays/apl/overlay.conf
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions overlays/cnl/overlay.conf
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions overlays/icl/overlay.conf
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions overlays/imx8/overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_IMX8=y
CONFIG_HAVE_AGENT=n
CONFIG_FORMAT_CONVERT_HIFI3=n
CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n
4 changes: 4 additions & 0 deletions overlays/imx8m/overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_IMX8M=y
CONFIG_HAVE_AGENT=n
CONFIG_FORMAT_CONVERT_HIFI3=n
CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n
4 changes: 4 additions & 0 deletions overlays/imx8x/overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_IMX8X=y
CONFIG_HAVE_AGENT=n
CONFIG_FORMAT_CONVERT_HIFI3=n
CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n
5 changes: 5 additions & 0 deletions overlays/jsl/overlay.conf
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions overlays/tgl-h/overlay.conf
Original file line number Diff line number Diff line change
@@ -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"
File renamed without changes.
7 changes: 7 additions & 0 deletions overlays/tgl/overlay.conf
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 10 additions & 2 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 17 additions & 1 deletion scripts/xtensa-build-zephyr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/<platform_name> 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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3f72788

Please sign in to comment.