[EXTERNAL EMAIL] tangential to the conversation, if anyone's interested in shell code that gets the BMC/IDRAC full firmware revision and type using IPMITool and the ipmi kernel modules, it follows.

This has a number of go-back revisions over time and hasn't been refactored, but it does the job.

I needed to updated it when Dell started releasing iDRAC firmwares that were in the "release/fix" series ({major}.{minor}.{release}.{fix}  -- where {major}.{minor} stayed the same, and most tools only report {major}.{minor}, like:

   # ipmitool bmc info | grep 'Firmware Revision'
    Firmware Revision         : 2.61


Note that if you perform a firmware upgrade, you'll have to 'rmmod' all the IPMI modules, then reload them to get updated results.

    # something like...

    while lsmod | grep -q '^ipmi_'; do modprobe --remove --all $(lsmod | awk '/^ipmi_/{print$1}'); done; modprobe --all  ipmi_si ipmi_devintf ipmi_msghandler


# get_sys_bmc_version
2.61.60.60 {iDRAC8}


# get_sys_bmc_version() {

# XXX /sys/class/ipmi won't update when the firmware is updated.
# XXX find a way to reload it if necessary

  # kernel class data doesn't expose name/type (e.g. iDRAC)
  if [ -f /sys/class/ipmi/ipmi0/device/bmc/firmware_revision ]; then
    fwver=$(cat /sys/class/ipmi/ipmi0/device/bmc/firmware_revision)
    if [ -f /sys/class/ipmi/ipmi0/device/bmc/aux_firmware_revision ]; then
      fwver_rev=$(printf "%d" "$(cut -d' ' -f2 /sys/class/ipmi/ipmi0/device/bmc/aux_firmware_revision)")       fwver_fix=$(printf "%d" "$(cut -d' ' -f1 /sys/class/ipmi/ipmi0/device/bmc/aux_firmware_revision)")
    fi
    if type ipmitool >/dev/null 2>&1; then
      bmctype="$(ipmitool sdr elist mcloc|sed -e 's/[[:space:]].*$//')"
      tmp="$(ipmitool mc info 2>/dev/null | grep 'Firmware Revision' \
        | sed -e 's/^[^:]*:[[:space:]]*\(.*[^ ]\)\([[:space:]]*$\)/\1/')"
      if [ "${fwver}" != "${tmp}" ]; then
        printf "WARNING: /sys/class/ipmi/ipmi0/device/bmc/firmware_revision (=${fwver}) differs from ipmitool mc info (=${tmp})\n" 1>&2         printf "         Perhaps firmware was updated and system not rebooted (or IPMI not reloaded)\n" 1>&2
      fi
    fi
    echo "${fwver}.${fwver_rev}.${fwver_fix}${bmctype:+ {${bmctype}}}"
  else
    if type ipmitool >/dev/null 2>&1; then
      bmctype="$(ipmitool sdr elist mcloc|sed -e 's/[[:space:]].*$//')"
      tmp="$(ipmitool mc info 2>/dev/null | grep 'Firmware Revision' \
        | sed -e 's/^[^:]*:[[:space:]]*\(.*[^ ]\)\([[:space:]]*$\)/\1/')"
      echo "${tmp}${bmctype:+ {${bmctype}}}"
    else
      echo ""
    fi
  fi
}


_______________________________________________
Linux-PowerEdge mailing list
[email protected]
https://lists.us.dell.com/mailman/listinfo/linux-poweredge

Reply via email to