使用 SCELNX 修改浪潮 BIOS
分类:Server 标签:Bios
WHAT
厂里一批浪潮 Inspur SA5212M4 型号机器在 CentOS 8 下无法使用 isrest
工具修改 BIOS:
# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
# ipmitool bmc info|grep ^Firmware
Firmware Revision : 4.08
# /opt/ISREST-Linux-V6.0.0/bin/isrest setBios -A Numa -V Enable
Failure: Error in opening command.
测试了一番发现 BMC 固件版本 低于 4.08
以下 是失败的 4.09
和 4.11
版本的 BMC 固件正常:
# ipmitool bmc info|grep ^Firmware
Firmware Revision : 4.09
# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
# /opt/ISREST-Linux-V6.0.0/bin/isrest setBios -A Numa -V Enable
--------------------------------------------------
Success: Set bios success.
--------------------------------------------------
# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
# ipmitool bmc info|grep ^Firmware
Firmware Revision : 4.11
# /opt/ISREST-Linux-V6.0.0/bin/isrest setBios -A Numa -V Enable
--------------------------------------------------
Success: Set bios success.
--------------------------------------------------
WHY
BMC 4.08
版本的固件修改 BIOS 时调用的 IPMI raw 指令异常报错:
# strace -f -e trace=write -o /tmp/strace-bios.log -s 1024 /opt/ISREST-Linux-V6.0.0/bin/isrest setBios -A Numa -V Enable
# tail -20 /tmp/strace-bios.log
296826 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=296830, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
297163 write(1, "FRU Device Description : Builtin FRU Device (ID 0)\n Chassis Type : Rack Mount Chassis\n Chassis Part Number : ...", 564) = 564
297163 +++ exited with 0 +++
297162 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=297163, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
297162 +++ exited with 0 +++
296826 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=297162, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
297178 write(2, "Unable to send RAW command (channel=0x0 netfn=0x3a lun=0x0 cmd=0x19 rsp=0xc1): Invalid command\n", 95) = 95 <-- RAW 命令异常
297178 +++ exited with 1 +++
297177 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=297178, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
297177 +++ exited with 1 +++
296826 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=297177, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
297180 write(2, "Unable to send RAW command (channel=0x0 netfn=0x3a lun=0x0 cmd=0x1a rsp=0xc1): Invalid command\n", 95) = 95 <-- RAW 命令异常
297180 +++ exited with 1 +++
297179 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=297180, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
297179 +++ exited with 1 +++
296826 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=297179, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
296826 write(1, "Failure: Error in opening command.\n", 35) = 35 <-- 失败
296826 +++ exited with 0 +++
296821 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=296826, si_uid=0, si_status=0, si_utime=12, si_stime=8} ---
296821 +++ exited with 0 +++
HOW
对于 BMC 固件版本低于 4.08
的机器使用 SCELNX_64
修改 BIOS :
#!/bin/bash
if ! dmidecode -t 1 | grep -iq inspur
then
echo "__ERROR: ONLY for INSPUR server"
exit 2
fi
bmc_ver=$(ipmitool mc info|awk '/^Firmware/{print $NF}')
if awk 'BEGIN {exit !('$bmc_ver' <= '4.08')}'
then
chmod u+x /root/SCELNX_64
/root/SCELNX_64 /o /lang /s /root/bios.cfg
grep -A7 -i numa /root/bios.cfg
numa_map_string=$(grep -A7 -i numa /root/bios.cfg|awk '/Map String/{print $NF}')
if [ -n "$numa_map_string" ]
then
/root/SCELNX_64 /i /ms $numa_map_string /qv 0x01
/root/SCELNX_64 /o /ms $numa_map_string
fi
fi
脚本执行过程:
+ dmidecode -t 1
+ grep -iq inspur
++ ipmitool mc info
++ awk '/^Firmware/{print $NF}'
+ bmc_ver=4.07
+ awk 'BEGIN {exit !(4.07 <= 4.08)}'
+ /root/SCELNX_64 /o /lang /s /root/bios.cfg
----------------------------------------------------------------------------
| Copyright (c)2017 American Megatrends, Inc. |
| AMISCE Utility. Ver 5.03.1106 |
----------------------------------------------------------------------------
WARNING: Duplicate questions found. Only one question will be enabled in the script.
Script file exported successfully.
+ grep -A7 -i numa /root/bios.cfg
Setup Question = Numa
Map String = CMRF008
Token =195 // Do NOT change this line
Offset =FAC
Width =01
BIOS Default =[00]Disabled
Options =*[00]Disabled // Move "*" to the desired Option
[01]Enabled
++ grep -A7 -i numa /root/bios.cfg
++ awk '/Map String/{print $NF}'
+ numa_map_string=CMRF008
+ '[' -n CMRF008 ']'
+ /root/SCELNX_64 /i /ms CMRF008 /qv 0x01
----------------------------------------------------------------------------
| Copyright (c)2017 American Megatrends, Inc. |
| AMISCE Utility. Ver 5.03.1106 |
----------------------------------------------------------------------------
Question value imported successfully.
+ /root/SCELNX_64 /o /ms CMRF008
----------------------------------------------------------------------------
| Copyright (c)2017 American Megatrends, Inc. |
| AMISCE Utility. Ver 5.03.1106 |
----------------------------------------------------------------------------
Options =[00]Disabled
*[01]Enabled
重启服务器后确认 NUMA 设置生效:
# lscpu|grep -i numa
NUMA node(s): 2
NUMA node0 CPU(s): 0-11,24-35
NUMA node1 CPU(s): 12-23,36-47