Page MenuHomeFreeBSD

D55590.id173540.diff
No OneTemporary

D55590.id173540.diff

diff --git a/devel/gnu-efi/Makefile b/devel/gnu-efi/Makefile
--- a/devel/gnu-efi/Makefile
+++ b/devel/gnu-efi/Makefile
@@ -26,7 +26,10 @@
PLIST_SUB+= ARCH_i386="" ARCH_amd64="@comment "
.endif
-post-install:
- ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.o
+# This port installs object files as lib/*.o. Previously it stripped those
+# objects, but it MUST NOT be done. Stripping removes all symbols from CRTs
+# and breaks applications linked against gnu-efi (everything builds, but
+# resulting file is not a valid PE executable due to the way objcopy
+# operates).
.include <bsd.port.post.mk>
diff --git a/sysutils/fwupd/Makefile b/sysutils/fwupd/Makefile
--- a/sysutils/fwupd/Makefile
+++ b/sysutils/fwupd/Makefile
@@ -9,6 +9,9 @@
BROKEN_FreeBSD_13= requires at least FreeBSD 14
+CONFLICTS_BUILD= efivar
+CONFLICTS_INSTALL= efivar
+
BUILD_DEPENDS= blkid:filesystems/libblkid \
flashrom>0:sysutils/flashrom \
help2man:misc/help2man \
@@ -21,7 +24,6 @@
LIB_DEPENDS= libcbor.so:devel/libcbor \
libcurl.so:ftp/curl \
libdrm.so:graphics/libdrm \
- libefiboot.so:devel/efivar \
libelf.so:devel/libelf \
libgcab-1.0.so:archivers/gcab \
libgnutls.so:security/gnutls \
@@ -33,6 +35,7 @@
libprotobuf-c.so:devel/protobuf-c \
libxmlb.so:textproc/libxmlb
RUN_DEPENDS= blkid:filesystems/libblkid \
+ bsdisks:sysutils/bsdisks \
dbus-daemon:devel/dbus \
flashrom>0:sysutils/flashrom \
${LOCALBASE}/libdata/pkgconfig/fwupd-efi.pc:sysutils/fwupd-efi \
diff --git a/sysutils/fwupd/files/patch-libfwupdplugin_fu-efi-hard-drive-device-path.c b/sysutils/fwupd/files/patch-libfwupdplugin_fu-efi-hard-drive-device-path.c
new file mode 100644
--- /dev/null
+++ b/sysutils/fwupd/files/patch-libfwupdplugin_fu-efi-hard-drive-device-path.c
@@ -0,0 +1,14 @@
+--- libfwupdplugin/fu-efi-hard-drive-device-path.c.orig 2025-12-19 09:50:21 UTC
++++ libfwupdplugin/fu-efi-hard-drive-device-path.c
+@@ -378,8 +378,10 @@ fu_efi_hard_drive_device_path_new_from_volume(FuVolume
+ "partition UUID required");
+ return NULL;
+ }
++ /* FreeBSD uses "efi" partition kind for ESP */
+ if (g_strcmp0(partition_kind, FU_VOLUME_KIND_ESP) == 0 ||
+- g_strcmp0(partition_kind, FU_VOLUME_KIND_BDP) == 0) {
++ g_strcmp0(partition_kind, FU_VOLUME_KIND_BDP) == 0 ||
++ g_strcmp0(partition_kind, "efi") == 0) {
+ self->partition_format =
+ FU_EFI_HARD_DRIVE_DEVICE_PATH_PARTITION_FORMAT_GUID_PARTITION_TABLE;
+ self->signature_type = FU_EFI_HARD_DRIVE_DEVICE_PATH_SIGNATURE_TYPE_GUID;
diff --git a/sysutils/fwupd/files/patch-libfwupdplugin_fu-freebsd-efivars.c b/sysutils/fwupd/files/patch-libfwupdplugin_fu-freebsd-efivars.c
--- a/sysutils/fwupd/files/patch-libfwupdplugin_fu-freebsd-efivars.c
+++ b/sysutils/fwupd/files/patch-libfwupdplugin_fu-freebsd-efivars.c
@@ -1,6 +1,14 @@
---- libfwupdplugin/fu-freebsd-efivars.c.orig 2025-11-05 16:06:16 UTC
+--- libfwupdplugin/fu-freebsd-efivars.c.orig 2025-12-19 09:50:21 UTC
+++ libfwupdplugin/fu-freebsd-efivars.c
-@@ -67,7 +67,7 @@ fu_freebsd_efivars_delete_with_glob(FuEfivars *efivars
+@@ -17,6 +17,7 @@
+
+ #include "fu-efivars.h"
+ #include "fu-freebsd-efivars.h"
++#include "fu-mem.h"
+
+ struct _FuFreebsdEfivars {
+ FuEfivars parent_instance;
+@@ -67,7 +68,7 @@ fu_freebsd_efivars_delete_with_glob(FuEfivars *efivars
efi_str_to_guid(guid, &guid_to_delete);
@@ -9,7 +17,7 @@
if (memcmp(&guid_to_delete, guidt, sizeof(guid_to_delete)) != 0)
continue;
if (!g_pattern_match_simple(name, name_glob))
-@@ -87,7 +87,7 @@ fu_freebsd_efivars_exists_guid(const gchar *guid)
+@@ -87,7 +88,7 @@ fu_freebsd_efivars_exists_guid(const gchar *guid)
efi_guid_t test;
efi_str_to_guid(guid, &test);
@@ -18,7 +26,54 @@
if (memcmp(&test, guidt, sizeof(test)) == 0)
return TRUE;
}
-@@ -128,7 +128,7 @@ fu_freebsd_efivars_get_names(FuEfivars *efivars, const
+@@ -104,8 +105,45 @@ fu_freebsd_efivars_get_data(FuEfivars *efivars,
+ GError **error)
+ {
+ efi_guid_t guidt;
++ guint8 *local_data;
++ gsize local_data_sz;
++ FuEfiVariableAttrs local_attr;
++
+ efi_str_to_guid(guid, &guidt);
+- return (efi_get_variable(guidt, name, data, data_sz, attr) != 0);
++
++ /* native libefivar sets output parameters even on failure */
++ if (efi_get_variable(guidt,
++ name,
++ &local_data,
++ &local_data_sz,
++ &local_attr) < 0) {
++ g_set_error(error,
++ FWUPD_ERROR,
++ FWUPD_ERROR_NOT_FOUND,
++ "failed to get efivar %s:%s",
++ guid, name);
++ return FALSE;
++ }
++
++ if (data != NULL) {
++ /* native libefivar uses a static buffer for data */
++ *data = g_malloc(local_data_sz);
++ if (!fu_memcpy_safe(*data,
++ local_data_sz,
++ 0,
++ local_data,
++ local_data_sz,
++ 0,
++ local_data_sz,
++ error)) {
++ return FALSE;
++ }
++ }
++ if (data_sz != NULL)
++ *data_sz = local_data_sz;
++ if (attr != NULL)
++ *attr = local_attr;
++ return TRUE;
+ }
+
+ static gboolean
+@@ -128,7 +166,7 @@ fu_freebsd_efivars_get_names(FuEfivars *efivars, const
efi_str_to_guid(guid, &test);
/* find names with matching GUID */
@@ -27,7 +82,7 @@
if (memcmp(&test, guidt, sizeof(test)) == 0)
g_ptr_array_add(names, g_strdup(name));
}
-@@ -154,7 +154,7 @@ fu_freebsd_efivars_space_used(FuEfivars *efivars, GErr
+@@ -154,7 +192,7 @@ fu_freebsd_efivars_space_used(FuEfivars *efivars, GErr
efi_guid_t *guidt = NULL;
char *name = NULL;
@@ -36,12 +91,12 @@
size_t size = 0;
if (efi_get_variable_size(*guidt, name, &size) < 0) {
g_set_error_literal(error,
-@@ -182,7 +182,7 @@ fu_freebsd_efivars_set_data(FuEfivars *efivars,
+@@ -182,7 +220,7 @@ fu_freebsd_efivars_set_data(FuEfivars *efivars,
efi_guid_t guidt;
efi_str_to_guid(guid, &guidt);
- if (efi_set_variable(guidt, name, (guint8 *)data, sz, attr) != 0) {
-+ if (efi_set_variable(guidt, name, (guint8 *)data, sz, attr, 0644) != 0) {
++ if (efi_set_variable(guidt, name, (guint8 *)data, sz, attr) < 0) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
diff --git a/sysutils/fwupd/files/patch-libfwupdplugin_fu-uefi-device.c b/sysutils/fwupd/files/patch-libfwupdplugin_fu-uefi-device.c
new file mode 100644
--- /dev/null
+++ b/sysutils/fwupd/files/patch-libfwupdplugin_fu-uefi-device.c
@@ -0,0 +1,11 @@
+--- libfwupdplugin/fu-uefi-device.c.orig 2025-12-19 09:50:21 UTC
++++ libfwupdplugin/fu-uefi-device.c
+@@ -248,7 +248,7 @@ fu_uefi_device_probe(FuDevice *device, GError **error)
+ {
+ return fu_device_build_instance_id_full(device,
+ FU_DEVICE_INSTANCE_FLAG_QUIRKS,
+- NULL,
++ error,
+ "UEFI",
+ "GUID",
+ "NAME",
diff --git a/sysutils/fwupd/files/patch-meson.build b/sysutils/fwupd/files/patch-meson.build
new file mode 100644
--- /dev/null
+++ b/sysutils/fwupd/files/patch-meson.build
@@ -0,0 +1,11 @@
+--- meson.build.orig 2026-02-24 09:29:13 UTC
++++ meson.build
+@@ -489,7 +489,7 @@ if get_option('default_library') != 'static'
+ platform_deps += cc.find_library('shlwapi')
+ endif
+ if host_machine.system() == 'freebsd'
+- platform_deps += dependency('efivar')
++ platform_deps += cc.find_library('efivar')
+ platform_deps += dependency(
+ 'libinotify',
+ required: false,
diff --git a/sysutils/fwupd/files/patch-plugins_uefi-capsule_fu-uefi-capsule-backend-freebsd.c b/sysutils/fwupd/files/patch-plugins_uefi-capsule_fu-uefi-capsule-backend-freebsd.c
new file mode 100644
--- /dev/null
+++ b/sysutils/fwupd/files/patch-plugins_uefi-capsule_fu-uefi-capsule-backend-freebsd.c
@@ -0,0 +1,44 @@
+--- plugins/uefi-capsule/fu-uefi-capsule-backend-freebsd.c.orig 2025-12-19 09:50:21 UTC
++++ plugins/uefi-capsule/fu-uefi-capsule-backend-freebsd.c
+@@ -7,6 +7,7 @@
+
+ #include "config.h"
+
++#include <efivar.h>
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+@@ -45,7 +46,7 @@ fu_uefi_capsule_backend_device_new(FuUefiCapsuleBacken
+ g_autofree gchar *fw_class = NULL;
+ uint32_t status;
+
+- uuid_to_string(&entry->fw_class, &fw_class, &status);
++ uuid_to_string((const uuid_t *)&entry->fw_class, &fw_class, &status);
+ if (status != uuid_s_ok) {
+ g_set_error_literal(error,
+ FWUPD_ERROR,
+@@ -114,10 +115,23 @@ fu_uefi_capsule_backend_freebsd_coldplug(FuBackend *ba
+ #ifdef HAVE_FREEBSD_ESRT
+ FuUefiCapsuleBackend *self = FU_UEFI_CAPSULE_BACKEND(backend);
+ const gchar *esrt_dev = "/dev/efi";
+- struct efi_get_table_ioc table = {.uuid = EFI_TABLE_ESRT};
++ struct efi_get_table_ioc table = {0};
++ efi_guid_t esrt_uuid = EFI_TABLE_ESRT;
+ gint efi_fd;
+ struct efi_esrt_entry_v1 *entries;
+ g_autofree struct efi_esrt_table *esrt = NULL;
++
++ /* must copy because of incompatible initializer (UUID vs. GUID) */
++ if (!fu_memcpy_safe((guint8 *)&table.uuid,
++ sizeof(table.uuid),
++ 0,
++ (const guint8 *)&esrt_uuid,
++ sizeof(esrt_uuid),
++ 0,
++ sizeof(esrt_uuid),
++ error)) {
++ return FALSE;
++ }
+
+ efi_fd = g_open(esrt_dev, O_RDONLY, 0);
+ if (efi_fd < 0) {
diff --git a/sysutils/fwupd/files/patch-plugins_uefi-capsule_fu-uefi-common.c b/sysutils/fwupd/files/patch-plugins_uefi-capsule_fu-uefi-common.c
new file mode 100644
--- /dev/null
+++ b/sysutils/fwupd/files/patch-plugins_uefi-capsule_fu-uefi-common.c
@@ -0,0 +1,15 @@
+--- plugins/uefi-capsule/fu-uefi-common.c.orig 2025-12-19 09:50:21 UTC
++++ plugins/uefi-capsule/fu-uefi-common.c
+@@ -35,6 +35,12 @@ fu_uefi_bootmgr_get_suffix(GError **error)
+ {0, NULL}};
+ g_autofree gchar *sysfsefidir = fu_path_build(FU_PATH_KIND_SYSFSDIR_FW, "efi", NULL);
+ firmware_bits = fu_uefi_read_file_as_uint64(sysfsefidir, "fw_platform_size");
++#if defined(__FreeBSD__)
++ /* no means to determine this on FreeBSD? assume it matches the application when unambiguous */
++ if (firmware_bits == 0 && sizeof(suffixes)/sizeof(suffixes[0]) == 2) {
++ return suffixes[0].arch;
++ }
++#endif
+ if (firmware_bits == 0) {
+ g_set_error(error,
+ FWUPD_ERROR,

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 19, 9:52 PM (12 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31721605
Default Alt Text
D55590.id173540.diff (9 KB)

Event Timeline