Skip to content

Commit 1c719fa

Browse files
committed
Bootmgr (BSD): add support for OpenBSD and NetBSD
1 parent a9f5722 commit 1c719fa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Diff for: CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ elseif(NetBSD)
739739
src/detection/bluetooth/bluetooth_nosupport.c
740740
src/detection/bluetoothradio/bluetoothradio_nosupport.c
741741
src/detection/board/board_nbsd.c
742-
src/detection/bootmgr/bootmgr_nosupport.c
742+
src/detection/bootmgr/bootmgr_bsd.c
743743
src/detection/brightness/brightness_nbsd.c
744744
src/detection/btrfs/btrfs_nosupport.c
745745
src/detection/chassis/chassis_nbsd.c
@@ -821,7 +821,7 @@ elseif(OpenBSD)
821821
src/detection/bluetooth/bluetooth_nosupport.c
822822
src/detection/bluetoothradio/bluetoothradio_nosupport.c
823823
src/detection/board/board_windows.c
824-
src/detection/bootmgr/bootmgr_nosupport.c
824+
src/detection/bootmgr/bootmgr_bsd.c
825825
src/detection/brightness/brightness_obsd.c
826826
src/detection/btrfs/btrfs_nosupport.c
827827
src/detection/chassis/chassis_windows.c

Diff for: src/detection/bootmgr/bootmgr_bsd.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@
22
#include "efi_helper.h"
33
#include "common/io/io.h"
44

5-
#include <sys/efiio.h>
5+
#ifdef __OpenBSD__
6+
#include <dev/efi/efiio.h>
7+
#else
8+
#include <sys/efiio.h>
9+
#endif
610
#include <sys/ioctl.h>
711
#include <fcntl.h>
812

13+
#ifdef __NetBSD__
14+
typedef uint16_t efi_char;
15+
#endif
16+
17+
#ifndef EFI_GLOBAL_VARIABLE
18+
#define EFI_GLOBAL_VARIABLE { 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, { 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c } }
19+
#endif
20+
921
const char* ffDetectBootmgr(FFBootmgrResult* result)
1022
{
1123
FF_AUTO_CLOSE_FD int efifd = open("/dev/efi", O_RDWR);
1224
if (efifd < 0) return "open(/dev/efi) failed";
1325

1426
uint8_t buffer[2048];
1527
struct efi_var_ioc ioc = {
16-
.vendor = { 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, { 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c } },
28+
.vendor = EFI_GLOBAL_VARIABLE,
1729
.data = buffer,
1830
};
1931

0 commit comments

Comments
 (0)