SMBIOS和DMI

  • 了解SMBIOS和DMI

1.SMBIOS

  系统管理BIOS (System Management BIOS ) 是主板或者系统制造厂商以标准格式显示产品信息所遵循的统一规范。每个主板厂商或者OEM厂商所生产的电脑,在出厂的时候都会按照smbios标准将信息写入到bios中。这些信息包括BIOS信息、系统信息、处理器信息、设备信息等。

  SMBIOS(System Management BIOS)是由BIOS/UEFI在初始化系统的时候收集的关于系统信息的一组结构化的表,并且存放在内存中,提供给操作系统使用。在Linux中,可以通过dmidecode命令查看,不同类型的SMBIOS子表通过type数值来区分。

1.1.dmidecode

1>.代码下载:

  • https://download.savannah.gnu.org/releases/dmidecode/

2>.命令用法示例:

  • 显示指定类型的信息:

    通常我只想查看某类型,比如CPU,内存或者磁盘的信息而不是全部的。这可以使用-t(–type TYPE)来指定信息类型:

# dmidecode -t bios
# dmidecode -t bios, processor (这种方式好像不可以用,必须用下面的数字的方式)
# dmidecode -t 0,4 (显示bios和processor)

Note: dmidecode到底支持哪些type?
man dmidecode:
bios, system, baseboard, chassis, processor, memory, cache, connector, slot

  • 通过关键字查看信息:

    比如只想查看序列号,可以使用:

#dmidecode -s system-serial-number
-s (–string keyword)支持的keyword包括:
bios-vendor,bios-version, bios-release-date,
system-manufacturer, system-product-name, system-version, system-serial-number,
baseboard-manu-facturer,baseboard-product-name, baseboard-version, baseboard-serial-number, baseboard-asset-tag,
chassis-manufacturer, chas-sis-version, chassis-serial-number, chassis-asset-tag,
rocessor-manufacturer, processor-version.

常用命令:

1、查看服务器型号:dmidecode | grep 'Product Name'
2、查看主板的序列号:dmidecode |grep 'Serial Number'
3、查看系统序列号:dmidecode -s system-serial-number
4、查看内存信息:dmidecode -t memory
5、查看OEM信息:dmidecode -t 11

3>. 信息如下:

$# dmidecode  | less
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
620 structures occupying 29060 bytes.
Table at 0x000E0010.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: Phoenix Technologies LTD
        Version: 6.00
        Release Date: 05/19/2017
        Address: 0xEA520
        Runtime Size: 88800 bytes
        ROM Size: 64 kB
        Characteristics:
                ISA is supported
                PCI is supported
                PC Card (PCMCIA) is supported
                PNP is supported
                APM is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                ESCD support is available
                Boot from CD is supported
                Selectable boot is supported
                EDD is supported
                Print screen service is supported (int 5h)
                8042 keyboard services are supported (int 9h)
                Serial services are supported (int 14h)
                Printer services are supported (int 17h)
                CGA/mono video services are supported (int 10h)
                ACPI is supported
                Smart battery is supported
                BIOS boot specification is supported
                Function key-initiated network boot is supported
                Targeted content distribution is supported
        BIOS Revision: 4.6
        Firmware Revision: 0.0

1.2.Accessing SMBIOS information

  The only access method defined for the SMBIOS structures is a table-based method, defined in version 2.1 of this specification. It provides the SMBIOS structures as a packed list of data referenced by a table entry point.

   The original SMBIOS 2.1 (32-bit) entry point, described in clause 5.2.1, allows the SMBIOS structure table to reside anywhere in 32-bit physical address space (that is, below 4 GB).
The SMBIOS 3.0 (64-bit) entry point, described in clause 5.2.2, allows the SMBIOS structure table to reside anywhere in 64-bit memory.

