给阵列卡刷个机,IR 模式转 IT 模式

刷机?

不久前捡垃圾搞了一台低功耗 Homelab 主机玩玩,由于主板 SATA 口的限制,不能使用大于 2TB 的硬盘,对于咱这种梦想着拥有几十 TB 存储空间来存放老婆的死肥宅来说,2TB 怎么够了。于是想要突破限制,再给 Homelab 主机增加一块 6TB 的硬盘。于是,在洋垃圾堆里花了 50 块钱捡了这块阵列卡 👇。

买的这块阵列卡型号是 ServeRAID H1110 SAS/SATA Controller for IBM System x ,卖家说是 IBM H1110 ,其实都差不多啦。由于是第一次玩儿阵列卡,对这种型号也不是很熟悉,之后刷了新的固件又变成了 LSI 9211-4i

翻车?

收到货后,迫不及待地将存满老婆的硬盘接到阵列卡上,开机的时候,一直卡在阵列卡 BIOS 初始化页面很久很久。顿时觉着,完蛋翻车了,正准备去怼一波卖家,阵列卡启动等了五六分钟后进入了久违的 ESXi 的启动页面。这尼玛,坑我啊,你一个巴掌大的阵列卡启动竟然需要五分钟?内心一万匹草泥马奔腾而过。

IR 模式?

在网上看来一下大佬们的评论,说阵列卡 IR 模式的启动速度要慢一些?然后又找到了 IBM H1110 卡刷为 LSI 9211-4i IT 固件 ,里面提到的可以将 IR 模式刷为 IT 直通模式。至于 IR 模式和 IT 模式,自己太菜没找到确切的资料。大概可以理解为 IR 模式适用于使用阵列卡组 RAID 阵列,而 IT 模式就是所谓的直通模式,不适用 RAID ,只使用阵列卡的硬盘控制器?相当于主板上的 SATA 接口。何况我这个是小主机,里面也塞不下那么多的硬盘,所以阵列卡使用 IT 直通模式无疑是最好的选择。

万物皆可刷?

参照大佬们的博客,咱也要体验一把刷卡的痛快了,毕竟折腾这些没用的玩意儿也是咱的一大乐趣。

我青年时代就刷过:诺基亚、摩托罗拉、三星、黑莓、Lumia、HTC,我还刷过:路由器、交换机、阵列卡、电视盒子……

安卓机佬们想必对 twrp 再熟悉不过了,它是我们刷机,刷各种 ROM 包最常用的系统,相当于 Windows 中的 PE 系统,对系统分区刷上 ROM 来达到刷机的目的。刷阵列卡的固件和刷机也差不多,也是需要一个底层的系统进去对阵列卡上的存储芯片进行操作。最常见的就是 Dos 和 EFI Shell ,由于 Dos 年代久远,且我的主板对 EFI 支持比较友好,在进行刷机的时候为了稳妥起见选择 EFI shell。

记录 SAS 地址

在刷阵列卡之前要线记录下 SAS 的 Address ,进入到阵列卡的 BIOS 中会有这个信息。

找好固件和文档

由于我要刷入的固件不是阵列卡原厂的固件,只找到了现成的固件,直接就拿来用了,应该问题不大。而且刷入的流程也是比较简滴。IBM H1110 卡刷为 LSI 9211-4i IT 固件 :

# 备份原卡信息和sbr
MegaCli.exe -AdpAllInfo -aAll -ApplogFile bak.txt
MegaRec.exe -readsbr 0 orig.sbr
#擦写sbr和flash一遍能刷入LSI原厂固件
MegaRec -writesbr 0 sbrempty.bin
MegaRec -cleanflash 0
#重启再次进入DOS
reboot
#刷入对应IT固件和ROM
sas2flsh -o -f 2114it.bin -b mptsas2.rom
#恢复原来的SAS地址
sas2flsh -o -sasadd xxxxxxxx
#查看最新状态
sas2flsh -list
#重启,完成
reboot

一些官方的文档 Flash upgrading firmware on LSI SAS HBAs; Upgraded firmware on 9211-8i to P8, now duplicated drives

Advanced users:

