Bootmgr (BSD): add support for OpenBSD and NetBSD

This commit is contained in:
李通洲
2025-03-23 12:08:15 +08:00
parent a9f5722fd9
commit 1c719fa743
2 changed files with 16 additions and 4 deletions
+2 -2
View File
@@ -739,7 +739,7 @@ elseif(NetBSD)
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_nbsd.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/bootmgr/bootmgr_bsd.c
src/detection/brightness/brightness_nbsd.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nbsd.c
@@ -821,7 +821,7 @@ elseif(OpenBSD)
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/bootmgr/bootmgr_bsd.c
src/detection/brightness/brightness_obsd.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_windows.c
+14 -2
View File
@@ -2,10 +2,22 @@
#include "efi_helper.h"
#include "common/io/io.h"
#include <sys/efiio.h>
#ifdef __OpenBSD__
#include <dev/efi/efiio.h>
#else
#include <sys/efiio.h>
#endif
#include <sys/ioctl.h>
#include <fcntl.h>
#ifdef __NetBSD__
typedef uint16_t efi_char;
#endif
#ifndef EFI_GLOBAL_VARIABLE
#define EFI_GLOBAL_VARIABLE { 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, { 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c } }
#endif
const char* ffDetectBootmgr(FFBootmgrResult* result)
{
FF_AUTO_CLOSE_FD int efifd = open("/dev/efi", O_RDWR);
@@ -13,7 +25,7 @@ const char* ffDetectBootmgr(FFBootmgrResult* result)
uint8_t buffer[2048];
struct efi_var_ioc ioc = {
.vendor = { 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, { 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c } },
.vendor = EFI_GLOBAL_VARIABLE,
.data = buffer,
};