feat(cmakev2/kconfig): use cmakev2 specific config_buildv2.env.in

The current config.env.in template cannot be easily extended and shared
between cmakev1 and cmakev2. Although the root Kconfig is shared and
sources COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE and
COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE, these environment
variables cannot be set to empty strings. This issue arises unless we
also adjust cmakev1 and esp-docs, which use prepare_kconfig_files.py, to
properly set COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE and
COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE.

If an environment variable is set to an empty string and sourced in
Kconfig, kconfgen will expand the variable with expandvars(), resulting
in an empty value. This expanded variable is then appended to the root
Kconfig or the currently processed Kconfig directory path, depending on
whether osource or orsource is used, and passed to iglob. The iglog will
return the directory as a result, and when Kconfig attempts to open the
file, it will encounter an error because it is a directory.

To resolve this issue and enable sharing of the root Kconfig file, a new
config_buildv2.env.in template has been added, which includes
environment variables for the excluded components.

For cmakev1, kconfgen will encounter the osource command for
COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE. Since this variable is not
defined in config.env.in, expandvars() will return the environment
variable name instead of expanding it, and iglob will not match
anything. Because osource is used for excluded components, the
non-existent file for osource will be skipped.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-08-16 13:23:50 +02:00
committed by BOT
parent 8567273b37
commit e248b36676
3 changed files with 18 additions and 6 deletions
+1 -1
View File
@@ -338,7 +338,7 @@ function(__create_config_env_file env_path)
idf_build_set_property(__IDF_ENV_FPGA "${idf_env_fpga}")
# Get the config.env.in template path
set(template_path "${idf_path}/tools/kconfig_new/config.env.in")
set(template_path "${idf_path}/tools/kconfig_new/config_buildv2.env.in")
if(NOT EXISTS "${template_path}")
idf_die("Kconfig environment template file not found at ${template_path}")
endif()
+1 -5
View File
@@ -2,15 +2,11 @@
"COMPONENT_KCONFIGS": "${kconfigs}",
"COMPONENT_KCONFIGS_PROJBUILD": "${kconfig_projbuilds}",
"COMPONENT_SDKCONFIG_RENAMES": "${sdkconfig_renames}",
"COMPONENT_KCONFIGS_EXCLUDED": "${kconfigs_excluded}",
"COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED": "${kconfigs_projbuild_excluded}",
"IDF_TARGET": "${idf_target}",
"IDF_TOOLCHAIN": "${idf_toolchain}",
"IDF_VERSION": "$ENV{IDF_VERSION}",
"IDF_ENV_FPGA": "${idf_env_fpga}",
"IDF_PATH": "${idf_path}",
"COMPONENT_KCONFIGS_SOURCE_FILE": "${kconfigs_path}",
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE": "${kconfigs_projbuild_path}",
"COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE": "${kconfigs_excluded_path}",
"COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE": "${kconfigs_projbuild_excluded_path}"
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE": "${kconfigs_projbuild_path}"
}
+16
View File
@@ -0,0 +1,16 @@
{
"COMPONENT_KCONFIGS": "${kconfigs}",
"COMPONENT_KCONFIGS_PROJBUILD": "${kconfig_projbuilds}",
"COMPONENT_SDKCONFIG_RENAMES": "${sdkconfig_renames}",
"COMPONENT_KCONFIGS_EXCLUDED": "${kconfigs_excluded}",
"COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED": "${kconfigs_projbuild_excluded}",
"IDF_TARGET": "${idf_target}",
"IDF_TOOLCHAIN": "${idf_toolchain}",
"IDF_VERSION": "$ENV{IDF_VERSION}",
"IDF_ENV_FPGA": "${idf_env_fpga}",
"IDF_PATH": "${idf_path}",
"COMPONENT_KCONFIGS_SOURCE_FILE": "${kconfigs_path}",
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE": "${kconfigs_projbuild_path}",
"COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE": "${kconfigs_excluded_path}",
"COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE": "${kconfigs_projbuild_excluded_path}"
}