1.2.1. SMBIOS 2.1 (32-bit) Entry Point

   The 32-bit SMBIOS Entry Point Structure is described in Table 1. On non-UEFI systems, the 32-bit SMBIOS Entry Point structure, can be located by application software by searching for the anchor-string on paragraph (16-byte) boundaries within the physical memory address range 000F0000h to 000FFFFFh. This entry point encapsulates an intermediate anchor string that is used by some existing DMI browsers.

   On UEFI-based systems, the SMBIOS Entry Point structure can be located by looking in the EFI Configuration Table for the SMBIOS GUID (SMBIOS_TABLE_GUID, {EB9D2D31-2D88-11D3-9A16-0090273FC14D}) and using the associated pointer.

在这里插入图片描述
1.2.2.5.2.2 SMBIOS 3.0 (64-bit) Entry Point

  The 64-bit SMBIOS Entry Point Structure is described in Table 2.
  non-UEFI systems, the 64-bit SMBIOS Entry Point structure can be located by application software by searching for the anchor-string on paragraph (16-byte) boundaries within the physical memory address range 000F0000h to 000FFFFFh.

  On UEFI-based systems, the SMBIOS Entry Point structure can be located by looking in the EFI Configuration Table for the SMBIOS 3.x GUID (SMBIOS3_TABLE_GUID, {F2FD1544-9794-4A2C-992E-E5BBCF20E394}) and using the associated pointer.
在这里插入图片描述

2.DMI

  DMI(Desktop Management Interface,DMI)就是帮助收集电脑系统信息的管理系统,DMI信息的收集必须在严格遵照SMBIOS规范的前提下进行。SMBIOS(System Management BIOS)是主板或系统制造者以标准格式显示产品管理信息所需遵循的统一规范。SMBIOS和DMI是由行业指导机构Desktop Management Task Force(DMTF)起草的开放性的技术标准,其中DMI设计适用于任何的平台和操作系统。

  DMI充当了管理工具和系统层之间接口的角色。它建立了标准的可管理系统更加方便了电脑厂商和用户对系统的了解。DMI的主要组成部分是Management Information Format(MIF)数据库。这个数据库包括了所有有关电脑系统和配件的信息。通过DMI,用户可以获取序列号、电脑厂商、串口信息以及其它系统配件信息。

3.内核获取smbios信息

函数调用arch/x86/kernel/setup.c:

setup_arch-> dmi_setup->dmi_scan_machine

  在dmi_scan_machine()的源码中,它会判断当前系统是基于UEFI还是Legacy BIOS,如果是UEFI的话,则会直接到EFI System Table中找到EFI Configuration Table,然后在EFI Configuration Table中直接找到SMBISO表的指针。
在这里插入图片描述
  对于Legacy的系统而言,则会按照SMBIOS spec里面规定的方法,在0x000F0000 ~ 0x000FFFFF的物理地址范围内寻找SMBIOS表的Anchor Sthing,即"SM3",定位SMBIOS表。

在这里插入图片描述
Documentation/ABI/testing/sysfs-firmware-dmi-tables:

  1 What:       /sys/firmware/dmi/tables/                                                                    
  2 Date:       April 2015
  3 Contact:    Ivan Khoronzhuk <ivan.khoronzhuk@globallogic.com>
  4 Description:
  5         The firmware provides DMI structures as a packed list of
  6         data referenced by a SMBIOS table entry point. The SMBIOS
  7         entry point contains general information, like SMBIOS
  8         version, DMI table size, etc. The structure, content and
  9         size of SMBIOS entry point is dependent on SMBIOS version.
 10         The format of SMBIOS entry point and DMI structures
 11         can be read in SMBIOS specification.
 12 
 13         The dmi/tables provides raw SMBIOS entry point and DMI tables
 14         through sysfs as an alternative to utilities reading them
 15         from /dev/mem. The raw SMBIOS entry point and DMI table are
 16         presented as binary attributes and are accessible via:
 17 
 18         /sys/firmware/dmi/tables/smbios_entry_point
 19         /sys/firmware/dmi/tables/DMI
 20 
 21         The complete DMI information can be obtained using these two
 22         tables.

refer to

  • https://www.dmtf.org/standards/smbios
  • http://www.nongnu.org/dmidecode/
  • https://lore.kernel.org/patchwork/patch/794764/
  • https://patches.linaro.org/patch/39316/
  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值