]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Add chid.c to libefitest
authoranonymix007 <48598263+anonymix007@users.noreply.github.com>
Thu, 12 Dec 2024 17:31:02 +0000 (20:31 +0300)
committeranonymix007 <48598263+anonymix007@users.noreply.github.com>
Mon, 16 Dec 2024 18:02:54 +0000 (21:02 +0300)
Also fix compilation for testing CHID matching in userspace

src/boot/chid.c
src/boot/meson.build
src/boot/util.h

index cd82958dcfe1dca1da77317b9091d0407ac1b088..dca2f364e0858fb26f42073f198d9aa3fe87c5b8 100644 (file)
@@ -104,7 +104,11 @@ EFI_STATUS chid_match(const void *hwid_buffer, size_t hwid_length, const Device
 
         status = populate_board_chids(chids);
         if (EFI_STATUS_IS_ERROR(status))
+#if SD_BOOT
                 return log_error_status(status, "Failed to populate board CHIDs: %m");
+#else
+                return status;
+#endif
 
         size_t n_devices = 0;
 
index 29c5455dbd19bbcc2c472ce6b4d8d27f0bb540ca..9c7483d6d1d3c413f8d0ad5dae59536d59daabb0 100644 (file)
@@ -7,6 +7,7 @@ libefitest = static_library(
         'efitest',
         files(
                 'bcd.c',
+                'chid.c',
                 'efi-string.c',
         ),
         build_by_default : false,
index af14a0e31e467e1cdfa3a959bed6442b0a68ade2..90da8ad69d8d6541a0e9ccb680aca86666dcc63c 100644 (file)
@@ -3,11 +3,14 @@
 
 #include "efi.h"
 #include "efi-string.h"
-#include "log.h"
 #include "memory-util-fundamental.h"
-#include "proto/file-io.h"
 #include "string-util-fundamental.h"
 
+#if SD_BOOT
+
+#include "log.h"
+#include "proto/file-io.h"
+
 /* This is provided by the linker. */
 extern uint8_t __executable_start[];
 
@@ -236,3 +239,11 @@ char16_t *get_extra_dir(const EFI_DEVICE_PATH *file_path);
 
 #define bswap_16(x) __builtin_bswap16(x)
 #define bswap_32(x) __builtin_bswap32(x)
+
+#else
+
+#include "alloc-util.h"
+
+#define xnew0(type, n) ASSERT_PTR(new0(type, n))
+
+#endif