Skip to content

Commit

Permalink
cmake: Use only one defconfig
Browse files Browse the repository at this point in the history
Commit 84a7f75 enabled sourcing several
defconfig files for a single board, ordered from least to most specific
to the selected board variant. The assumption was: given two targets of
the form `<board>/<soc>` and `<board>/<soc>/<variant>`, the latter would
naturally inherit configuration from the former.

However, having multiple defconfigs doesn't make sense, and in practice,
they tend to clash with each other, which complicates porting.

Another motivation for doing that was to make `<board>_<soc>_defconfig`
optional, so that `<board>_defconfig` could be used instead, if present.
This can still be achieved by constraining the `_defconfig` lookup to
only use the most specific file available, just like `.dts` lookup.

Relevant changes to `zephyr_file()` have been reverted.

This means that `<board>_<revision>.conf` overlays, which were meant to
be deprecated, are no longer replaced by revision-specific defconfigs,
so they need to be un-deprecated. None of the currently ported boards
are affected by this change.

Signed-off-by: Grzegorz Swiderski <[email protected]>
  • Loading branch information
57300 committed Feb 8, 2024
1 parent 6f7d434 commit 635bc61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
27 changes: 6 additions & 21 deletions cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,6 @@ endfunction()
# files are returned. Configuration files will be:
# - DTS: Overlay files (.overlay)
# - Kconfig: Config fragments (.conf)
# - defconfig: defconfig files (_defconfig)
# The conf file search will return existing configuration
# files for the current board.
# CONF_FILES takes the following additional arguments:
Expand All @@ -2481,13 +2480,12 @@ endfunction()
# If no board is given the current BOARD and
# BOARD_REVISION will be used.
#
# DTS <list>: List to append DTS overlay files in <path> to
# KCONF <list>: List to append Kconfig fragment files in <path> to
# DEFCONF <list>: List to append _defconfig files in <path> to
# BUILD <type>: Build type to include for search.
# For example:
# BUILD debug, will look for <board>_debug.conf
# and <board>_debug.overlay, instead of <board>.conf
# DTS <list>: List to append DTS overlay files in <path> to
# KCONF <list>: List to append Kconfig fragment files in <path> to
# BUILD <type>: Build type to include for search.
# For example:
# BUILD debug, will look for <board>_debug.conf
# and <board>_debug.overlay, instead of <board>.conf
#
function(zephyr_file)
set(file_options APPLICATION_ROOT CONF_FILES)
Expand Down Expand Up @@ -2597,19 +2595,6 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
# This updates the provided list in parent scope (callers scope)
set(${FILE_KCONF} ${${FILE_KCONF}} PARENT_SCOPE)
endif()

if(FILE_DEFCONFIG)
foreach(path ${FILE_CONF_FILES})
foreach(filename ${filename_list})
if(EXISTS ${path}/${filename}_defconfig)
list(APPEND ${FILE_DEFCONFIG} ${path}/${filename}_defconfig)
endif()
endforeach()
endforeach()

# This updates the provided list in parent scope (callers scope)
set(${FILE_DEFCONFIG} ${${FILE_DEFCONFIG}} PARENT_SCOPE)
endif()
endif()
endfunction()

Expand Down
9 changes: 7 additions & 2 deletions cmake/modules/kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ else()
endif()

if(NOT DEFINED BOARD_DEFCONFIG)
zephyr_file(CONF_FILES ${BOARD_DIR} DEFCONFIG BOARD_DEFCONFIG)
zephyr_build_string(config_board_string BOARD ${BOARD} BOARD_IDENTIFIER ${BOARD_IDENTIFIER} MERGE)
foreach(str ${config_board_string})
if(EXISTS ${BOARD_DIR}/${str}_defconfig)
set(BOARD_DEFCONFIG ${BOARD_DIR}/${str}_defconfig)
break()
endif()
endforeach()
endif()

if(DEFINED BOARD_REVISION)
Expand All @@ -86,7 +92,6 @@ if(DEFINED BOARD_REVISION)
)
set(board_rev_file ${config_board_string})
if(EXISTS ${BOARD_DIR}/${board_rev_file}.conf)
message(DEPRECATION "Use of '${board_rev_file}.conf' is deprecated, please switch to '${board_rev_file}_defconfig'")
set_ifndef(BOARD_REVISION_CONFIG ${BOARD_DIR}/${board_rev_file}.conf)
endif()
endif()
Expand Down

0 comments on commit 635bc61

Please sign in to comment.