编译并生效userBaseConfig文件

操作场景

前提条件

  • 所有的依赖必须用root用户进行安装。
  • 用户可以通过如下命令进行安装上述依赖。

    apt-get install -y python3 make gcc unzip pigz bison flex libncurses-dev squashfs-tools bc device-tree-compiler libssl-dev cmake rpm2cpio

  • 交叉编译工具链安装请参见安装工具链

操作步骤

  1. 登录Linux服务器。
  2. 执行如下命令,切换至root用户。

    su - root

  3. 使用WinSCP工具或其他工具,将下载软件包获取的源码包“Ascend310B-source.tar.gz”上传至root用户属组目录下,例如“/opt”。详细操作请参见使用WinSCP传输文件
  4. 执行如下命令,进入源码包所在目录“/opt”。

    cd /opt

  5. 执行如下命令,解压源码包“Ascend310B-source.tar.gz”。

    tar -xzvf Ascend310B-source.tar.gz

  6. 执行如下命令,进入“Ascend310B-source”目录。

    cd Ascend310B-source

  7. 修改userBaseConfig配置文件。

    如果需要使能userBaseConfig相关功能,请执行此步骤。

    1. 执行如下命令,进入配置文件所在目录。

      cd config/adaptive/adaptive_config/

    1. 打开user_base_config.xml文件。

      vim user_base_config.xml

    2. 配置serdes信息,修改board_id字段为对应的board_id,chip0_strategy为使用的策略索引。
          <item name="version"><!--版本号-->
              <param version="20000"/>
          </item>
      
          <item name="product_strategy_info"><!--产品板策略ID-->
              <!--30150 对应十六进制75c6-->
              <param board_id ="75c6" phy_num = "1" chip0_strategy="1" max_power="0"  equal="0"/>
          </item>
      
          <item name="evb_strategy_info">
          </item>

      详细的配置说明,请参见自定义配置user_base_config.xml文件参数说明

    3. 设置serdes复用关系。详细的配置说明,请参见自定义配置user_base_config.xml文件参数说明

      弹性配置中的serdes复用关系参数必须与实际硬件单板保持一致,Serdes错误配置可能导致启动挂死,功能不可用。

      user_base_config.xml文件示例如下回显加粗字体。

          <item name="strategy_info_array"><!--启动策略矩阵-->
              <subitem subname="sub_strategy0">
                  <module class="serdes">
                      <submodule subclass="serdes_info">
                           <param lan_index="0" serdes_type="SATA" ssc_enable="1" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="SATA3.0" port_index = "0"/>
                           <param lan_index="1" serdes_type="SATA" ssc_enable="1" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="SATA3.0" port_index = "0"/>
                           <param lan_index="2" serdes_type="SATA" ssc_enable="1" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="SATA3.0" port_index = "0"/>
                           <param lan_index="3" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="1"  align_mode="0" frequency="PCIE_GEN2" port_index = "0"/>
                           <param lan_index="4" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="1"  align_mode="0" frequency="PCIE_GEN3" port_index = "0"/>
                           <param lan_index="5" serdes_type="USB"  ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/>
                           <param lan_index="6" serdes_type="USB"  ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/>
                           <param lan_index="7" serdes_type="USB"  ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/>
                      </submodule>
                  </module>
                  <module class="recovery">
                      <submodule subclass="recovery_info">
                           <param recovery_enable="0" gpio_index="1"/>
                      </submodule>
                  </module>
              </subitem>
              <subitem subname="sub_strategy1">
                  <module class="serdes">
                      <submodule subclass="serdes_info">
                           <param lan_index="0" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="4"  align_mode="0" frequency="PCIE_GEN3" port_index = "0"/>
                           <param lan_index="1" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="PCIE_GEN3" port_index = "0"/>
                           <param lan_index="2" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="PCIE_GEN3" port_index = "0"/>
                           <param lan_index="3" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="PCIE_GEN3" port_index = "0"/>
                           <param lan_index="4" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="1"  align_mode="0" frequency="PCIE_GEN3" port_index = "0"/>
                           <param lan_index="5" serdes_type="USB"  ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/>
                           <param lan_index="6" serdes_type="USB"  ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/>
                           <param lan_index="7" serdes_type="USB"  ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/>
                      </submodule>
                  </module>
                  <module class="recovery">
                      <submodule subclass="recovery_info">
                           <param recovery_enable="0" gpio_index="4"/>
                      </submodule>
                  </module>
               
    4. (可选)配置过温过流保护功能。若需查看详细的过温过流功能配置说明,请参见自定义配置user_base_config.xml文件参数说明

      如果关闭过流过温功能,可能会导致设备损坏,请谨慎配置。

      配置过温过流功能示例如下。

       <!--LP低功耗配置,无特殊说明数字为10进制, feature/edp/tdp各节点均支持缺省,配置定义与sysbaeconfig相同-->
                  <module class="lp">
                      <!--特性开关-->
                      <submodule subclass="feature">
                          <!--功能开关: 16进制掩码定义, 每比特位0为关闭1为使能-->
                          <!--   各项开关均为可选配置,默认不关闭,默认全1配置"-->
                          <!--过流保护功能开关, bit0-过流硬件降频,bit1-过流告警, bit2-过流软件降频,以下为功能全使能 -->
                          <param edp="0x7"/>
                          <!--过温保护功能开关, bit0-超高温下电, bit1-高温告警, bit2-过温降频,以下为功能全使能 -->
                          <param tdp="0x7"/>
                      </submodule>
                      <!--edp过流保护-->
                      <submodule subclass="edp">
                          <!--acg降频等级0(10%), 1(18%) 2(25%),其它不支持-->
                          <param acg_drop="2"/>
                          <!--mask(适用档位掩码, 16进制)-->
                          <!--hardware(单位0.1A, ina226硬件过流阈值)-->
                          <!--alarm   (单位0.1A, 软件监测过流告警阈值)-->
                          <!--ave     (单位0.1A, 软件监测过流降频阈值)-->
                          <!--示例:mask(适用0/1/2/3档) ina226阈值5A,软件告警3A, 降频5A-->
                          <param mask="0xF" hardware="50" alarm="30" ave="50"/>
                      </submodule>
                      <!--tdp过温保护-->
                      <submodule subclass="tdp">
                          <!--ctrl_temp    (单位0.1℃, 软件监测过温降频阈值)-->
                          <!--ultra_high   (单位0.1℃, tsensor超高温下电阈值,需大于60度(600),建议不超过105度)-->
                          <!--alarm_high   (单位0.1℃, 软件监测高温告警阈值)-->
                          <!--alarm_low    (单位0.1℃, 软件监测低温告警阈值(保留))-->
                          <!--示例:过温降频95, 告警92度, 超温下电105度, 低温告警-20度(保留)-->
                          <param ctrl_temp="950" ultra_high="1050" alarm_high="920" alarm_low="-200"/>
                      </submodule>
                  </module>
    5. 按“Esc”键,再执行如下命令,保存修改并按“Enter”键退出。

      :wq!

    6. 返回“Ascend310B-source”目录。

      cd /opt/Ascend310B-source

  8. 执行如下命令,编译userBaseConfig文件。

    bash build.sh usrBaseConfig

    出现如下回显,表示编译内核userBaseConfig文件成功。

    generate /opt/Ascend310B-source/output/userBaseConfig.bin success!
    sign /opt/Ascend310B-source/output/userBaseConfig.bin success!

    编译后的userBaseConfig.bin文件会自动存放于“Ascend310B-source/output”目录下。

生效userBaseConfig文件

  1. 登录Atlas 200I A2 加速模块系统环境。
  2. 执行如下命令,切换至root用户。

    su - root

  3. 使用“WinSCP”,将编译后的userBaseConfig.bin文件上传至任意目录下,例如“/run”。详细操作请参见使用WinSCP传输文件
  4. 升级userBaseConfig.bin文件。

    cd /run

    /var/davinci/driver/upgrade-tool --device_index -1 --component Usr_Base_Config --path userBaseConfig.bin

    出现如下回显,表示升级userBaseConfig.bin文件成功。

    {"device": 0, "succeed"}

  5. 若修改userBaseConfig文件时,涉及修改启动策略矩阵,则需配置dts文件,同步升级dt.img,详细操作请参见SerDes(PCIe/SATA/USB/ETH)
  6. 升级完成后重启生效。

    reboot