Skip to content

Commit 09980d6

Browse files
de-nordiccarlescufi
authored andcommitted
scripts/west sign: Use BuildConfiguration instead of load_dot_config
The ImgtoolSigner.sign() is passed a BuildConfiguration object instance that holds all of Kconfig options that have been defined for a build; yet it has been reading the .config file once again, with the load_dot_config, to check some of these options. The commit replaces the code that has been using the load_dot_config obtained data with the code that uses the BuildConfiguration object. Signed-off-by: Dominik Ermel <[email protected]>
1 parent cabb7d6 commit 09980d6

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

scripts/west_commands/sign.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
FIND_BUILD_DIR_DESCRIPTION
2020
from runners.core import BuildConfiguration
2121
from zcmake import CMakeCache
22-
from zephyr_ext_common import Forceable, load_dot_config, \
23-
ZEPHYR_SCRIPTS
22+
from zephyr_ext_common import Forceable, ZEPHYR_SCRIPTS
2423

2524
# This is needed to load edt.pickle files.
2625
sys.path.append(str(ZEPHYR_SCRIPTS / 'dts' / 'python-devicetree' / 'src'))
@@ -222,17 +221,11 @@ def sign(self, command, build_dir, bcfg, formats):
222221
flash = self.edt_flash_node(b, args.quiet)
223222
align, addr, size = self.edt_flash_params(flash)
224223

225-
dot_config_file = b / 'zephyr' / '.config'
226-
if not dot_config_file.is_file():
227-
log.die(f"no .config found at {dot_config_file}")
228-
229-
dot_config = load_dot_config(dot_config_file)
230-
231-
if dot_config.get('CONFIG_BOOTLOADER_MCUBOOT', 'n') != 'y':
224+
if bcfg.get('CONFIG_BOOTLOADER_MCUBOOT', 'n') != 'y':
232225
log.wrn("CONFIG_BOOTLOADER_MCUBOOT is not set to y in "
233-
f"{dot_config_file}; this probably won't work")
226+
f"{bcfg.path}; this probably won't work")
234227

235-
kernel = dot_config.get('CONFIG_KERNEL_BIN_NAME', 'zephyr')
228+
kernel = bcfg.get('CONFIG_KERNEL_BIN_NAME', 'zephyr')
236229

237230
if 'bin' in formats:
238231
in_bin = b / 'zephyr' / f'{kernel}.bin'

0 commit comments

Comments
 (0)