Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access UEFI SMBIOS table from Linux kernel space?

I want to write a Linux kernel module that do stuff depending on the board vendor and product version.

In userspace, I could just read files under /sys/class/dmi/id/*, but they are not available in kernel space.

I think I should collect data from UEFI SMBIOS table. Can I do it without hardcoding the exact memory address where each vendor uses to save the SMBIOS table?

like image 463
lseki Avatar asked Dec 04 '25 07:12

lseki


1 Answers

I figured out by myself.

There's a library to access DMI and obtain these information:

#include <linux/dmi.h>

const char *board_vendor, *product_version;
board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
product_version = dmi_get_system_info(DMI_PRODUCT_VERSION);
like image 50
lseki Avatar answered Dec 07 '25 04:12

lseki