work_sript/02.nicsensor
2024-07-15 11:41:20 +08:00
..
nicsensor.sh Add ( script : nicsensor.sh) 2024-07-15 11:41:20 +08:00
readme.txt Add ( script : nicsensor.sh) 2024-07-15 11:41:20 +08:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

    ### 重要说明 脚本仅用于M7服务器带有i2c standard tool工具的BMC使用
    
    一、脚本使用方法 V1.0

        1、针对不同项目请先修改脚本中的部分变量ADC128电压传感器的分压系数INA3221的分流精密电阻阻值

        2、为脚本增加可执行权限 chmod +x ./nicsensor.sh 

        3、脚本命令格式 ./nicsensor.sh <pcie_slot> <chip_type> <chip_slave>
            
            参数说明:
                pcie_slot : 网卡所在的PCIE槽位填数字012345
                chip_type : 传感器芯片的类型emc1413,adc128,ina3221
                chip_slave: 传感器芯片的I2C地址7bit
            
            举例说明读取PCIE 1 上网卡的adc128芯片 芯片slave地址为0x1f
                ./nicsensor.sh 1 adc128 0x1f

        4、特殊命令

            4.1 扫描服务器的PCIE slot 0 - 5上所有的I2C设备

                命令: ./nicsensor.sh detect
            
            4.2 读取fru信息

                命令: ./nicsensor.sh <pcie_slot> fru <chip_slave> read
                举例说明读取Ravel板卡的EEPROM中的FRU0x57
                    - ./nicsensor.sh 5 fru 0x57 read

            4.3 读取CPLD寄存器

                命令: ./nicsensor.sh <pcie_slot> cpld <chip_slave> <i2c_cmd>
                举例说明读取cpld的寄存器 0x00 ,读2个byte 
                    - ./nicsensor.sh 5 cpld 0x10 "i2ctransfer -y 13 w1@0x10 0x00 r2"


    二、5280M7 PCIE槽位和PCA9548的channel关系

        5280M7的PCIE槽位和PCA9548/9546没有确定的对应关系取决于使用的riser卡。根据一般情况选择的Riser卡对应
        情况如下:

            PCIE 0 = i2c bus 12 , 9548channel1(0x02)
            PCIE 1 = i2c bus 12 , 9548channel2(0x04)
            PCIE 2 = i2c bus 12 , 9548channel3(0x08)
            PCIE 3 = i2c bus 13 , 9548channel1(0x02)
            PCIE 4 = i2c bus 13 , 9548channel2(0x04)
            PCIE 5 = i2c bus 13 , 9548channel3(0x08)

        可以根据实际情况选择性的修改脚本中的 start_detect_device 和 set_configuration 两个函数
    
    三、M7 sysadmin用户 SSH打开方法

        5280M7服务器默认不开启SSH且串口通常有较多干扰打印因此推荐使用SSH来执行脚本刷新BMC镜像后需要重新配置

        1、打开M7 BMC的串口可通过串口线或者IPMI SOL带外登入

            使用IPMI SOL的前提环境可与BMC网络连接且电脑上有ipmitool工具
            SOL登陆方法
                1将SOL串口源切换到BMC
                    ipmitool -I lanplus -H <bmcip> -U admin -P admin raw 0x3c 0x2c 0x02 0x01
                2打开SOL
                    ipmitool -I lanplus -H <bmcip> -U admin -P admin sol activate
                备注:<bmcip> 为目标BMC的ip地址请自行更改为对应的ip地址

        2、登录进入bmc的linux系统

            bmc linux系统的默认用户名/密码 sysadmin/superuser
        
        3、在BMC的linux系统下执行命令

            1 cp /etc/defconfig/ssh_server_config_with_sysadmin /etc/ssh/sshd_config
            
            2 /etc/init.d/ssh restart

            执行完毕后就可以使用ssh登录BMC了

    四、常见问题

        1、脚本执行时出现大量的 Error

            由于M7服务器的I2C设计有PCA9641作为I2C仲裁器脚本执行过程中可能会被9641强行断开I2C连接造成大量的
            脚本Error这种时候重新执行脚本即可

        2、不建议使用该脚本进行压力测试

            由于BMC shell的版本非常原始没有集成高级的命令行工具因此处理数值时采用了复杂的脚本逻辑进行执行处
            理效率较低。另外由于9641芯片的存在不能保证压力测试的正常执行。