From: anonymix007 <48598263+anonymix007@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:48:24 +0000 (+0300) Subject: ukify: Use new .hwids PE section format X-Git-Tag: v257-rc2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61d6075775188f16ff4cc27ba035988ce310c90b;p=thirdparty%2Fsystemd.git ukify: Use new .hwids PE section format --- diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 5ea52898ee7..8d601e791e3 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -1002,15 +1002,20 @@ def merge_sbat(input_pe: list[Path], input_text: list[str]) -> str: ) -# Keep in sync with EFI_GUID (src/boot/efi/efi.h) +# Keep in sync with EFI_GUID (src/boot/efi.h) # uint32_t Data1, uint16_t Data2, uint16_t Data3, uint8_t Data4[8] EFI_GUID = tuple[int, int, int, tuple[int, int, int, int, int, int, int, int]] EFI_GUID_STRUCT_SIZE = 4 + 2 + 2 + 1 * 8 -# Keep in sync with Device (src/boot/efi/chid.h) -# uint32_t struct_size, uint32_t name_offset, uint32_t compatible_offset, EFI_GUID chid -DEVICE_STRUCT_SIZE = 4 + 4 + 4 + EFI_GUID_STRUCT_SIZE +# Keep in sync with Device (DEVICE_TYPE_DEVICETREE) from src/boot/chid.h +# uint32_t descriptor, EFI_GUID chid, uint32_t name_offset, uint32_t compatible_offset +DEVICE_STRUCT_SIZE = 4 + EFI_GUID_STRUCT_SIZE + 4 + 4 NULL_DEVICE = b'\0' * DEVICE_STRUCT_SIZE +DEVICE_TYPE_DEVICETREE = 1 + + +def device_make_descriptor(device_type: int, size: int) -> int: + return (size) | (device_type << 28) def pack_device(offsets: dict[str, int], name: str, compatible: str, chids: list[EFI_GUID]) -> bytes: @@ -1018,7 +1023,14 @@ def pack_device(offsets: dict[str, int], name: str, compatible: str, chids: list for data1, data2, data3, data4 in chids: data += struct.pack( - '