Where does dmidecode get the SMBIOS table?

10,501

Solution 1

Looks like it comes from /dev/mem

root@aw42e ~]# strace -F -e open dmidecode -t 17
   <snip>
    open("/sys/firmware/efi/systab", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/proc/efi/systab", O_RDONLY)      = -1 ENOENT (No such file or directory)
    open("/dev/mem", O_RDONLY)              = 3
    SMBIOS 2.5 present.

    open("/dev/mem", O_RDONLY)              = 3
    Handle 0x0016, DMI type 17, 27 bytes
    Memory Device
<snip>

/dev/mem is described as

mem is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in mem are interpreted as physical memory addresses.

So to answer, it is contained in /dev/mem

I'm searching for more info, but I assume that the kernel inserts the DMI table into memory at boot time - from man dmidecode

As you run it, dmidecode will try to locate the DMI table. If it succeeds, it will then parse this table and display a list of records like this one:

Solution 2

The data defined in the DMI table is an industry standard; implemented for both Linux and Windows (among other PC OSs):

https://en.wikipedia.org/wiki/System_Management_BIOS

the System Management BIOS (SMBIOS) specification defines data structures (and access methods) that can be used to read information stored in the BIOS of a computer. Circa 1999, it became part of the domain of the Distributed Management Task Force (DMTF)...

At approximately the same time Microsoft started to require that OEMs and BIOS vendors support the interface/data-set in order to have Microsoft certification...

You can read more about the Linux implementation - and the driver used to export the actual, raw data to userspace ("/sys/class/dmi/", "/dev/mem", and friends) - here:

https://web.archive.org/web/20160318010215/http://www.linux.org/threads/the-linux-kernel-configuring-the-kernel-part-19.4929/

The actual kernel code for accessing DMI info is here (your distro/version might differ):

https://elixir.bootlin.com/linux/latest/source/drivers/firmware/dmi-sysfs.c

Share:
10,501
iglory
Author by

iglory

Updated on June 14, 2022

Comments

  • iglory
    iglory almost 2 years

    I always have this question and didn't get an answer after reading man-page and searching online. Anyone who has knowledge about this please comment.

    I understand that SMBIOS table or DMI table is what dmidecode locates and parses. But where does it get it from? Is it in the format of a file in Linux?