Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions cmake/modules/kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,9 @@ zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} KCONF board_extension_conf_files
# separated list instead.
string(REPLACE ";" "?" DTS_ROOT_BINDINGS "${DTS_ROOT_BINDINGS}")

# Export each `ZEPHYR_<module>_MODULE_DIR` to Kconfig.
# This allows Kconfig files to refer relative from a modules root as:
# source "$(ZEPHYR_FOO_MODULE_DIR)/Kconfig"
# Export each `ZEPHYR_<module>_KCONFIG` to Kconfig.
foreach(module_name ${ZEPHYR_MODULE_NAMES})
zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})
list(APPEND
ZEPHYR_KCONFIG_MODULES_DIR
"ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR=${ZEPHYR_${MODULE_NAME_UPPER}_MODULE_DIR}"
)

if(ZEPHYR_${MODULE_NAME_UPPER}_KCONFIG)
list(APPEND
Expand Down
24 changes: 14 additions & 10 deletions scripts/zephyr_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,11 @@ def process_kconfig(module, meta):
module_path = PurePath(module)
module_yml = module_path.joinpath('zephyr/module.yml')
kconfig_extern = section.get('kconfig-ext', False)
name_sanitized = meta['name-sanitized']
snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n'

if kconfig_extern:
return kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs)
return snippet + kconfig_snippet(meta, module_path, blobs=blobs, taint_blobs=taint_blobs)

kconfig_setting = section.get('kconfig', None)
if not validate_setting(kconfig_setting, module):
Expand All @@ -404,21 +407,22 @@ def process_kconfig(module, meta):

kconfig_file = os.path.join(module, kconfig_setting or 'zephyr/Kconfig')
if os.path.isfile(kconfig_file):
return kconfig_snippet(meta, module_path, Path(kconfig_file),
blobs=blobs, taint_blobs=taint_blobs)
return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file),
blobs=blobs, taint_blobs=taint_blobs)
else:
name_sanitized = meta['name-sanitized']
snippet = kconfig_module_opts(name_sanitized, blobs, taint_blobs)
return '\n'.join(snippet) + '\n'
return snippet + '\n'.join(kconfig_module_opts(name_sanitized, blobs, taint_blobs)) + '\n'


def process_sysbuildkconfig(module, meta):
section = meta.get('build', dict())
module_path = PurePath(module)
module_yml = module_path.joinpath('zephyr/module.yml')
kconfig_extern = section.get('sysbuild-kconfig-ext', False)
name_sanitized = meta['name-sanitized']
snippet = f'ZEPHYR_{name_sanitized.upper()}_MODULE_DIR := {module_path.as_posix()}\n'

if kconfig_extern:
return kconfig_snippet(meta, module_path, sysbuild=True)
return snippet + kconfig_snippet(meta, module_path, sysbuild=True)

kconfig_setting = section.get('sysbuild-kconfig', None)
if not validate_setting(kconfig_setting, module):
Expand All @@ -429,10 +433,10 @@ def process_sysbuildkconfig(module, meta):
if kconfig_setting is not None:
kconfig_file = os.path.join(module, kconfig_setting)
if os.path.isfile(kconfig_file):
return kconfig_snippet(meta, module_path, Path(kconfig_file))
return snippet + kconfig_snippet(meta, module_path, Path(kconfig_file))

name_sanitized = meta['name-sanitized']
return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n'
return snippet + \
(f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n'
f' bool\n'
f' default y\n')

Expand Down
Loading