Created
August 20, 2020 22:20
-
-
Save XenHat/46c48596eeb1d482f25b0a43c6394dab to your computer and use it in GitHub Desktop.
use with caution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mfg="apple" | |
model="macbook" | |
version="5,2" | |
# Glob expression to match chips to dump. do not include asterisks, or rework the script. | |
chip_mfg='Macronix' | |
chip_model_glob="MX25L" | |
chip_glob="Found ${chip_mfg} flash chip \"${chip_model_glob}" | |
dump_folder=$(echo "$HOME/${mfg}_dump/${model}/${version}" | tr ',' '_' | tr '.' '_' | tr ' ' '_') | |
for chip in $(sudo flashrom -p internal 2>&1 | grep "${chip_glob}" | cut -d ' ' -f 5 | tr -d '"'); do | |
echo "Dumping ${chip}..." | |
dst_file=${dump_folder}/"$(echo "${chip}" | tr '/' '.').bin" | |
sudo flashrom -p internal -c "${chip}" -r "${dst_file}" | |
fddd="${dump_folder}/fd_dump/$(basename "${dst_file}")" | |
mkdir -p "${fddd}" && pushd "${fddd}" && sudo ifdtool -x "${dst_file}" | |
popd || exit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment