Flash LSI SAS Adapters to HBA IT MODE

In the past year of so I’ve acquired a few SAS Adapters for my NAS and other server builds and needed to flash them to IT mode to use with TrueNAS and Windows storage pool. The following steps were performed on a PIKE 2008 card that came with an ASUS Z9PA-D8 motherboard.

I did quite some research on this matter and found that a lot of the tutorials have over complicated the issue if the only goal here is to flash the SAS adapter to IT mode, so here I’ll provide a simplified process.

Tools needed:

  • The firmware .bin file of your adapter. Most of the firmware files can be downloaded directly from Broadcom’s website. (Here we’re using the 2118it.bin file extracted from the 9211-8i_Package_P20_IR_IT_FW_BIOS_for_MSDOS_Windows package.
  • You do not necessarily need the full suite of the LSI command line toolkit, you only need three files: MegaRec.exe, DOS4GW.EXE, and sas2flash.efi . MegaCli is optional, I used it on one machine and it provides a lot of powerful functions but on the machine with PIKE 2008, it wasn’t able to detect any hardware.
  • The sbrempty.bin file.
  • A flash drive (a small one is enough, the files needed are only a few MBs) formatted to FAT32.
  • A copy of the EFI bootloader (efi\boot\bootx64.efi) to boot into the EFI shell.
  • Rufus, to make the flash drive DOS bootable.
  • [Optional]: If you want to be able to boot into the card’s BIOS utility, you can flash the mptsas2.rom as well (not provided), but if you only want your adapter to function like extra SATA ports in passthrough mode, you can ignore this one.

Note: You can probably perform the firmware flash without the EFI shell, the sas2flash tool has a DOS version, but from my experience the EFI version has the best compatibility and I’ve had the most success with it. All the files needed can be downloaded here: SAS-Adapters-IT-Mode.zip .

Steps:

1. Use Rufus to make a MS-DOS bootable flash drive. Add all files from the zip file to the root directory of the flash drive. The root directory should look like this:

LOCALE
efi
autorun.inf
autorun.ico
MegaRec.exe
DOS4GW.EXE
2118it.bin
sbrempty.bin
sas2flash.efi

2. Configure your boot options in BIOS as needed (legacy and UEFI), and boot into EFI first.

3. At the EFI shell prompt, move to the flash drive (mine is fs0: ), and execute the following commands:

# List your boards. If you only have one adapter, the index should be 0.
sas2flash.efi -listall

# Get the adapter's SAS address.
sas2flash.efi -c 0 -list

# You can pipe your output to a text file if you want to keep a record of it, and you can use the "edit" command in the EFI shell to view/edit the files, very much like how you use "nano" on Linux. e.g.:

sas2flash.efi -listall > myadapters.txt
sas2flash.efi -c 0 -list > adapter0info.txt
edit adapter0info.txt

4. Exit out of the EFI shell and boot into DOS. At the DOS prompt, move to your flash drive and execute the following MegaRec commands:

# Show adapters, which we already know from step 3 that our adapter is at "0".
megarec -adplist

# [Optional]: Make a backup of your SBR and SPD.
megarec -readsbr 0 file_name.sbr
megarec -readspd 0 file_name.spd

# Write the sbrempty.bin file.
megarec -writesbr 0 sbrempty.bin

# Clean the flash. This step might take a few minutes.
megarec -cleanflash 0

# Note: You can also pipe the output of these commands to a text file for documentation.

5. Boot into the EFI shell again and flash the 2118it.bin firmware.

# Flash the 2118it.bin firmware:
sas2flash.efi -c 0 -o -f 2118it.bin
OR
sas2flash.efi -c 0 -o -f 2118it.bin -b mptsas2.rom

# Grab the SAS address from step 3 and set the address.
# Note, the SAS address displayed in step 3 contains dashes, but when you enter it here you need to enter the 16 digits address without dashes.
sas2flash.efi -c 0 -o -sasadd 12345600000000AB

# Verify your adapter
sas2flash.efi -listall
sas2flash.efi -c 0 -list

If all the steps finished without errors, your SAS adapter should be working in IT Mode now. As a reference, I have the following cards on my servers: one PIKE 2008, one 9200-8i (or maybe a 9220-8i), and two IBM ServeRAID M1015 that came off some x3690 X5 servers.

Reference: MegaREC Command Usage:


MegaRAID HWR Contoller Recovery tool. Version 01.02-007 August 03, 2011
Copyright (c) 2006-2010 LSI Corp.
Supports 1078 controller and its Successors.

Usage:
MegaRec -help                  : Display the list of options
MegaRec -adpList               : Display identified MR controller(s)
MegaRec -corruptInfo           : Display corruption information of controller
MegaRec -m0flash <n> <image>   : Flash controller
                               : where <n> is the controller index
                               : and <image> is the image file to flash
MegaRec -cleanflash <n> <image>: Erase Flash. Programs if image is Provided.
                               : where <n> is the controller index
                               : and <image> is the image file to flash
MegaRec -readspd <n> <image>   : Read controller SPD to specified file
                               : where <n> is the controller index
                               : and <image> is the specified file name
MegaRec -writespd <n> <image>  : Write controller SPD from specified file
                               : where <n> is the controller index
                               : and <image> is the specified file name
MegaRec -readsbr <n> <image> [<byteCount>] : Read controller SBR to specified 
                               : file where <n> is the controller index,
                               : <byteCount> is the number of bytes of SBR 
                               : to be read and is optional to specify
                               : and <image> is the specified file name
MegaRec -writesbr <n> <image>  : Write controller SBR from specified file
                               : where <n> is the controller index
                               : and <image> is the specified file name
MegaRec -m0flash <n> <image> <-i2o/-fusion>     : Flash controller in I2O/FUSION mode
MegaRec -cleanflash <n> <image> <-i2o/-fusion>  : Erase Flash. Programs if image is Provided in I2O/FUSION mode.
MegaRec -readspd <n> <image> <-i2o/-fusion>     : Read controller SPD to specified file in I2O/FUSION mode
MegaRec -writespd <n> <image> <-i2o/-fusion>    : Write controller SPD from specified file in I2O/FUSION mode
MegaRec -readsbr <n> <image> [<byteCount>] <-i2o/-fusion> : Read controller SBR to specified file in I2O/FUSION mode
MegaRec -writesbr <n> <image> <-i2o/-fusion>    : Write controller SBR from specified file in I2O/FUSION mode