From: Luca Boccassi Date: Tue, 24 Feb 2026 22:00:35 +0000 (+0000) Subject: ukify: default --hwids to /usr/lib/systemd/boot/hwids// X-Git-Tag: v260-rc1~5^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=117ec9db7e71357837190833d7731bc61ae54ecc;p=thirdparty%2Fsystemd.git ukify: default --hwids to /usr/lib/systemd/boot/hwids// 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 --- diff --git a/man/ukify.xml b/man/ukify.xml index a3fbbca93f5..0e818dbc4fb 100644 --- a/man/ukify.xml +++ b/man/ukify.xml @@ -452,9 +452,11 @@ Here Example Laptop 16 Gen 7 is the device name (as defined by the manufacturer), example,laptop-16-g7 is the compatible (as defined by the kernel) and hwids is an array of CHIDs/HWIDs (extracted i.e. - from fwupdtool hwids output). If not specified, the section will not be - present. It is recommended to specify this parameter if automatically selectable DeviceTrees are - to be used. + from fwupdtool hwids output). If not specified, and the + /usr/lib/systemd/boot/hwids/[EFI_ARCH]/ directory exists, then the section will + be automatically populated from that directory (specify an empty string as the parameter for this + option to disable this behavior), otherwise it will not be present. It is recommended to specify + this parameter if automatically selectable DeviceTrees are to be used. diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index b7542c7eca3..6f492bc9ba0 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -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', ),