blob: 66e50ea517f78c47aa282f6aed43573c8a4e1870 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "bios.h"
#include "common/settings.h"
#include "common/sysctl.h"
#include "common/io.h"
#include "common/smbios.h"
const char* ffDetectBios(FFBiosResult* result) {
ffSettingsGetFreeBSDKenv("smbios.bios.reldate", &result->date);
ffCleanUpSmbiosValue(&result->date);
ffSettingsGetFreeBSDKenv("smbios.bios.revision", &result->release);
ffCleanUpSmbiosValue(&result->release);
ffSettingsGetFreeBSDKenv("smbios.bios.vendor", &result->vendor);
ffCleanUpSmbiosValue(&result->vendor);
ffSettingsGetFreeBSDKenv("smbios.bios.version", &result->version);
ffCleanUpSmbiosValue(&result->version);
ffSysctlGetString("machdep.bootmethod", &result->type);
if (result->type.length == 0) {
if (ffSettingsGetFreeBSDKenv("loader.efi", &result->type)) {
ffStrbufSetStatic(&result->type, ffStrbufEqualS(&result->type, "1") ? "UEFI" : "BIOS");
} else {
ffStrbufSetStatic(&result->type,
ffPathExists("/dev/efi" /*efidev*/, FF_PATHTYPE_FILE) ||
ffPathExists("/boot/efi/efi/" /*efi partition. Note /boot/efi exists on BIOS system*/, FF_PATHTYPE_DIRECTORY)
? "UEFI"
: "BIOS");
}
}
return NULL;
}
|