From: Artem Senichev <artemsen@gmail.com>
To: "Garrett, Mike (HPE Server Firmware)" <mike.garrett@hpe.com>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>
Subject: Re: Using smbios-mdr: expected file format
Date: Thu, 8 Jul 2021 18:27:19 +0300 [thread overview]
Message-ID: <20210708152719.2b5apj5pslvpbfhz@gmail.com> (raw)
In-Reply-To: <DF4PR8401MB063422AB09B179DBD08A32F48F199@DF4PR8401MB0634.NAMPRD84.PROD.OUTLOOK.COM>
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(×tamp);
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.
prev parent reply other threads:[~2021-07-08 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-08 14:31 Using smbios-mdr: expected file format Garrett, Mike (HPE Server Firmware)
2021-07-08 15:27 ` Artem Senichev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210708152719.2b5apj5pslvpbfhz@gmail.com \
--to=artemsen@gmail.com \
--cc=mike.garrett@hpe.com \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).