Using smbios-mdr: expected file format

Artem Senichev artemsen at gmail.com
Fri Jul 9 01:27:19 AEST 2021


On Thu, Jul 08, 2021 at 02:31:44PM +0000, Garrett, Mike (HPE Server Firmware) wrote:
> We have a method to transfer SMBIOS tables to the BMC (a legacy HPE-specific method implemented in our UEFI firmware), and on the BMC side, we can create a file at /var/lib/smbios/smbios2.  We have also integrated smbios-mdr into the build.  I'd like to match up our file format with what is expected by the smbios-mdr code to unlock all the goodness onto dbus.
> 
> Is there any documentation on the expected format of the file?  I gather there's a header (struct MDRSMBIOSHeader) But what structure is imposed over the rest of the data.  I'm hoping its something as simple as a concatenated set of SMBIOS records as defined in the spec (header(type, length, handle), type-specific-data, double-nulls).

Hi Mike,

There is a very simple format: header and SMBIOS dump.

This is how it works on our servers (patch for intel-ipmi-oem):
```
#include <smbiosmdrv2handler.hpp>

void handleSmbiosDump(const std::vector<uint8_t>& data)
{
    // save dump in MDR format
    const std::filesystem::path mdrPath(mdrType2File);
    std::filesystem::create_directories(mdrPath.parent_path());

    time_t timestamp;
    time(&timestamp);

    std::ofstream mdrFile(mdrType2File, std::ios::trunc | std::ios::binary);
    const MDRSMBIOSHeader header = {mdr2Version, mdrTypeII,
                                    static_cast<uint32_t>(timestamp),
                                    static_cast<uint32_t>(data.size())};
    mdrFile.write(reinterpret_cast<const char*>(&header), sizeof(header));
    mdrFile.write(reinterpret_cast<const char*>(data.data()), data.size());
    mdrFile.close();
}
```

-- 
Regards,
Artem Senichev
Software Engineer, YADRO.


More information about the openbmc mailing list