To delete the firmware and BIOS in your 9211, then reflash it, follow these steps:

  1. Check to see if there is an also an onboard SATA controller with disk in the system before running the commands below.
    Run sas2flsh -listall
    If you see only the 9211, then run the commands as shown below.
    If you see two controllers (e.g. c0 and c1, then add -c 1 to all of the commands below–> sas2flsh -c 1 -o -e 6
  2. Record the SAS address of the 9211 in case you need it later. To display it, type:
    sas2flsh -list

and write down the SAS address. You can run the is DOS, Windows, Linux, etc.
3. Download 9211_8i_Package_for_P9_Firmware_BIOS_on_MSDOS_and_Windows.zip for the 9211-8i
4. Boot to DOS (create a DOS bootable USB stick from http://www.bootdisk.com or www.gocoding.com).
5. Run from DOS sas2flsh -o -e 6 (this will erase the controller firmware and BIOS).
6. Turn the system off.
7. Turn the system on and boot to DOS (note: the BIOS won’t post, as you will reflash it in step 8 below).
8. Run from DOS, with files sas2flsh.exe, the .bin and .rom files in the same directory:

For IR firmware:  sas2flsh -f 9211IRP9.bin -b mptsas2.rom
For IT firmware:  sas2flsh -f 9211itp9.bin -b mptsas2.rom

Note: you will need to rename 9211-8i_IR_P9.bin to 9211IRP9.bin and 9211-8i-IT_ph9.bin to 9211itp9.bin

  1. The controller will now work normally, with the P9 firmware and BIOS.
  2. Check to make sure you have a SAS address:
    sas2flsh -list
    If you see the same SAS address that you had in step 2, then you are done.
    If you don’t see the same SAS address, or you don’t see a SAS address, type:
    sas2flsh -o -sasadd

上面提到的都是基于 Dos 系统上操作的,不过我试了一下都翻车了 🤣

制作 EFI shell 系统

如果主板支持 EFI 的话,建议使用 EFI shell 刷入固件,在 Dos 下会有些奇怪的问题。

按照 How do I “Boot to UEFI shell”? 中提到的:

It depends on whether your UEFI has a shell builtin. If it does, there should be an option in its settings / boot menu for you to launch it. Some motherboard also provide an option to launch a shell from the EFI System Partition (ESP). You should consult the manual of your motherboard for the path it will look for (the instruction is often vague though). Usually they are looking for a file named Shell.efi in the ESP root folder.

Another way is to launch it just like you launch any other EFI binary (e.g. bootloader). Since it’s not really accessible to register a EFI binary to your UEFI or put the shell binary to your ESP in Windows, so the easiest way is probably to put it as \EFI\Boot\bootx64.efi (also put the update.nsh you need to run and the files it requires under \EFI\Boot\) in a FAT(32)-formatted USB drive (It shouldn’t matter whether it’s MBR or GPT as long as your UEFI is standard-conforming enough). Then reboot and boot the USB in UEFI mode from your UEFI boot menu.

You can obtain the EFI shell binary from the EDK2 project repo:

(Note: some older EFI tools like sas2flash.efi for UEFI) only work with such an old EFI shell (which works on current mainboards with current UEFI))

首先需要一个 U 盘,对容量没有闲置,几十兆足够,把分区格式化为 FAT32 文件系统格式,然后下载一个 EFI shell 的 efi 文件 version 1 ,把该文件保存在 FAT32 分区下的 \EFI\Boot\bootx64.efi 路径下。

Download from Github Tianocore the precompiled UEFI version 1 Shell: Shell_Full.efi. (Only v1 is applicable, later versions are not compatible with the flash tool and end up with the message: “InitShellApp: Application not started from Shell”.)

由于刷固件的工具 sas2flash.efi 只和 EFI shell v1 版本的兼容,我第一次刷的时候时使用的 v2 版本,提示 “InitShellApp: Application not started from Shell” 错误 😂

然后还需要把固件 2114it.bin ,以及刷固件用到的工具 sas2flash.efi 放入到 FAT32 跟目录下,其中固件根据阵列卡的型号不同需要自行找到相应的固件版本,我这个虽然是 IBM H1110 型号的,但是可以刷成 LSI 9211 的,所以就没去找原厂的固件。

进入 EFI shell 刷入新的固件

How-to: Flash LSI 9211-8i using EFI shell 大佬那里复制粘贴过来的的教程:

  1. Insert the controller card in a PCIe slot. (I’ve used the slot Nr. 3. In case of troubles recognizing the card in your desktop PC try different slots.)
  2. Boot the PC and prepare the USB stick:
  3. In the USB stick create and format a FAT or FAT32 partition >= 10 MB. (I’ve created 500 MB FAT32 partition. I wouldn’t recommend large partitions, who knows if the EFI shell will read every big partition.)
  4. Create the sub-folders for EFI boot. In the web there are two different structures: /boot/efi and /efi/boot. For time saving I’ve created both groups, it works.
  5. Download from Broadcom following packages: Installer_P20_for_UEFI and 9211-8i_Package_P20_IR_IT_Firmware_BIOS_for_MSDOS_Windows and extract them on your PC’s HDD.
  6. Copy from the downloaded packages three files to the USB stick root folder:
  7. from the first package the file sas2flash.efi (it is in sub-folder /sas2flash_efi_ebc_rel/);
  8. from the second package: 2118it.bin (it is in sub-folder /Firmware/HBA_9211_8i_IT/) and mptsas2.rom (it is in sub-folder /sasbios_rel/).
  9. Download from Github Tianocore the precompiled UEFI version 1 Shell: Shell_Full.efi. (Only v1 is applicable, later versions are not compatible with the flash tool and end up with the message: “InitShellApp: Application not started from Shell”.)
  10. Rename the Shell_Full.efi in ShellX64.efi and copy this file to following three USB stick destinations: root folder, /boot/efi/, /efi/boot/. (Again, there are different advices, for time saving it easier to use all three choices.)
  11. The creative part is completed, it’s time for action. Restart the PC and enter the BIOS. If you use ASUS UEFI BIOS Utility in advanced mode, mouse click on the Exit (not by using keyboard “Esc”), in the next dialog select “Launch EFI Shell from filesystem device”. Other BIOS should behave similarly.
  12. Next you should see starting shell execution, ending with a prompt: “Shell>” (not the “2.0 Shell>”!).
  13. Type the command: map –b (+Enter) for listing of available disks. Locate which one is your USB stick. In my case it is the fs6:
    “fs6 :Removable HardDisk - … USB(…)”
  14. You can break further execution of the map command by q.
  15. Switch to the located USB stick by command fsN: (+Enter) (N=6 – in my example = “fs6:”, set N to your USB stick ID).
  16. Dir shows the file list:
    2118IT.BIN
    MPTSAS2.ROM
    sas2flash.efi BOOT EFI ShellX64.efi
  17. The action can start. During it the power shall not be brocken!
  18. Erase the controller flash memory: sas2flash.efi -o -e 6.
  19. Write the new firmware to the flash: sas2flash.efi -o -f 2118it.bin -b mptsas2.rom.
  20. After a while you’ll see the success message. You can restart the PC and check if the controller BIOS reports the new “IT”-firmware.
  21. The card is ready to use.
  • 使用 map -b 命令查看 U 盘的路径,一般为 fsX 然后按下 fs0: 路径就切换到了 U 盘的 FAT32 分区下。

  • 然后使用 sas2flash.efi -o -e 6 命令清空阵列卡的 flash memory
  • 接着使用 sas2flsh -o -f 2114it.bin -b mptsas2.rom 命令刷入新的固件。

  • 恢复 SAS 地址 sas2flsh -o -sasadd xxxxxxxx

操作完以上步骤后就可以重启了

IT 模式?

刷完之后阵列卡的型号就莫名其妙地变成了 LSI® SAS 9211-4i PCI Express® to 6Gb/s Serial Attached SCSI (SAS) Host Bus Adapter ,固件的版本也变成了 IT 模式,开机的速度比以前快了很多,只需要不到 5s 就自检完成进入 ESXi 的启动流程,终于告别原先的龟速启动了。

在 ESXi 中,阵列卡也被识别为了 LSI2004 ,看来是没问题了,插上硬盘也都是识别出来了。

参考

由于是第一次给 HBA 卡刷固件,在网上找了些资料做参考: