一般服务器需要在出厂时烧录一个MAC地址到eeprom中,在BMC启动时从eeprom获取MAC地址设置到带外管理口网卡上。但是发现openbmc默认FRU没有使用Extra字段。需要自己实现
我的实现不是从eeprom直接读取raw,而是通过fru来获取MAC地址,因为fru也是从eeprom 中parse过来的
首先
需要在phosphor-ipmi-hostd/ipmi_fru_info_area.cpp中做下面的修改
...
// Property variables
static constexpr auto partNumber = "Part Number";
static constexpr auto serialNumber = "Serial Number";
static constexpr auto manufacturer = "Manufacturer";
static constexpr auto buildDate = "Mfg Date";
static constexpr auto modelNumber = "Model Number";
static constexpr auto prettyName = "Name";
static constexpr auto version = "Version";
static constexpr auto type = "Type";
// $ chris chen add property
static constexpr auto fruVersion = "FRU File ID";
static constexpr auto macAddress = "Custom Field 1";
// $ end by chris chen
// Board info areas
static constexpr auto board = "Board";
static constexpr auto chassis = "Chassis";
static constexpr auto product = "Product";
...
...
...
/**
* @brief Builds the Board info area data section
*
* @param[in] propMap map of properties for board info area
* @return FruAreaData container with board info area
*/
FruAreaData buildBoardInfoArea(const PropertyMap& propMap)
{
FruAreaData fruAreaData;
if (!propMap.empty())
{
preFormatProcessing(true, fruAreaData);
// Manufacturing date
appendMfgDate(propMap, fruAreaData);
// manufacturer
appendData(manufacturer, propMap, fruAreaData);
// Product name/Pretty name
appendData(prettyName, propMap, fruAreaData);
// Board serial number
appendData(serialNumber, propMap, fruAreaData);
// Board part number
appendData(partNumber, propMap, fruAreaData);
// $add by chris chen ,Board fru version
appendData(fruVersion, propMap, fruAreaData);
// $add by chris chen ,Board mac address
appendData(macAddress, propMap, fruAreaData);
// FRU File ID - Empty
fruAreaData.emplace_back(typeLengthByteNull);
// Empty FRU File ID bytes
fruAreaData.emplace_back(recordNotPresent);
// End of custom fields
fruAreaData.emplace_back(endOfCustomFields);
postFormatProcessing(fruAreaData);
}
return fruAreaData;
}
上面两句定义
fruVersion = "FRU File ID";
macAddress = "Custom Field 1";
appendData新增了fruVersion和macAddress字段,这样就可以在fru中显示对应的字段了
因为fru的generate也会调用上面代码,所以dbus下的fru interface同样会多出append的数据