diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/bios/bios_bsd.c | |
Add the files
Diffstat (limited to 'src/detection/bios/bios_bsd.c')
| -rw-r--r-- | src/detection/bios/bios_bsd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/detection/bios/bios_bsd.c b/src/detection/bios/bios_bsd.c new file mode 100644 index 0000000..66e50ea --- /dev/null +++ b/src/detection/bios/bios_bsd.c @@ -0,0 +1,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; +} |