Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions contrib/ci/build_freebsd_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ if [ -z "$GITHUB_SHA" ] || [ -z "$GITHUB_REPOSITORY" ] || \
exit 1
fi

# Include-file of libefivar port uses GCC-specific builtin function
export CC=gcc

set -xe
mkdir -p /usr/local/etc/pkg/repos/
# Fix meson flag problem https://www.mail-archive.com/freebsd-ports@freebsd.org/msg86617.html
cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/FreeBSD.conf
sed -i .old 's|url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly"|url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"|' \
/usr/local/etc/pkg/repos/FreeBSD.conf
pkg install -y meson efivar
pkg install -y meson
pkg upgrade -y meson
cd /usr
git clone https://github.com/3mdeb/freebsd-ports.git --depth 1 -b fwupd ports
Expand Down
5 changes: 3 additions & 2 deletions contrib/freebsd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ LIB_DEPENDS= libcurl.so:ftp/curl \
libjcat.so:textproc/libjcat \
libjson-glib-1.0.so:devel/json-glib \
libxmlb.so:textproc/libxmlb \
libefiboot.so:devel/gnu-efi
libefiboot.so:devel/gnu-efi \
libpolkit-gobject-1.so:sysutils/polkit

RUN_DEPENDS= ${LOCALBASE}/libexec/fwupd/efi/fwupdx64.efi:sysutils/fwupd-efi

Expand All @@ -52,7 +53,7 @@ MESON_ARGS= -Dgudev=false \
-Dplugin_realtek_mst=false \
-Dplugin_thunderbolt=false \
-Dplugin_tpm=false \
-Dpolkit=false \
-Dpolkit=true \
-Dsystemd=false \
-Dtests=false \
-Ddocs=gtkdoc \
Expand Down
27 changes: 25 additions & 2 deletions libfwupdplugin/fu-efivar-freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ fu_efivar_delete_impl (const gchar *guid, const gchar *name, GError **error)
efi_guid_t guidt;
efi_str_to_guid (guid, &guidt);

if (!fu_efivar_exists_impl(guid, name))
return TRUE;
if (efi_del_variable (guidt, name) == 0)
return TRUE;

Expand All @@ -50,7 +52,7 @@ fu_efivar_delete_with_glob_impl (const gchar *guid, const gchar *name_glob, GErr
{
efi_guid_t *guidt = NULL;
gchar *name = NULL;
gboolean rv = FALSE;
gboolean rv = TRUE;
efi_guid_t guid_to_delete;

efi_str_to_guid (guid, &guid_to_delete);
Expand Down Expand Up @@ -98,8 +100,29 @@ fu_efivar_get_data_impl (const gchar *guid, const gchar *name, guint8 **data,
gsize *data_sz, guint32 *attr, GError **error)
{
efi_guid_t guidt;
gboolean success;
guint8 *buf;
gssize sz = 0;

efi_str_to_guid (guid, &guidt);
return (efi_get_variable (guidt, name, data, data_sz, attr) != 0);
success = efi_get_variable (guidt, name, &buf, data_sz, attr) == 1;
if (data_sz != NULL)
sz = *data_sz;
if (success && sz) {
g_autofree guint8 *ret_buf = g_malloc0(sz);
memcpy(ret_buf, buf, sz);
*data = g_steal_pointer(&ret_buf);
}

if (!success) {
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"failed to read efivar: %s",
name);
}

return success;
}


Expand Down
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ 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 += cc.find_library('geom')
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion plugins/uefi-capsule/fu-plugin-uefi-capsule.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ fu_plugin_uefi_capsule_coldplug_device (FuPlugin *plugin, FuUefiDevice *dev, GEr
/* set vendor ID as the BIOS vendor */
if (device_kind != FU_UEFI_DEVICE_KIND_FMP) {
const gchar *dmi_vendor;
dmi_vendor = fu_context_get_hwid_value (ctx, FU_HWIDS_KEY_BIOS_VENDOR);
dmi_vendor = fu_context_get_hwid_value (ctx, FU_HWIDS_KEY_BASEBOARD_MANUFACTURER);
if (dmi_vendor != NULL) {
g_autofree gchar *vendor_id = g_strdup_printf ("DMI:%s", dmi_vendor);
fu_device_add_vendor_id (FU_DEVICE (dev), vendor_id);
Expand Down
1 change: 1 addition & 0 deletions plugins/uefi-capsule/fu-uefi-backend-freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <glib/gstdio.h>

#include "fu-kenv.h"
#include "fu-uefi-common.h"
#include "fu-uefi-device.h"
#include "fu-uefi-backend.h"
Expand Down
5 changes: 5 additions & 0 deletions plugins/uefi-capsule/fu-uefi-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ fu_uefi_bootmgr_get_suffix (GError **error)
};
g_autofree gchar *sysfsfwdir = fu_common_get_path (FU_PATH_KIND_SYSFSDIR_FW);
g_autofree gchar *sysfsefidir = g_build_filename (sysfsfwdir, "efi", NULL);
#ifdef __linux__
firmware_bits = fu_uefi_read_file_as_uint64 (sysfsefidir, "fw_platform_size");
#else
firmware_bits = 64;
#endif

if (firmware_bits == 0) {
g_set_error (error,
G_IO_ERROR,
Expand Down