Skip to content

Commit e863ff2

Browse files
committed
west: sign/rimage: use rimage config to find SOF directory
After removal of SOF from manifest, if rimage is in path, the build would fail because the gen-uuid-reg.py cannot be found anymore. To fix this, use the rimage config path to find the SOF directory since the rimage config path is a directory under SOF. This would allow rimage to again sign images to run on hardware. Signed-off-by: Daniel Leung <[email protected]>
1 parent d14a547 commit e863ff2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

scripts/west_commands/sign.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,11 @@ def rimage_config_dir(self):
438438
def generate_uuid_registry(self):
439439
'Runs the uuid-registry.h generator script'
440440

441-
generate_cmd = [sys.executable, str(self.sof_src_dir / 'scripts' / 'gen-uuid-reg.py'),
441+
uuid_script_path = self.sof_src_dir / 'scripts' / 'gen-uuid-reg.py'
442+
if not uuid_script_path.exists():
443+
self.command.die(f"{uuid_script_path} does not exists.")
444+
445+
generate_cmd = [sys.executable, str(uuid_script_path),
442446
str(self.sof_src_dir / 'uuid-registry.txt'),
443447
str(pathlib.Path('zephyr') / 'include' / 'generated' / 'uuid-registry.h')
444448
]
@@ -554,13 +558,20 @@ def sign(self, command, build_dir, build_conf, formats):
554558
if not args.quiet:
555559
command.inf('Signing with tool {}'.format(tool_path))
556560

561+
sof_src_dir = None
557562
try:
558563
sof_proj = command.manifest.get_projects(['sof'], allow_paths=False)
559564
sof_src_dir = pathlib.Path(sof_proj[0].abspath)
560565
except ValueError: # sof is the manifest
561-
sof_src_dir = pathlib.Path(manifest.manifest_path()).parent
566+
conf_dir = self.cmake_cache.get('RIMAGE_CONFIG_PATH')
567+
if conf_dir:
568+
# Config path is <sof top>/tools/rimage/config/
569+
# So need to go up 3 levels to get SOF directory.
570+
sof_src_dir = pathlib.Path(conf_dir).parent.parent.parent
562571

563572
self.sof_src_dir = sof_src_dir
573+
if not self.sof_src_dir:
574+
command.die("Cannot find SOF directory.")
564575

565576

566577
command.inf('Signing for SOC target ' + target)

0 commit comments

Comments
 (0)