From 6787efb635747d7af513bc9ac0dc6b5b4caa4c09 Mon Sep 17 00:00:00 2001 From: Colton Fussy Date: Thu, 17 Oct 2019 18:50:37 -0500 Subject: [PATCH 1/5] only unit tested but it should work --- flash-it.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/flash-it.sh b/flash-it.sh index 24ec8fc..85c4b88 100644 --- a/flash-it.sh +++ b/flash-it.sh @@ -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" @@ -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 @@ -277,4 +285,4 @@ echo echo echo "All done. Copy /tmp/${SAS_ADDRESS}/ to persistent media and reboot." -echo +echo \ No newline at end of file From bc3b8e0c43e2108fb9ab6cb967092b28b12ea15c Mon Sep 17 00:00:00 2001 From: Colton Fussy Date: Thu, 17 Oct 2019 19:08:22 -0500 Subject: [PATCH 2/5] updated readme --- H310MM_mod.cfg => H310MM_mod.example.cfg | 50 ++++++++++++------------ README.md | 18 +++++++-- 2 files changed, 39 insertions(+), 29 deletions(-) rename H310MM_mod.cfg => H310MM_mod.example.cfg (94%) diff --git a/H310MM_mod.cfg b/H310MM_mod.example.cfg similarity index 94% rename from H310MM_mod.cfg rename to H310MM_mod.example.cfg index 041b050..9dad28d 100644 --- a/H310MM_mod.cfg +++ b/H310MM_mod.example.cfg @@ -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 diff --git a/README.md b/README.md index bd2f11c..7c51a3f 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,27 @@ 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. \*_You will need to move your backups to persistent storage before rebooting or they will be lost_ ## Supported Devices * PERC H310 Mini Monolithic +* PERC H310 (beta) * _more coming soon!_ +## Should support but untested (plz halp) +* Other cacheless LSI SAS2008 cards + +## How to test 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! + ## 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) @@ -39,10 +50,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: ``` From f1783fbfa91103c8c421562ecf2535b813ebe26d Mon Sep 17 00:00:00 2001 From: Colton Fussy Date: Thu, 17 Oct 2019 19:18:29 -0500 Subject: [PATCH 3/5] update readme --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7c51a3f..6184e2c 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,6 @@ Tested on R320, R420, R720xd with RancherOS 1.5.4 (kernel 4.14) and the Ubuntu 1 ## Should support but untested (plz halp) * Other cacheless LSI SAS2008 cards -## How to test 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! - ## 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) @@ -77,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/). From ca2c3fe0e2a3832b3be18aaf4df2e131b0418ff7 Mon Sep 17 00:00:00 2001 From: Colton Fussy Date: Thu, 17 Oct 2019 19:28:17 -0500 Subject: [PATCH 4/5] lf conversion on cfg example --- H310MM_mod.example.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/H310MM_mod.example.cfg b/H310MM_mod.example.cfg index 9dad28d..1c77acc 100644 --- a/H310MM_mod.example.cfg +++ b/H310MM_mod.example.cfg @@ -23,3 +23,4 @@ Unk42 = 0x0000 Unk44 = 0x00000000 Unk48 = 0x0000 Unk4a = 0x00 + From fd6a1b61aa3cd6afc6fec99735a307f1bede361a Mon Sep 17 00:00:00 2001 From: Colton Fussy Date: Thu, 17 Oct 2019 19:28:57 -0500 Subject: [PATCH 5/5] barf --- H310MM_mod.example.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/H310MM_mod.example.cfg b/H310MM_mod.example.cfg index 1c77acc..9dad28d 100644 --- a/H310MM_mod.example.cfg +++ b/H310MM_mod.example.cfg @@ -23,4 +23,3 @@ Unk42 = 0x0000 Unk44 = 0x00000000 Unk48 = 0x0000 Unk4a = 0x00 -