Skip to content

Commit f541902

Browse files
committed
cmake: Allow user to override the net init config file
User can set NET_CONFIG_FILE to override the name of the default configuration file name which is network-config.yaml This way a substitute yaml config file can be used instead of the default one. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent ba5e360 commit f541902

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cmake/modules/configuration_files.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# - EXTRA_DTC_OVERLAY_FILE List of additional devicetree overlay files
1717
# - DTS_EXTRA_CPPFLAGS List of additional devicetree preprocessor defines
1818
# - APPLICATION_CONFIG_DIR: Root folder for application configuration
19+
# - NET_INIT_CONFIG_FILE: Name of the network init configuration file
1920
#
2021
# If any of the above variables are already set when this CMake module is
2122
# loaded, then no changes to the variable will happen.
@@ -95,5 +96,6 @@ zephyr_boilerplate_watch(DTC_OVERLAY_FILE)
9596
zephyr_get(EXTRA_CONF_FILE SYSBUILD LOCAL VAR EXTRA_CONF_FILE OVERLAY_CONFIG MERGE REVERSE)
9697
zephyr_get(EXTRA_DTC_OVERLAY_FILE SYSBUILD LOCAL MERGE REVERSE)
9798
zephyr_get(DTS_EXTRA_CPPFLAGS SYSBUILD LOCAL MERGE REVERSE)
99+
zephyr_get(NET_INIT_CONFIG_FILE)
98100
build_info(application source-dir VALUE ${APPLICATION_SOURCE_DIR})
99101
build_info(application configuration-dir VALUE ${APPLICATION_CONFIG_DIR})

cmake/modules/kernel.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,11 @@ if(CONFIG_NET_CONFIG_SETTINGS)
261261
# If network configuration library is enabled, check if the yaml file
262262
# is present and use it to generate an initial configuration. Otherwise
263263
# use the .config file to generate the initial configuration.
264-
if(EXISTS ${APPLICATION_SOURCE_DIR}/network-config.yaml)
265-
network_generate_config_file_for_target(app ${APPLICATION_SOURCE_DIR}/network-config.yaml)
264+
if(NOT NET_CONFIG_FILE)
265+
set(NET_CONFIG_FILE ${APPLICATION_SOURCE_DIR}/network-config.yaml)
266+
endif()
267+
if(EXISTS ${NET_CONFIG_FILE})
268+
network_generate_config_file_for_target(app ${NET_CONFIG_FILE})
266269
else()
267270
network_generate_config_file_for_target(app ${DOTCONFIG})
268271
endif()

0 commit comments

Comments
 (0)