OpenBMC FRU如何新增Extra 字段

一般服务器需要在出厂时烧录一个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的数据

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值