Skip to content

Commit

Permalink
west: sign.py: rename new generated/platf.toml to rimage_config.toml
Browse files Browse the repository at this point in the history
CMake-based build systems like Zephyr's use separate build directories;
one for each build configuration. Even Zephyr's multi-build system
"sysbuild" (which is not relevant here) uses separate subdirectories.

So there is only one pre-processed, .toml file generated by build
directory and no need to vary its filename based on the platform name or
any other configuration parameter. It can and should keep the same
filename across build directories as zephyr.elf and all other build
artefacts do.

Moreover, when building a collection of configurations (as for instance
`sof/scripts/xtensa-build-zephyr.py` does), keeping all build
directories consistent with each other simplifies installation,
checksumming and any other post-processing.

"Fixes" recent commit 1533604 ("west: sign.py: generate platf.toml
from platf.toml.h with cc -E")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb authored and nashif committed Jan 8, 2024
1 parent fe75bb9 commit 2ee6c26
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions scripts/west_commands/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def preprocess_toml(self, config_dir, toml_basename, subdir):
preproc_cmd += ['-I', str(self.sof_src_dir / 'src')]
preproc_cmd += ['-imacros',
str(pathlib.Path('zephyr') / 'include' / 'generated' / 'autoconf.h')]
preproc_cmd += ['-o', str(subdir / toml_basename)]
preproc_cmd += ['-o', str(subdir / 'rimage_config.toml')]
self.command.inf(quote_sh_list(preproc_cmd))
subprocess.run(preproc_cmd, check=True, cwd=self.build_dir)

Expand Down Expand Up @@ -573,13 +573,12 @@ def sign(self, command, build_dir, build_conf, formats):
command.die(f"Cannot have both {toml_basename + '.h'} and {toml_basename} in {conf_dir}")

if (conf_dir / (toml_basename + '.h')).exists():
toml_subdir = pathlib.Path('zephyr') / 'misc' / 'generated'
self.preprocess_toml(conf_dir, toml_basename, toml_subdir)
toml_dir = b / toml_subdir
generated_subdir = pathlib.Path('zephyr') / 'misc' / 'generated'
self.preprocess_toml(conf_dir, toml_basename, generated_subdir)
extra_ri_args += ['-c', str(b / generated_subdir / 'rimage_config.toml')]
else:
toml_dir = conf_dir

extra_ri_args += ['-c', str(toml_dir / toml_basename)]
extra_ri_args += ['-c', str(toml_dir / toml_basename)]

# Warning: while not officially supported (yet?), the rimage --option that is last
# on the command line currently wins in case of duplicate options. So pay
Expand Down

0 comments on commit 2ee6c26

Please sign in to comment.