ukify: default --hwids to /usr/lib/systemd/boot/hwids/<EFI_ARCH>/

If the option is not manually specified, and the hwids directory exists
for the target EFI architecture, default to it. Allow passing '' to skip.

Fixes https://github.com/systemd/systemd/issues/40542
This commit is contained in:
Luca Boccassi
2026-02-25 13:51:31 +00:00
parent 6d5018487c
commit 117ec9db7e
2 changed files with 14 additions and 7 deletions
+9 -4
View File
@@ -273,7 +273,7 @@ class UkifyConfig:
devicetree: Path
devicetree_auto: list[Path]
efi_arch: str
hwids: Path
hwids: Union[str, Path, None]
initrd: list[Path]
efifw: list[Path]
join_profiles: list[Path]
@@ -1397,8 +1397,14 @@ def make_uki(opts: UkifyConfig) -> None:
hwids = None
if opts.hwids is not None:
hwids = parse_hwid_dir(opts.hwids)
if opts.hwids != '':
if opts.hwids is not None:
hwids = parse_hwid_dir(Path(opts.hwids))
else:
hwids_dir = Path(f'/tmp/s/usr/lib/systemd/boot/hwids/{opts.efi_arch}')
if hwids_dir.is_dir():
print(f'Automatically building .hwids section from {hwids_dir}', file=sys.stderr)
hwids = parse_hwid_dir(hwids_dir)
sections = [
# name, content, measure?
@@ -1994,7 +2000,6 @@ CONFIG_ITEMS = [
ConfigItem(
'--hwids',
metavar='DIR',
type=Path,
help='Directory with HWID text files [.hwids section]',
config_key='UKI/HWIDs',
),