Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions H310MM_mod.cfg → H310MM_mod.example.cfg
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Unk00 = 0x0022f661
Unk04 = 0xb34f2000
Unk08 = 0x91d700f8
PCIVID = 0x1000
PCIPID = 0x0072
Unk10 = 0x0000
HwConfig = 0x0104
SubsysVID = 0x1028
SubsysPID = 0x1f51
Unk18 = 0x00000000
Unk1c = 0x00000000
Unk20 = 0x00000000
Unk24 = 0x00000000
Unk28 = 0x00000000
Unk2c = 0x00000000
Unk30 = 0x40000000
Unk34 = 0x0300c650
Unk38 = 0x00000000
Unk3c = 0x00000000
Interface = 0x00
Unk41 = 0x2c
Unk42 = 0x0000
Unk44 = 0x00000000
Unk48 = 0x0000
Unk4a = 0x00
Unk00 = 0x0022f661
Unk04 = 0xb34f2000
Unk08 = 0x91d700f8
PCIVID = 0x1000
PCIPID = 0x0072
Unk10 = 0x0000
HwConfig = 0x0104
SubsysVID = 0x1028
SubsysPID = 0x1f51
Unk18 = 0x00000000
Unk1c = 0x00000000
Unk20 = 0x00000000
Unk24 = 0x00000000
Unk28 = 0x00000000
Unk2c = 0x00000000
Unk30 = 0x40000000
Unk34 = 0x0300c650
Unk38 = 0x00000000
Unk3c = 0x00000000
Interface = 0x00
Unk41 = 0x2c
Unk42 = 0x0000
Unk44 = 0x00000000
Unk48 = 0x0000
Unk4a = 0x00
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ During execution the script will:

Just a single reboot is necessary after the script completes.\*

Currently this only works for the H310 Mini Mono until the SBR modification is made dynamic and additional device identification strings are accumulated/tested.

Tested on R320, R420, R720xd with RancherOS 1.5.4 (kernel 4.14) and the Ubuntu 18.04 console, but should work with anything that has bash and apt.

<sup>\*_You will need to move your backups to persistent storage before rebooting or they will be lost_</sup>

## Supported Devices
* PERC H310 Mini Monolithic
* PERC H310 (beta)
* _more coming soon!_

## Should support but untested (plz halp)
* Other cacheless LSI SAS2008 cards

## Prerequisites
* Server or other computer with only the target adapter installed and visible to the OS
* Linux environment with bash and apt that does not rely on the controller (live environment is recommended)
Expand All @@ -39,10 +41,9 @@ This script was born from necessity. I've got a pile of 12G Dell servers that ne
## How to
1. Ensure the adapter you want to flash is the only LSI/Avago/rebranded HBA device in the system.

2. Copy `flash-it.sh` and `H310MM_mod.cfg` to a directory you're okay with making a mess in:
2. Copy `flash-it.sh` to a directory you're okay with making a mess in:
```
wget https://raw.githubusercontent.com/Confusingboat/flash-it/master/flash-it.sh
wget https://raw.githubusercontent.com/Confusingboat/flash-it/master/H310MM_mod.cfg
```
3. Make the script executable:
```
Expand All @@ -67,5 +68,14 @@ This one *is* interactive, but if your backups are in place you can just leave t
2. `chmod +x restore_sbr.sh`
3. `sudo ./restore_sbr.sh`

## Testing other adapters
Testing adapters that are currently not on the supported list is super easy! Just change the `ADAPTER_PATTERN="H310"` line, where `H310` is a regex pattern that matches your adapter. Please let me know if you test another adapter with success or failure, with the following information:
* Adapter model
* Exact pattern used
* Whether it succeeded or failed
* Other notes about your experience

PRs are also welcome!

## Credit where it is due
The creation of this script would not have been possible without a PDF I found by [/u/fourlynx](https://www.reddit.com/u/fourlynx) or the [lsirec tool](https://github.com/marcan/lsirec) and [other info](https://marcan.st/2016/05/crossflashing-the-fujitsu-d2607/) by [Hector Martin](https://marcan.st/about/).
14 changes: 11 additions & 3 deletions flash-it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BACKUP_ROOT_DIR="/tmp"

ADAPTER_PATTERN="H310"
ADAPTER_INDEX="0"
SBR_CFG_MODIFIED_FILE_PATH="H310MM_mod.cfg"
#SBR_CFG_MODIFIED_FILE_PATH="H310MM_mod.cfg"
FIRMWARE_UNPACK_DIR="/tmp/lsi_firmware"
UEFI_UNPACK_DIR="/tmp/lsi_uefi"
FIRMWARE_FILE_NAME="2118it.bin"
Expand Down Expand Up @@ -177,12 +177,20 @@ BACKUP_SBR_CFG_FILE="${ADAPTER_BACKUP_DIR}/${SAS_ADDRESS}_backup.cfg"
python3 lsirec/sbrtool.py parse "${BACKUP_SBR_FILE}" "${BACKUP_SBR_CFG_FILE}"
echo

# Modify SBR config
echo "Modifying SBR config..."
echo
SBR_CFG_MODIFIED_FILE_PATH="${ADAPTER_BACKUP_DIR}/${SAS_ADDRESS}_modified.cfg"
cp "${BACKUP_SBR_CFG_FILE}" "${SBR_CFG_MODIFIED_FILE_PATH}"
sed -i -r -e "s/^PCIPID = [0-9a-z]+$/PCIPID = 0x0072/I" "${SBR_CFG_MODIFIED_FILE_PATH}"
sed -i -r -e "s/^Interface = [0-9a-z]+$/Interface = 0x00/I" "${SBR_CFG_MODIFIED_FILE_PATH}"
echo

# Create modified SBR
echo "Building new SBR..."
echo
SBR_MODIFIED_FILE="${ADAPTER_BACKUP_DIR}/${SAS_ADDRESS}_modified.sbr"
[ ! -f "${SBR_CFG_MODIFIED_FILE_PATH}" ] && echo "Error: could not find modified SBR cfg file (e.g. H310MM_mod.cfg). No changes have been made." && exit 1
# THIS IS WHERE THE CODE SHOULD GO TO DO DYNAMIC MODIFICATION OF THE CFG FILE INSTEAD OF RELYING ON A STATIC ASSET
python3 lsirec/sbrtool.py build "${SBR_CFG_MODIFIED_FILE_PATH}" "${SBR_MODIFIED_FILE}"
echo

Expand Down Expand Up @@ -277,4 +285,4 @@ echo

echo
echo "All done. Copy /tmp/${SAS_ADDRESS}/ to persistent media and reboot."
echo
echo